Tags

android

Adding a pre-build step to Android Studio builds

January 20, 2020  2 minute read  

I’m currently writing a cloud-native app with an Android (and iOS) front end. I’ve got my backend configuration written using Terraform, and it outputs a file called infrastructure.json that describes the backend in a JSON format. Now, the question becomes “how do I get that infrastructure.json file into my front end code?” A simple version of this would be to ensure I copy the file every single time I update it. However, a better solution would be to ensure the file exists and to copy it...

Mocking Android resources with Mockito and Kotlin

January 03, 2020  3 minute read  

I bumped into an issue that was a little harder than I expected to solve, so this is the documentation. Requirement: Load a JSON file from the res/raw resource directory. Actually, that wasn’t the problem. The problem was how do you test that functionality? The library I have a basic configuration library that is constructed like this: class Configuration internal constructor(jsonContext: String): Map<String, Any> { internal constructor(stream: InputStream) : this(stream.buf...

Unit testing asynchronous Android network libraries

January 01, 2020  5 minute read  

I’m writing a network library for Android at the moment, and specifically looking at unit tests. In my last article, I looking at mocking the Android context and other Android specific libraries. Since I am writing a network client library, I need to go a step further and deal with the network connection itself. How can I test the asynchronous network calls in a repeatable manner? Fortunately, there’s a library for that. Square, the same people that brought you OkHttp, also produce a moc...

Two tips for unit testing Android libraries

December 24, 2019  3 minute read  

I’m busy writing a networking library for one of my Android apps. The question today is “how do I properly test the library?” There are a few problem areas, and I’ll cover two of them today. How do I properly mock classes that aren’t really Android specific, like android.location.Location and android.net.Uri? How do I properly mock the Android context? Android Studio already integrates the excellent JUnit packages for unit testing. I don’t want to have to write a visual app just to...

Build a better RecyclerView Adapter

December 13, 2019  3 minute read  

Many of my Android apps end up including listst, which are implemented via a RecyclerView. More importantly, I know all the items in the list ahead of time. Every single blog and tutorial always uses the same methodology. This ends up being a lot of boilerplate code. Create a view holder class Create a list adapter Attach the list adapter to the recyclerview Update the view holder class to implement the UI Check out the requirements around clicking Arrange for the list of item...

Validating permissions on Android with Kotlin

October 07, 2019  2 minute read  

I’m continuing my educational coding exercise, developing a new photo sharing app. Recently, I completed my user authentication and registration process and I’m now quite happy with it, so I moved on to taking photographs. I’ve got an activity with a toolbar and a floating action button: <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/r...

Using Azure App Configuration for Remote Config with Android

September 22, 2019  11 minute read  

I’ve been playing with a new app recently. I decided I needed some support from the cloud around feature flags (turning on and off features for specific people so I can test things) and for remote configuration. Fortunately, Azure has a service in preview - App Configuration - and it does both of these things. There are preview libraries to go along with it for .NET, Java 8, JavaScript, and Python. Sadly, there is no library for Android Java. Fortunately, we can fix that! Let’s take a l...

Authentication with AWS Amplify and Android: Fraud Protection and Analytics

November 05, 2018  4 minute read  

This will be an in-depth series on authentication with AWS Amplify. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. Over the last seven ...

Authentication with AWS Amplify and Android: Integrating Biometrics

October 29, 2018  8 minute read  

This will be an in-depth series on authentication with [AWS Amplify]. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. This is the sevent...

Authentication with AWS Amplify and Android: Integrating TOTP

October 22, 2018  9 minute read  

This will be an in-depth series on authentication with [AWS Amplify]. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. Over the last five...

Authentication with AWS Amplify and Android: 3rd Party OIDC Providers

October 15, 2018  10 minute read  

This will be an in-depth series on authentication with [AWS Amplify]. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. In the last two ar...

Authentication with AWS Amplify and Android: Google Login

October 08, 2018  8 minute read  

This will be an in-depth series on authentication with [AWS Amplify]. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. This is part 4 — a...

Learn to build mobile and web apps with AWS Amplify and Serverless Framework

October 02, 2018  3 minute read  

There has always been a bit of a problem between deploying your backend and then integrating that same backend with your front end code. The front end needs to know where the back end is located. The traditional approach is to create a configuration file for the purpose. But how? The AWS Mobile team created the awsmobile CLI and followed that with the AWS Amplify CLI. These tools are great for new projects. They provide for best practices deployment capabilities on the backend — and automati...

Authentication with AWS Amplify and Android: Facebook Login

October 01, 2018  8 minute read  

This will be an in-depth series on authentication with [AWS Amplify]. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. This is part 3 — a...

Authentication with AWS Amplify and Android: Customizing the UI

September 23, 2018  9 minute read  

This will be an in-depth series on authentication with AWS Amplify. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. This is part 2 - cus...

Authentication with AWS Amplify and Android: The Basics

September 18, 2018  11 minute read  

This will be an in-depth series on authentication with AWS Amplify. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. I’m not going to cov...

Let your analytics drive engagement: Endpoint profiles with AWS Amplify and Android

September 11, 2018  6 minute read  

In my last article, I showed the current best way of integrating analytics into your Android app using Kotlin. The events are only half the story for engagement. You need to be able to segment your users so that you can send them appropriate signals to draw them back to your app. That means understanding your users — where they are, whether they have authenticated (and how), and what they are interested in. Amazon Pinpoint and the AWS Mobile SDK for Android provides some demographic informat...

Integrate Analytics into your Android applications with AWS Amplify

September 04, 2018  5 minute read  

I’ve become a big fan of Kotlin development for my Android apps. I also think that analytics should be integrated into every single app I write. I’ve covered integrating Amazon Pinpoint before via AWS Mobile Hub. Recently, AWS Amplify announced an updated CLI that provides support for native applications and bypasses the need to use the AWS web console for creating resources. Naturally, I wanted to try it out. Integrating analytics is now really easy. Here is how I do it: Start Local You do...

Native Android Development with AWS Amplify

August 27, 2018  5 minute read  

Up until this point, the experience for developing native iOS and Android apps with AWS has been a bit fragmented. There was AWS Mobile Hub; a web console that makes it easy to provision serverless cloud resources and get a configuration file back that describe the endpoints your app needs to communicate with. But because it is a web-based console, it requires the developer to switch back and forth between their local development machine and the browser. There is also the awsmobile CLI, but t...

Converting types with Room and Kotlin

August 08, 2018  5 minute read  

I’ve been working on a personal project, trying to get to grips with the various Android Architecture Components and Kotlin. One of the things I came up with was the requirement to deal with type conversion when using a SQLite database and the Room persistence library. Room is a nice abstraction to the internal SQLite database that converts models to tables within SQLite. It’s nice because it works alongside LiveData and RxJava to provide observable objects — when the database changes, the ob...

Implement Search-on-type in Android with RxJava

June 20, 2018  6 minute read  

I’m working on a new sample which, as is typical, communicates with a backend service for data through a serverless API. In this particular example, it’s a search capability that I am developing and one of the features I want to implement is “search while you type”. Not a problem, you might think. Just put a search box on the page (probably in the action bar), wire up the onTextChange event handler, and do the search. So, that’s what I did: override fun onCreateOptionsMenu(menu: Menu?): Boo...

Unit Testing in Android Studio with Kotlin

May 12, 2018  5 minute read  

I made myself a promise a couple of months ago. My next app would be fully unit tested for the non-UI components and fully instrument-tested for the UI components. That’s a tall order, especially since I’m using the latest and greatest Android Studio Canary. I ran into a few problems. Some can’t be solved and some can. Let’s start with a simple test. I’ve got a class that looks this: data class Note(val id: String = UUID.randomUUID().toString()) { var updated: Long = System.currentTimeMil...

Easy EditText content validation with Kotlin

April 11, 2018  3 minute read  

One of the things that I always deal with in my apps is the need to validate the input fields of a form. I can easily do this with this sample fragment of code (for example, for a length check): field.addTextChangeListener(object: TextWatcher { override fun afterTextChanged(s: Editable?) { val content = s?.text.toString() s?.error = if (content.length >= 6) null else "Minimum length = 6" } override fun beforeTextChanged(s: Editable?) { } override fun onTextChanged(s: Edita...

Using dependency injection with Kotlin

April 06, 2018  6 minute read  

In a recent post, I described how I can do app analytics by using the AWS Mobile SDK and an AWS Mobile Hub project. This is a great way to get usage analytics for your app, but it requires a tight coupling between the provider (the AWS Provider and AnalyticsClient) and the app. You need to initialize the provider early on (preferably in the Application wrapper or the first activity). That causes a tight linkage between the activities where it is used and the client object. This has several i...

Lessons in Kotlin: Toolbar Icons and Reflection

April 01, 2018  5 minute read  

There are many tutorials online on how to produce an Android app bar with an options menu — so much so that it can be boiled down to a few steps, and I’ll reproduce them here: Step 1: Create resources You actually need two resources. The first is a menu: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/mainActionCamera" an...

Lessons in Kotlin Threading: An Animated Splash Screen

March 29, 2018  2 minute read  

I find quite a lot of Android apps have splash screens. Some splash screens are for showing off the logo; others for hiding the extensive data load times. Whatever the reason, it’s a way for a little bit of creativity to shine through. My first effort My new app needs a splash screen. Splash screens aren’t hard until you need to do something that takes some time, and there are many tutorials on how to produce one out on the Internet. I’m going to focus on the one problem I had. Let’s take a...

Why I’m refactoring to Kotlin

March 21, 2018  5 minute read  

One of the things that is really cool about software development is that we are continually learning and adjusting. I spent a day recently learning Kotlin. I was so impressed with the language, I decided to refactor my entire Family Photos app. It did not take long. Why do I love Kotlin? I have to admit, I was skeptical at first. After all, I tried Swift for iOS as an alternate language and it felt foreign. Admittedly, Objective-C isn’t much better, but Swift definitely had some issues for ...

Back to top ↑

kotlin

Mocking Android resources with Mockito and Kotlin

January 03, 2020  3 minute read  

I bumped into an issue that was a little harder than I expected to solve, so this is the documentation. Requirement: Load a JSON file from the res/raw resource directory. Actually, that wasn’t the problem. The problem was how do you test that functionality? The library I have a basic configuration library that is constructed like this: class Configuration internal constructor(jsonContext: String): Map<String, Any> { internal constructor(stream: InputStream) : this(stream.buf...

Unit testing asynchronous Android network libraries

January 01, 2020  5 minute read  

I’m writing a network library for Android at the moment, and specifically looking at unit tests. In my last article, I looking at mocking the Android context and other Android specific libraries. Since I am writing a network client library, I need to go a step further and deal with the network connection itself. How can I test the asynchronous network calls in a repeatable manner? Fortunately, there’s a library for that. Square, the same people that brought you OkHttp, also produce a moc...

Two tips for unit testing Android libraries

December 24, 2019  3 minute read  

I’m busy writing a networking library for one of my Android apps. The question today is “how do I properly test the library?” There are a few problem areas, and I’ll cover two of them today. How do I properly mock classes that aren’t really Android specific, like android.location.Location and android.net.Uri? How do I properly mock the Android context? Android Studio already integrates the excellent JUnit packages for unit testing. I don’t want to have to write a visual app just to...

Build a better RecyclerView Adapter

December 13, 2019  3 minute read  

Many of my Android apps end up including listst, which are implemented via a RecyclerView. More importantly, I know all the items in the list ahead of time. Every single blog and tutorial always uses the same methodology. This ends up being a lot of boilerplate code. Create a view holder class Create a list adapter Attach the list adapter to the recyclerview Update the view holder class to implement the UI Check out the requirements around clicking Arrange for the list of item...

Validating permissions on Android with Kotlin

October 07, 2019  2 minute read  

I’m continuing my educational coding exercise, developing a new photo sharing app. Recently, I completed my user authentication and registration process and I’m now quite happy with it, so I moved on to taking photographs. I’ve got an activity with a toolbar and a floating action button: <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/r...

Using Azure App Configuration for Remote Config with Android

September 22, 2019  11 minute read  

I’ve been playing with a new app recently. I decided I needed some support from the cloud around feature flags (turning on and off features for specific people so I can test things) and for remote configuration. Fortunately, Azure has a service in preview - App Configuration - and it does both of these things. There are preview libraries to go along with it for .NET, Java 8, JavaScript, and Python. Sadly, there is no library for Android Java. Fortunately, we can fix that! Let’s take a l...

Authentication with AWS Amplify and Android: Fraud Protection and Analytics

November 05, 2018  4 minute read  

This will be an in-depth series on authentication with AWS Amplify. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. Over the last seven ...

Authentication with AWS Amplify and Android: Integrating Biometrics

October 29, 2018  8 minute read  

This will be an in-depth series on authentication with [AWS Amplify]. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. This is the sevent...

Authentication with AWS Amplify and Android: Integrating TOTP

October 22, 2018  9 minute read  

This will be an in-depth series on authentication with [AWS Amplify]. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. Over the last five...

Authentication with AWS Amplify and Android: 3rd Party OIDC Providers

October 15, 2018  10 minute read  

This will be an in-depth series on authentication with [AWS Amplify]. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. In the last two ar...

Authentication with AWS Amplify and Android: Google Login

October 08, 2018  8 minute read  

This will be an in-depth series on authentication with [AWS Amplify]. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. This is part 4 — a...

Learn to build mobile and web apps with AWS Amplify and Serverless Framework

October 02, 2018  3 minute read  

There has always been a bit of a problem between deploying your backend and then integrating that same backend with your front end code. The front end needs to know where the back end is located. The traditional approach is to create a configuration file for the purpose. But how? The AWS Mobile team created the awsmobile CLI and followed that with the AWS Amplify CLI. These tools are great for new projects. They provide for best practices deployment capabilities on the backend — and automati...

Authentication with AWS Amplify and Android: Facebook Login

October 01, 2018  8 minute read  

This will be an in-depth series on authentication with [AWS Amplify]. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. This is part 3 — a...

Authentication with AWS Amplify and Android: Customizing the UI

September 23, 2018  9 minute read  

This will be an in-depth series on authentication with AWS Amplify. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. This is part 2 - cus...

Authentication with AWS Amplify and Android: The Basics

September 18, 2018  11 minute read  

This will be an in-depth series on authentication with AWS Amplify. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. I’m not going to cov...

Let your analytics drive engagement: Endpoint profiles with AWS Amplify and Android

September 11, 2018  6 minute read  

In my last article, I showed the current best way of integrating analytics into your Android app using Kotlin. The events are only half the story for engagement. You need to be able to segment your users so that you can send them appropriate signals to draw them back to your app. That means understanding your users — where they are, whether they have authenticated (and how), and what they are interested in. Amazon Pinpoint and the AWS Mobile SDK for Android provides some demographic informat...

Integrate Analytics into your Android applications with AWS Amplify

September 04, 2018  5 minute read  

I’ve become a big fan of Kotlin development for my Android apps. I also think that analytics should be integrated into every single app I write. I’ve covered integrating Amazon Pinpoint before via AWS Mobile Hub. Recently, AWS Amplify announced an updated CLI that provides support for native applications and bypasses the need to use the AWS web console for creating resources. Naturally, I wanted to try it out. Integrating analytics is now really easy. Here is how I do it: Start Local You do...

Converting types with Room and Kotlin

August 08, 2018  5 minute read  

I’ve been working on a personal project, trying to get to grips with the various Android Architecture Components and Kotlin. One of the things I came up with was the requirement to deal with type conversion when using a SQLite database and the Room persistence library. Room is a nice abstraction to the internal SQLite database that converts models to tables within SQLite. It’s nice because it works alongside LiveData and RxJava to provide observable objects — when the database changes, the ob...

Implement Search-on-type in Android with RxJava

June 20, 2018  6 minute read  

I’m working on a new sample which, as is typical, communicates with a backend service for data through a serverless API. In this particular example, it’s a search capability that I am developing and one of the features I want to implement is “search while you type”. Not a problem, you might think. Just put a search box on the page (probably in the action bar), wire up the onTextChange event handler, and do the search. So, that’s what I did: override fun onCreateOptionsMenu(menu: Menu?): Boo...

Unit Testing in Android Studio with Kotlin

May 12, 2018  5 minute read  

I made myself a promise a couple of months ago. My next app would be fully unit tested for the non-UI components and fully instrument-tested for the UI components. That’s a tall order, especially since I’m using the latest and greatest Android Studio Canary. I ran into a few problems. Some can’t be solved and some can. Let’s start with a simple test. I’ve got a class that looks this: data class Note(val id: String = UUID.randomUUID().toString()) { var updated: Long = System.currentTimeMil...

Easy EditText content validation with Kotlin

April 11, 2018  3 minute read  

One of the things that I always deal with in my apps is the need to validate the input fields of a form. I can easily do this with this sample fragment of code (for example, for a length check): field.addTextChangeListener(object: TextWatcher { override fun afterTextChanged(s: Editable?) { val content = s?.text.toString() s?.error = if (content.length >= 6) null else "Minimum length = 6" } override fun beforeTextChanged(s: Editable?) { } override fun onTextChanged(s: Edita...

Using dependency injection with Kotlin

April 06, 2018  6 minute read  

In a recent post, I described how I can do app analytics by using the AWS Mobile SDK and an AWS Mobile Hub project. This is a great way to get usage analytics for your app, but it requires a tight coupling between the provider (the AWS Provider and AnalyticsClient) and the app. You need to initialize the provider early on (preferably in the Application wrapper or the first activity). That causes a tight linkage between the activities where it is used and the client object. This has several i...

Lessons in Kotlin: Toolbar Icons and Reflection

April 01, 2018  5 minute read  

There are many tutorials online on how to produce an Android app bar with an options menu — so much so that it can be boiled down to a few steps, and I’ll reproduce them here: Step 1: Create resources You actually need two resources. The first is a menu: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/mainActionCamera" an...

Lessons in Kotlin Threading: An Animated Splash Screen

March 29, 2018  2 minute read  

I find quite a lot of Android apps have splash screens. Some splash screens are for showing off the logo; others for hiding the extensive data load times. Whatever the reason, it’s a way for a little bit of creativity to shine through. My first effort My new app needs a splash screen. Splash screens aren’t hard until you need to do something that takes some time, and there are many tutorials on how to produce one out on the Internet. I’m going to focus on the one problem I had. Let’s take a...

Why I’m refactoring to Kotlin

March 21, 2018  5 minute read  

One of the things that is really cool about software development is that we are continually learning and adjusting. I spent a day recently learning Kotlin. I was so impressed with the language, I decided to refactor my entire Family Photos app. It did not take long. Why do I love Kotlin? I have to admit, I was skeptical at first. After all, I tried Swift for iOS as an alternate language and it felt foreign. Admittedly, Objective-C isn’t much better, but Swift definitely had some issues for ...

Back to top ↑

aspnetcore

Customizing Keycloak with Aspire - Part 3

October 04, 2024  6 minute read  

This is the last article in a trio of articles about incorporating Keycloak into .NET Aspire applications. Thus far, I’ve covered the basics and some common customizations. This part covers what you need to do if you want to store the identity information within a PostgreSQL database. I’ve chosen PostgreSQL for this because it seems to be the database of choice for Aspire when you want to run things locally and in the cloud and also because the PostgreSQL database driver is included by def...

Customizing Keycloak with Aspire - Part 2

September 30, 2024  4 minute read  

In my last article, I introduced the Keycloak identity service and showed how the development version can be easily integrated into a project. Development services get you started quickly and allow you to defer the details until later on. At some point, however, you need to take control of your service and start working towards production. There are a number of things that the development version of the Keycloak identity service doesn’t do that you need in production. These include SSL/TL...

Integrating Keycloak with Aspire - Part 1

September 26, 2024  8 minute read  

In my series on ASP.NET Identity, I mentioned (several times) that you should be using Keycloak, Auth0, Corbado, or another identity service instead of rolling your own. That’s all good, but I left it up to you to figure out exactly how to do that. I thought it would be a good idea to configure an Aspire project from the beginning and show how authentication and authorization with a service works. This article will be more of a “make the code work” type of article, with follow-on articles ...

ASP.NET Identity deep dive - Part 6 (Social logins)

September 20, 2024  11 minute read  

This article is one of a number of articles I will write over the coming month and will go into depth about the ASP.NET Identity system. My outline thus far: Project setup Account registration Signing in and out with a username and password Password reset Email confirmations Social logins Now that I have the basic flows sorted out (which includes username/password with registration, self-service password reset, and account lockout support), it’s time to turn my attention to o...

ASP.NET Identity deep dive - Part 5 (Sending email)

September 18, 2024  12 minute read  

This article is one of a number of articles I will write over the coming month and will go into depth about the ASP.NET Identity system. My outline thus far: Project setup Account registration Signing in and out with a username and password Password reset Email confirmations Social logins Today is the final spot for the basic flows. Up to this point, I’ve been logging links in places where I should be sending emails. Sending emails in development is scary. First, things co...

ASP.NET Identity deep dive - Part 4 (Password reset)

September 16, 2024  7 minute read  

This article is one of a number of articles I will write over the coming month and will go into depth about the ASP.NET Identity system. My outline thus far: Project setup Account registration Signing in and out with a username and password Password reset Email confirmations Social logins I’ve already implemented the registration and login/logout functionality. I’ve also done some updates since the last check in. Most notably, I’ve automatically signed the user in after regis...

ASP.NET Identity deep dive - Part 3 (Authentication)

September 14, 2024  6 minute read  

This article is one of a number of articles I will write over the coming month and will go into depth about the ASP.NET Identity system. My outline thus far: Project setup Account registration Signing in and out with a username and password Password reset Email confirmations Social logins Today, I’m tackling authentication - that is, signing in and out of an account using the web UI. You may remember from my last article that I set up the initial web UI to include a link to ...

ASP.NET Identity deep dive - Part 2 (Registration)

September 13, 2024  13 minute read  

This article is one of a number of articles I will write over the coming month and will go into depth about the ASP.NET Identity system. My outline thus far: Project setup Account registration Signing in and out with a username and password Password reset Email confirmations Social logins As you may remember from the last article, the first user journey I am going to implement is the registration journey. This is actually one of the more complex journeys with several parts t...

ASP.NET Identity deep dive - Part 1 (Project setup)

September 11, 2024  8 minute read  

You may have noticed that I included ASP.NET Identity in a project a couple of posts ago. I’m currently doing a deep dive into ASP.NET Identity with an eye towards an OIDC identity service based on OpenIddict. Identity is a complex topic and I still recommend that developers integrate another service rather than write their own: Keycloak is a good option if you have to store your own data, Auth0 is a good option when you just want a bunch of social providers, Corbado has support for...

.NET Aspire configuration patterns

September 09, 2024  10 minute read  

If you recall my last article, I transitioned my working application to .NET Aspire. This opinionated pattern allows me to run a complete microservice application within Docker Desktop, but then seamlessly deploy to Azure Container Apps and other platform services with the same code base. This is a great productivity boost for a developer. My current project builds an OIDC identity service that has both username/password (local) authentication and social logins like Google and Facebook. To ...

Local development for the cloud: Transitioning to .NET Aspire

September 05, 2024  13 minute read  

I’ve been working on a new project recently. It requires that I work with microservices and containers as it will eventually be runnable on either Kubernetes or (more likely) Azure Container Apps. My latest task is to get ASP.NET Identity working with PostgreSQL. In order to properly debug the code, I need the ASP.NET bits to be running locally. But to integrate with PostgreSQL, I need to set up containers and docker compose. This all feels like “too much work”. Wouldn’t it be amazing if...

Making ASP.NET Core applications readable - the options patterns

September 03, 2024  6 minute read  

Applications are read more often than they are written. The normal situation when a developer comes onto a project is that anything from a couple of weeks to several months is requried to come “up to speed” on the code base. Making the efforts required for readability of the code is important, and I spend a ton of time up front to ensure my applications are understandable without needing an in-depth lesson from me on how it works. Let’s take an application I am starting (today actually). I...

Building Bootstrap apps from SASS with ASP.NET Core

August 08, 2024  6 minute read  

I’m building a new web application with ASP.NET Core, and I’m using Visual Studio Code with the C# Dev Kit so that I can really dive deep into the benefits and problems of using VS Code as a Visual Studio replacement. A frontend project is a good one to start with since I can check out the ways that the solution is presented while still having all the goodness of the VS Code development experience for JavaScript and TypeScript. As part of the application, I wanted to build a lean Bootstrap C...

Organizing service injection in ASP.NET Core Minimal APIs

August 07, 2024  4 minute read  

For the longest time, the Controller was the only way to introduce an API into your application. With the latest versions of ASP.NET Core, Minimal APIs became available. These offered the potential to write less code and be more efficient since they didn’t carry the baggage of the controller with them. That does come with some drawbacks, however. For me, one of the main ones is that it is so much easier to write unreadable code. WIth some basic practices, however, you can use minimal APIs ...

Azure Active Directory Authentication for Blazor WASM (Part 4: SignalR)

September 23, 2022  3 minute read  

I really thought I was through with Azure Active Directory! Honest! However, another key piece came up. My CloudMud is a real-time pub/sub application that uses SignalR. How do I authenticate to the SignalR connection? Well, like most things, there is a recipe. So let’s get to it. The Server side of things Let’s take a look at the unauthenticated version first. I need to integrate SignalR into my app. Fortunately, there is a tutorial for that. I just followed it. This involved: ...

Azure Active Directory Authentication for Blazor WASM (Part 3: Production)

September 03, 2022  12 minute read  

Recently, I’ve been working on integrating authentication with Azure Active Directory into my Blazor app. I’ve covered the server side and the client side, so what’s left? Well, firstly, I left “secrets” in my client app in the form of an appsettings.json file. They aren’t exactly secret values, but having specific values in there means I can’t have different values for different environments. Similarly, I can’t change those values over time - I have to re-build the app in order to change...

Azure Active Directory Authentication for Blazor WASM (Part 2: The Client)

September 02, 2022  7 minute read  

I’m in the middle of adding authentication to my Blazor WASM app. In the last article, I introduced the service side of things to consider when integrating Azure Active Directory authentication. It’s now time to complete the work by considering the Blazor WASM client. As there was last time, this is [well documented], but comes with some wrinkles when you consider bringing authentication into an app later. I’ve got a Sign-in button called AuthButton.razor that looks like this: <button...

Azure Active Directory Authentication for Blazor WASM (Part 1: The Server)

September 01, 2022  8 minute read  

Continuing my foray into Blazor WASM, I decided to tackle authentication. The Microsoft documentation has an excellent article on how to do this using the built-in tooling to create an AAD-enabled Blazor WASM application. However, I’m beyond the tooling at this point. My Blazor app is created. I need to augment the solution with the right code to enable authentication. I also want to make sure that I am not leaking secrets and the same code will work from development, through staging, to...

Building Stylesheets for Blazor with SASS

August 26, 2022  8 minute read  

As I mentioned in my last article, I’m building a cloud-based MUD using all the modern techniques that I have available to me. One of the things I decided was that I was going to use an ASP.NET Core application hosting a single-page web application written in Blazor and I’m going to be running that inside a Docker image so I can deploy it onto Azure Container Apps. Scaffolding the app out is easy: $ mkdir cloudmud $ cd cloudmud $ dotnet new blazorwasm $ .\cloudmud.sln This opens up Visual...

Building repositories for Azure Mobile Apps with ASP.NET 6

November 12, 2021  7 minute read  

Over the last four days, I’ve delved into how to build a data sync service using Azure Mobile Apps on ASP.NET Core 6. I’ve covered the template, authentication, authorization, and logging. The basic setup is really good when you have a 1:1 relationship between the table and the DTO and you don’t need to do anything special, like support a non-EF Core ORM, or integrate real-time alerting. There are all sorts of reasons you don’t want to use the standard repository. So you get to write your...

Logging and Options for Azure Mobile Apps with ASP.NET 6

November 11, 2021  2 minute read  

Over the past three articles, I’ve covered a lot of the ins and outs of a typical Azure Mobile Apps service. I’ve covered scaffolding, authentication, and complex authorization. There are just a few more topics to cover on the basic cases. Logging One of the big areas is logging. You obviously want to see what the library is doing when it is running, especially because it is running unattended all the time. Fortunately, it’s an ASP.NET Core application, which means logging is built-in. ...

Controlled access for Azure Mobile Apps for ASP.NET Core

November 10, 2021  5 minute read  

In the last two articles, I’ve gone over how you can create a basic datasync service and add authentication to the service. What if you want to do something more complex? Authorization that is an on/off switch is reasonable as a first pass, but rarely allows you to handle the cases you actually need to implement. Introducing the Access Control Provider To handle cases where your needs are a little more complex, we’ve introduced a new interface: IAccessControlProvider<T>. This requi...

Add authentication to Azure Mobile Apps for ASP.NET Core

November 09, 2021  3 minute read  

In my last article, I introduced the new ASP.NET Core edition of Azure Mobile Apps, including how to set up Entity Framework Core and in-memory stores. Today, we are going to introduce simple authentication. What do you need to do to secure your entire API? We’ll cover more complex authentication schemes (such as protecting a single API, or doing DTO transforms based on the identity of the user) next time. Azure App Service Authentication Azure App Service includes a feature that most pe...

Introducing Azure Mobile Apps for ASP.NET 6

November 08, 2021  8 minute read  

It’s release day for .NET 6, and I couldn’t be happier to introduce Azure Mobile Apps for ASP.NET 6 being released on the same day. When I started developing the new code-base, I had several aims: Backwards compatibility with the older clients. Develop for ASP.NET 6 so I can develop anywhere - Windows, Mac, or Linux. Actually run anywhere - containers, App Service, or even a VM. Bring your own authentication provider and database provider. That meant some radical changes in the w...

Back to top ↑

graphql

Top Ten things to consider when taking your GraphQL service into production

November 07, 2022  9 minute read  

It’s a somewhat well-known facet of development that we don’t consider production problems until it is too late in the development cycle. When we look at taking a Web API into production, we use API management solutions to provide protection, control, and visibility into our APIs so that we ensure we don’t get woken up by a production outage. The things we need to consider are well understood in APIs in general, but what about GraphQL? GraphQL is a developers dream when it comes to tooling....

Build a GraphQL API on Azure API Management using Bicep

October 10, 2022  5 minute read  

When I build a service in the cloud, I describe the infrastructure as a blob of code. There are lots of solutions out there for this. Azure has the Azure Resource Manager (or ARM), which has it’s own JSON or YAML format, for example. Terraform is cross-cloud capable, as is the Serverless Framework. Since I mostly work in Azure, these days, I’be been working more and more with Bicep for my Infrastructure as Code standard. Bicep uses declarative syntax to deploy Azure resources (much like ...

Where do you start with GraphQL? I asked four engineers

February 06, 2019  6 minute read  

There has been a lot of discussion on GraphQL. In time, it may rank up there alongside REST as a defining protocol for client-server computing. It is at least trending that way right now. REST has got longevity going for it — years of top engineers thinking about the best ways to structure a REST-based API and thoughts on how to handle it. GraphQL hasn’t got the longevity. It does, however, have senior professional developers who constantly think about APIs and development in order to answer ...

The three ways to execute a GraphQL query from React with AWS AppSync (and how to choose)

January 15, 2019  5 minute read  

AWS AppSync is a managed GraphQL service that can (and probably should) act as the data layer for your app. I want to take a look at how you can send a query to AWS AppSync from your React (or React Native) app. You have three basic choices: Include a query within a component using AWS Amplify. Wrap your query in the Connect component using AWS Amplify. Use the Apollo Client with the AWS AppSync SDK. Which do you choose depends on what your needs are. There is no “one size fits all”...

Early return from GraphQL Resolvers with AWS AppSync

January 03, 2019  3 minute read  

I am currently developing a “reviews” app, written in React Native and using a suite of services surrounding AWS AppSync for the data backend. Yesterday, I ran into a problem. This is how I solved that problem. First, let’s take a look at the problem. I have a query that is submitted like this: { me { id name locations { totalCount } reviews { totalCount } favorites { totalCount } } } The query is used to generate a header on a “My Information” page. Eventually, I’l...

Handling File Uploads with AWS AppSync

December 18, 2018  9 minute read  

GraphQL does not handle files. It may seem an obvious statement, but it needs to be said. GraphQL does not handle files. It handles structured data. Which isn’t to say that GraphQL does not have a role to play within file handling — just that the upload and download of files needs to be done outside the confines of GraphQL. In this article, I’m going to present one way that you can handle the upload and download of files whereby the URL of the files are presented via GraphQL using AWS AppSy...

Backend GraphQL: How to trigger an AWS AppSync mutation from AWS Lambda

October 26, 2018  14 minute read  

This blog will explore a technique that opens up a whole new world of possibilities for notifying clients of results within a serverless application. Let’s say you have built a nice mobile and web versions of a chat application that uses a GraphQL API built on top of AWS AppSync. Users authenticate with Amazon Cognito user pools Users table is stored in DynamoDB Changes to the users table are communicated to the app via subscriptions How does the users table get updated? A naive a...

Build a GraphQL Service the easy way with AWS Amplify Model Transforms

August 29, 2018  8 minute read  

Creating a functional GraphQL API is hard. You have to create a GraphQL schema, decide on authentication and database structures, implement the schema in a GraphQL service, wire up the authentication, hook up the database sources, ensure the whole thing is scalable, worry about logging and monitoring, and then write your app. AWS AppSync helps you with everything except the GraphQL schema and the app. Now, AWS Amplify is helping you with the GraphQL schema by introducing model transforms. Th...

How to deploy a GraphQL API on AWS with the Serverless Framework

August 14, 2018  8 minute read  

In previous posts, we’ve explored how to deploy a GraphQL service based on AWS AppSync and Amazon DynamoDB using AWS CloudFormation. The articles reinforce how automatic and repeatable deployments are central to moving towards a DevOps mindset. However, there are a few problems with the AWS CloudFormation template. The most notable issue is the inability to separate the schema and resolver mapping templates from the actual CloudFormation template. Overcoming this obstacle requires developers...

Build a GraphQL Weather API with OpenWeatherMap and AWS AppSync

July 20, 2018  6 minute read  

I love GraphQL even for the small apps. Generating a simple API allows me to change out back end details without re-compiling my front end. It also allows me to rotate API keys easily, handle authentication, and get in depth monitoring of the individual fields being used. So, naturally, when I am building a new weather app (don’t judge — everyone makes one), I naturally want to use a weather API based on GraphQL. Except there isn’t one. So I created one using AWS AppSync — a managed offline ...

Build a Universal Search API with GraphQL and AWS AppSync

June 19, 2018  5 minute read  

Have you ever looked at a feature of a mobile app and wondered how they do something? Me too! I like to figure out how they built those features and build them into my own apps. Take, as an example, universal search. You can find this sort of search box at the top of the Facebook app. So, how do they implement it? I’ve not seen their codebase, but I imagine it’s something similar to the following proof of concept. The schema I have a GraphQL API already built within AWS AppSync with the fol...

How developers can authenticate and authorize users with AWS AppSync

June 01, 2018  7 minute read  

AWS AppSync provides four distinct methods of authorizing users to optimize and restrict data being transferred AWS AppSync is a managed GraphQL data service that supports offline and real-time scenarios. The service allows the developer to optimize the data transfer between client and server. Any non-trivial application will need to authenticate users. It’s the only way to identify a distinct real person using the application. That association is required for private data storage and c...

Back to top ↑

aws_amplify

What AWS service should you use to publish a web site?

January 31, 2019  4 minute read  

There are at least five different services you can use to publish a web site on AWS: Amazon S3 + Amazon Cloudfront AWS Amplify Console Amazon Lightsail AWS Elastic Beanstalk Do-it-yourself compute / storage / network stack Which one of these do you choose? Well, “it depends” is a great answer to this question, but I hope that this article will demystify the strengths of each choice and give you a roadmap to make a choice. This article is not designed for the person who knows a ...

Authentication with AWS Amplify and Android: Fraud Protection and Analytics

November 05, 2018  4 minute read  

This will be an in-depth series on authentication with AWS Amplify. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. Over the last seven ...

Authentication with AWS Amplify and Android: Integrating Biometrics

October 29, 2018  8 minute read  

This will be an in-depth series on authentication with [AWS Amplify]. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. This is the sevent...

Authentication with AWS Amplify and Android: Integrating TOTP

October 22, 2018  9 minute read  

This will be an in-depth series on authentication with [AWS Amplify]. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. Over the last five...

Authentication with AWS Amplify and Android: 3rd Party OIDC Providers

October 15, 2018  10 minute read  

This will be an in-depth series on authentication with [AWS Amplify]. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. In the last two ar...

Authentication with AWS Amplify and Android: Google Login

October 08, 2018  8 minute read  

This will be an in-depth series on authentication with [AWS Amplify]. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. This is part 4 — a...

Learn to build mobile and web apps with AWS Amplify and Serverless Framework

October 02, 2018  3 minute read  

There has always been a bit of a problem between deploying your backend and then integrating that same backend with your front end code. The front end needs to know where the back end is located. The traditional approach is to create a configuration file for the purpose. But how? The AWS Mobile team created the awsmobile CLI and followed that with the AWS Amplify CLI. These tools are great for new projects. They provide for best practices deployment capabilities on the backend — and automati...

Authentication with AWS Amplify and Android: Facebook Login

October 01, 2018  8 minute read  

This will be an in-depth series on authentication with [AWS Amplify]. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. This is part 3 — a...

Authentication with AWS Amplify and Android: Customizing the UI

September 23, 2018  9 minute read  

This will be an in-depth series on authentication with AWS Amplify. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. This is part 2 - cus...

Authentication with AWS Amplify and Android: The Basics

September 18, 2018  11 minute read  

This will be an in-depth series on authentication with AWS Amplify. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles. The basics - a username/password system. Customizing the UI. Authenticating with Facebook. Authenticating with Google. Using third-party authentication providers. Using Time-based One-time passwords (TOTP). Using Biometric authentication. Doing fraud protection and analytics. I’m not going to cov...

Let your analytics drive engagement: Endpoint profiles with AWS Amplify and Android

September 11, 2018  6 minute read  

In my last article, I showed the current best way of integrating analytics into your Android app using Kotlin. The events are only half the story for engagement. You need to be able to segment your users so that you can send them appropriate signals to draw them back to your app. That means understanding your users — where they are, whether they have authenticated (and how), and what they are interested in. Amazon Pinpoint and the AWS Mobile SDK for Android provides some demographic informat...

Integrate Analytics into your Android applications with AWS Amplify

September 04, 2018  5 minute read  

I’ve become a big fan of Kotlin development for my Android apps. I also think that analytics should be integrated into every single app I write. I’ve covered integrating Amazon Pinpoint before via AWS Mobile Hub. Recently, AWS Amplify announced an updated CLI that provides support for native applications and bypasses the need to use the AWS web console for creating resources. Naturally, I wanted to try it out. Integrating analytics is now really easy. Here is how I do it: Start Local You do...

Back to top ↑

typescript

The State of JavaScript Testing Frameworks 2024

August 03, 2024  11 minute read  

This week, I am adding a test framework to my ESM module template. I use a testing framework for both unit testing and integration testing. Like everything, test frameworks have evolved, and no test framework is suitable for all situations. However, it is one of those things you have to do if your project is destined to be long-lived. You should get into the habit of adding tests even if your project is not going to be long-lived. It’s a good habit. The words you want to look for are “tes...

Enforcing code style with eslint, prettier, and husky

July 22, 2024  14 minute read  

You may have noticed that I am developing a new project from my last couple of articles: TypeScript, ES Modules, and root-relative imports Building TypeScript projects with the swc compiler The project is a command line tool written in TypeScript. Today, I’m continuing my tooling story. How do I enforce code style within my TypeScript application? The go to tools in this area are eslint, prettier, and husky. I’ve already gotten a good chunk of help in ensuring quality code by usin...

Building TypeScript projects with the swc compiler

July 11, 2024  5 minute read  

In my last article, I set up a small project that I’m going to use for TypeScript development using ES modules that are “root-relative” - i.e. I don’t have to provide a relative path. I can use a path like #root/relative/path.js instead so that the code doesn’t change if I decide to move the source file I’m working on. I want to switch from importing “.js” files to importing “.ts” files. To do that, I need to set allowImportingTsExtensions. The tsc tool says I can’t do that unless I also ...

TypeScript, ES Modules, and root-relative imports

July 10, 2024  5 minute read  

As you might have gathered from my last article, I’m currently working in the TypeScript world. My experience with converting from CommonJS to ES Modules got me thinking - what is state of the art right now? So I delved in. I want to build a CLI tool using TypeScript and ES Modules but I want to use non-relative roots. What are non-relative roots? Well, if you want to import a module within your project with ES Modules, you might write something like this: import { something } from '../...

Converting a TypeScript project from CommonJS to ESM

July 06, 2024  6 minute read  

I haven’t made much progress on my own projects recently because of a project at work. Specifically, I am currently maintaining a CLI tool written in TypeScript about five years ago. It hasn’t really been looked after on a consistent basis, but some of the libraries that it uses (specifically, update-notifier and wait-on) have some security issues. Now, this is a development CLI tool, so the actual vulnerabilities don’t affect production code. Still, many people don’t like to use tools th...

Building an efficient Logger in TypeScript

June 30, 2019  6 minute read  

Just about every project needs a logging system. In the early days of development, you need to output data to the console so you aren’t setting breakpoints in your code all over the place (or you are running the code in the browser, where breakpoints are more difficult). Later on, you want logging to let you know where people are spending their time, or how much usage a particular feature gets. It also helps with diagnosing problems early so that you can get ahead of the issues. There are...

Run TypeScript Mocha Tests in Visual Studio Code

July 04, 2018  7 minute read  

I’m spending my July 4th getting back to basics and learning some data structures and algorithms. I’ve decided to do my stuff in TypeScript since it’s been a while since I’ve played with TypeScript and I wanted to see what has changed at the same time. This is not a blog post about how to do data structures and algorithms in TypeScript, JavaScript or any other language. If you are studying for an interview or classes, there are plenty of places on the Internet you can go to do that. Personal...

AsyncStorage, TypeScript, and Async/await in React Native

August 21, 2017  4 minute read  

In the last few posts, I’ve been working on a Notes app in a master-detail pattern for React Native using TypeScript. This is the last post about that project. So far, I’ve: Worked out how to handle orientation changes. Worked out how to implement swipe-to-delete. Figured out the best way to use TypeScript. Integrated MobX for the Flux pattern. Fixed up the project for universal iOS apps. Finally written the Master-Detail pattern. That’s a lot of stuff. This last post is about...

Building a Master-Detail Pattern in React Native

August 16, 2017  5 minute read  

I’m in the middle of writing a simple Notes app in React Native. Thus far, I’ve: Worked out how to handle orientation changes. Worked out how to implement swipe-to-delete. Figured out the best way to use TypeScript. Integrated MobX for the Flux pattern. Fixed up the project for universal iOS apps. Now it’s time to get to the master-detail pattern itself. Master-Detail is a basic pattern that incorporates a list (the master) and a detail page. On phones (and tablets in portrait m...

Integrating React Native, TypeScript, and MobX

August 11, 2017  5 minute read  

In my last article, I psted about getting TypeScript working with React Native. I’m building a flexible, best-practices, Notes App in React Native. This means I need a backing store, and it has to be local for offline capabilities. React has a definite way of building data into the UI and the manipulation of that data is an architecture known as Flux. Flux isn’t a concrete implementation, however. Normally, I would use Redux as the concrete implementation. However, I have recently started wor...

Debugging React Native with TypeScript and Visual Studio Code

August 09, 2017  2 minute read  

One of the things I really miss from React Native was the support for TypeScript. TypeScript helps me immensely, but it really comes into its own with React programming as the PropTypes are specified for you (no more propTypes static). I’m also getting into MobX as a flux implementation and that uses decorators, which is native in TypeScript. There is lots to love in TypeScript. However, every single guide I saw for implementing TypeScript within React Native was flawed. Specifically, there ...

Back to top ↑

react_native

Bootstrapping a React Native App: A Comparison

December 10, 2018  7 minute read  

It’s been a while since I have worked on a React Native app. In that time, create-react-native-app (CRNA) has been deprecated, and expo-cli has taken its place as the advised route. There is still react-native init, and Infinite Red has ignite. That is four different ways of bootstrapping a React Native app. Before I continue, let me be clear on what I want: I want to use “best practices” in my app architecture - for state, communication with my AWS-based backend, navigation, and so on. ...

Creating a React Native bridge library

January 19, 2018  7 minute read  

React Native is really good at straddling the line between native and JavaScript. There is a bridge between the two that allows you to call native code from JavaScript. This is awesome for including things that require a special touch. Most React Native developers will never need to worry about the bridge because libraries exist to wrap a lot of the common native libraries that you see in Android and iOS. But what if you want to create a bridge library of your own? That’s a whole other effor...

AsyncStorage, TypeScript, and Async/await in React Native

August 21, 2017  4 minute read  

In the last few posts, I’ve been working on a Notes app in a master-detail pattern for React Native using TypeScript. This is the last post about that project. So far, I’ve: Worked out how to handle orientation changes. Worked out how to implement swipe-to-delete. Figured out the best way to use TypeScript. Integrated MobX for the Flux pattern. Fixed up the project for universal iOS apps. Finally written the Master-Detail pattern. That’s a lot of stuff. This last post is about...

Building a Master-Detail Pattern in React Native

August 16, 2017  5 minute read  

I’m in the middle of writing a simple Notes app in React Native. Thus far, I’ve: Worked out how to handle orientation changes. Worked out how to implement swipe-to-delete. Figured out the best way to use TypeScript. Integrated MobX for the Flux pattern. Fixed up the project for universal iOS apps. Now it’s time to get to the master-detail pattern itself. Master-Detail is a basic pattern that incorporates a list (the master) and a detail page. On phones (and tablets in portrait m...

Universal iOS Apps with React Native

August 14, 2017  less than 1 minute read  

This is one of those short “tip” posts. I was developing a nice React Native app and blogging about it. However, I bumped into a problem where my iOS simulator runs always appeared as if they were on an iPhone. If I ran the app on an iPad, it would still act as if it were on an iPhone. The fix for this is buried inside XCode. Open XCode and then open the .xcodeproj file, which is inside the ios folder of your project. Then click on the project name. You will see a section like this: Note...

Integrating React Native, TypeScript, and MobX

August 11, 2017  5 minute read  

In my last article, I psted about getting TypeScript working with React Native. I’m building a flexible, best-practices, Notes App in React Native. This means I need a backing store, and it has to be local for offline capabilities. React has a definite way of building data into the UI and the manipulation of that data is an architecture known as Flux. Flux isn’t a concrete implementation, however. Normally, I would use Redux as the concrete implementation. However, I have recently started wor...

Debugging React Native with TypeScript and Visual Studio Code

August 09, 2017  2 minute read  

One of the things I really miss from React Native was the support for TypeScript. TypeScript helps me immensely, but it really comes into its own with React programming as the PropTypes are specified for you (no more propTypes static). I’m also getting into MobX as a flux implementation and that uses decorators, which is native in TypeScript. There is lots to love in TypeScript. However, every single guide I saw for implementing TypeScript within React Native was flawed. Specifically, there ...

Implementing swipe-right on a React Native FlatList

August 07, 2017  6 minute read  

I’m progressing on my “master-detail” pattern for a react-native app. The actual implementation of master-detail is shockingly simple (more on that later). However, I bumped into some specific issues when I was implementing it. The first of these was covered last time – how to detect orientation changes in React Native. The next is this. How do I implement swipe-right so that I can add a swipe-to-delete function to a FlatList. Let me explain a little further. The latest edition of React Nati...

Handling orientation changes in React Native

July 26, 2017  3 minute read  

I’ve just returned to my JavaScript days and am trying to learn React Native again. One of the things I like to do is to produce a “perfect” app – one that will work on both tablet and phone in any orientation and that includes all the best practices. Things like my Notes App on Android, for example, took me off to learn content providers. React Native is no different. There are a bunch of things you just have to know. One of the things I want to do is to produce a single app that does maste...

Which is better - React Native or Xamarin Forms?

May 25, 2017  5 minute read  

Let’s talk about a loaded question. After my recent forays into both React Native and Xamarin Forms, I got asked on Twitter – which is better, React Native or Xamarin Forms? Further, I should answer this for JavaScript experts, C# XAML experts and for developers with experience in both. After all, both produce native apps and both use a common codebase. The Short Version There isn’t a clear winner here. If I am a JavaScript expert, I’ll gravitate towards React Native. If I’m a C# exper...

Back to top ↑

javascript

Converting a TypeScript project from CommonJS to ESM

July 06, 2024  6 minute read  

I haven’t made much progress on my own projects recently because of a project at work. Specifically, I am currently maintaining a CLI tool written in TypeScript about five years ago. It hasn’t really been looked after on a consistent basis, but some of the libraries that it uses (specifically, update-notifier and wait-on) have some security issues. Now, this is a development CLI tool, so the actual vulnerabilities don’t affect production code. Still, many people don’t like to use tools th...

The State of React UI libraries in 2024

June 27, 2024  7 minute read  

As I mentioned in my last post, I’ve been away from React development for a while, and I’m intending on writing a web application. I’m comparing the various libraries that I can use for my application. In this post, I’m going to be comparing UI component libraries. Thus far, my tech stack is: Base web framework: React Frontend tooling: Vite Hosting: Azure Static Web Apps State management: Redux Toolkit React UI component libraries are collections of ready-to-use UI elements that...

The State of React state management in 2024

June 25, 2024  13 minute read  

I’ve been away from React development for a while. I stupidly asked what the best way to create a React app was in 2024 on the React subreddit, and found that reddit is not a friendly or welcoming community. For those wondering, there are three ways of creating a React app - Vite, Remix, and NextJS - but the community suggests Vite. Given the somewhat frosty reception I got on the React subreddit, I decided to do my own research across a number of topics for a new project - a social media c...

Deploy your React app to Azure

April 04, 2020  7 minute read  

I’ve got to the point with my template where I am thinking about deployment options. There is already a great option (the gh-pages module) for deploying to a github.io site. However, I am going to be running most of my services on Microsoft Azure. I want to deploy my service automatically and copy the web application to a web site on Azure. Just like AWS, you can deploy a website directly to Azure Storage. This is a great option if you just want cheap web hosting plus the option of consu...

Add unit testing to your React app

April 02, 2020  9 minute read  

Thus far, in my journey to produce a customized toolchain for my React development, I’ve covered a lot of ground. See part 1 and part 2 for that coverage. I’ve come to the point where I need to discuss testing, which is a complex area. First, there are at least four types of testing you need to do: Unit testing is something you should be running on a regular basis - a series of tests that test each component to ensure that the functionality is correct from the outside. Integration te...

Add visual testing to your React app with Storybook

March 31, 2020  7 minute read  

In my last article, I started a React app from scratch, then integrated Parcel as the bundler, TypeScript for language support, SASS, ESLint for linting the code, and Stylelint for linting the style sheets. I didn’t include any testing capabilities, so that is next on my agenda. Let’s write a simple component to get started with testing. The component takes an “isBusy” flag. If it is true, then one icon is displayed. If false, a different icon is displayed. I’ll use text nodes in this v...

Building a React app with Parcel, Typescript, SASS, and ESLint

March 29, 2020  9 minute read  

create-react-app (CRA) is great for getting started super-fast. It has just about everything you need for building all but the most demanding apps. It is, however, opinionated in how things get set up, and I’ve been chafing at the limitations for a while. You can’t alter the tsconfig.json except in some non-important ways. It uses webpack underneath, and that is unchangeable. It uses jest and testing-library. Changing this is a pain. There are even packages that rewire the CRA so...

Integrating Microsoft Login and MSAL with React and Redux

March 06, 2020  9 minute read  

I have a new app I am working on. It’s sort of a 1990’s style text MUD, but I’m bringing it “up to this century” with a host of new features. I’m writing the first front-end in React. So, what does a modern MUD app look like? Well, I’m not into storing usernames and password any more, so I’m going to use a Microsoft OAuth service instead of a user database. My front end application handles state through Redux. Configuring Redux I’ve got a store set up as follows: import { applyMiddlew...

The React Toolbox - 2018 Edition

March 23, 2018  5 minute read  

It’s been a while since I’ve been in web development. I’ve mostly been concentrating on mobile development instead. But this week I had cause to delve again. It’s amazing how much change there has been in the web world in just 2 years. React has become the force in web frameworks (Sorry Angular — I never liked you anyway) and developers are starting to coalesce around libraries and tools that make their life easier. I thought I’d put down my thoughts on the libraries that are making it into m...

Back to top ↑

aws_appsync

The three ways to execute a GraphQL query from React with AWS AppSync (and how to choose)

January 15, 2019  5 minute read  

AWS AppSync is a managed GraphQL service that can (and probably should) act as the data layer for your app. I want to take a look at how you can send a query to AWS AppSync from your React (or React Native) app. You have three basic choices: Include a query within a component using AWS Amplify. Wrap your query in the Connect component using AWS Amplify. Use the Apollo Client with the AWS AppSync SDK. Which do you choose depends on what your needs are. There is no “one size fits all”...

Early return from GraphQL Resolvers with AWS AppSync

January 03, 2019  3 minute read  

I am currently developing a “reviews” app, written in React Native and using a suite of services surrounding AWS AppSync for the data backend. Yesterday, I ran into a problem. This is how I solved that problem. First, let’s take a look at the problem. I have a query that is submitted like this: { me { id name locations { totalCount } reviews { totalCount } favorites { totalCount } } } The query is used to generate a header on a “My Information” page. Eventually, I’l...

Handling File Uploads with AWS AppSync

December 18, 2018  9 minute read  

GraphQL does not handle files. It may seem an obvious statement, but it needs to be said. GraphQL does not handle files. It handles structured data. Which isn’t to say that GraphQL does not have a role to play within file handling — just that the upload and download of files needs to be done outside the confines of GraphQL. In this article, I’m going to present one way that you can handle the upload and download of files whereby the URL of the files are presented via GraphQL using AWS AppSy...

Backend GraphQL: How to trigger an AWS AppSync mutation from AWS Lambda

October 26, 2018  14 minute read  

This blog will explore a technique that opens up a whole new world of possibilities for notifying clients of results within a serverless application. Let’s say you have built a nice mobile and web versions of a chat application that uses a GraphQL API built on top of AWS AppSync. Users authenticate with Amazon Cognito user pools Users table is stored in DynamoDB Changes to the users table are communicated to the app via subscriptions How does the users table get updated? A naive a...

Build a GraphQL Service the easy way with AWS Amplify Model Transforms

August 29, 2018  8 minute read  

Creating a functional GraphQL API is hard. You have to create a GraphQL schema, decide on authentication and database structures, implement the schema in a GraphQL service, wire up the authentication, hook up the database sources, ensure the whole thing is scalable, worry about logging and monitoring, and then write your app. AWS AppSync helps you with everything except the GraphQL schema and the app. Now, AWS Amplify is helping you with the GraphQL schema by introducing model transforms. Th...

How to deploy a GraphQL API on AWS with the Serverless Framework

August 14, 2018  8 minute read  

In previous posts, we’ve explored how to deploy a GraphQL service based on AWS AppSync and Amazon DynamoDB using AWS CloudFormation. The articles reinforce how automatic and repeatable deployments are central to moving towards a DevOps mindset. However, there are a few problems with the AWS CloudFormation template. The most notable issue is the inability to separate the schema and resolver mapping templates from the actual CloudFormation template. Overcoming this obstacle requires developers...

Build a GraphQL Weather API with OpenWeatherMap and AWS AppSync

July 20, 2018  6 minute read  

I love GraphQL even for the small apps. Generating a simple API allows me to change out back end details without re-compiling my front end. It also allows me to rotate API keys easily, handle authentication, and get in depth monitoring of the individual fields being used. So, naturally, when I am building a new weather app (don’t judge — everyone makes one), I naturally want to use a weather API based on GraphQL. Except there isn’t one. So I created one using AWS AppSync — a managed offline ...

Build a Universal Search API with GraphQL and AWS AppSync

June 19, 2018  5 minute read  

Have you ever looked at a feature of a mobile app and wondered how they do something? Me too! I like to figure out how they built those features and build them into my own apps. Take, as an example, universal search. You can find this sort of search box at the top of the Facebook app. So, how do they implement it? I’ve not seen their codebase, but I imagine it’s something similar to the following proof of concept. The schema I have a GraphQL API already built within AWS AppSync with the fol...

How developers can authenticate and authorize users with AWS AppSync

June 01, 2018  7 minute read  

AWS AppSync provides four distinct methods of authorizing users to optimize and restrict data being transferred AWS AppSync is a managed GraphQL data service that supports offline and real-time scenarios. The service allows the developer to optimize the data transfer between client and server. Any non-trivial application will need to authenticate users. It’s the only way to identify a distinct real person using the application. That association is required for private data storage and c...

Back to top ↑

azure_mobile_apps

Building repositories for Azure Mobile Apps with ASP.NET 6

November 12, 2021  7 minute read  

Over the last four days, I’ve delved into how to build a data sync service using Azure Mobile Apps on ASP.NET Core 6. I’ve covered the template, authentication, authorization, and logging. The basic setup is really good when you have a 1:1 relationship between the table and the DTO and you don’t need to do anything special, like support a non-EF Core ORM, or integrate real-time alerting. There are all sorts of reasons you don’t want to use the standard repository. So you get to write your...

Logging and Options for Azure Mobile Apps with ASP.NET 6

November 11, 2021  2 minute read  

Over the past three articles, I’ve covered a lot of the ins and outs of a typical Azure Mobile Apps service. I’ve covered scaffolding, authentication, and complex authorization. There are just a few more topics to cover on the basic cases. Logging One of the big areas is logging. You obviously want to see what the library is doing when it is running, especially because it is running unattended all the time. Fortunately, it’s an ASP.NET Core application, which means logging is built-in. ...

Controlled access for Azure Mobile Apps for ASP.NET Core

November 10, 2021  5 minute read  

In the last two articles, I’ve gone over how you can create a basic datasync service and add authentication to the service. What if you want to do something more complex? Authorization that is an on/off switch is reasonable as a first pass, but rarely allows you to handle the cases you actually need to implement. Introducing the Access Control Provider To handle cases where your needs are a little more complex, we’ve introduced a new interface: IAccessControlProvider<T>. This requi...

Add authentication to Azure Mobile Apps for ASP.NET Core

November 09, 2021  3 minute read  

In my last article, I introduced the new ASP.NET Core edition of Azure Mobile Apps, including how to set up Entity Framework Core and in-memory stores. Today, we are going to introduce simple authentication. What do you need to do to secure your entire API? We’ll cover more complex authentication schemes (such as protecting a single API, or doing DTO transforms based on the identity of the user) next time. Azure App Service Authentication Azure App Service includes a feature that most pe...

Introducing Azure Mobile Apps for ASP.NET 6

November 08, 2021  8 minute read  

It’s release day for .NET 6, and I couldn’t be happier to introduce Azure Mobile Apps for ASP.NET 6 being released on the same day. When I started developing the new code-base, I had several aims: Backwards compatibility with the older clients. Develop for ASP.NET 6 so I can develop anywhere - Windows, Mac, or Linux. Actually run anywhere - containers, App Service, or even a VM. Bring your own authentication provider and database provider. That meant some radical changes in the w...

Adding an API Key to Azure Mobile Apps with API Management

June 29, 2021  3 minute read  

I’ve written in the past that API keys are not security. They do not authenticate the app or user and they are easily interceptable (or extracted from distributed mobile apps). Despite that, that are good for a bunch of things, including figuring out which version of the app is being run, and ensuring that a certain version of the app you are running is using a specific backend or a specific set of policies. API keys are useful. I’m continually asked to support API keys. They are super-s...

Service Routing for Azure Mobile Apps with API Management

June 15, 2021  6 minute read  

Todays topic is “how do I upgrade the service backend to support the new ASP.NET Core service without affecting my current customers?” Let’s assume, for a moment, that I have already created an API Management service, and added caching to my API. Finally, I’ve adjusted the client application so everything is routing through the API Management service instead of direct to the backend. Azure Mobile Apps uses a header to indicate the version of the protocol that is in use. This head (ZUMO-AP...

Enabling caching for Azure Mobile Apps with API Management

June 11, 2021  7 minute read  

In my last article I introduced API Management and showed how it can be used to provide a front door to the REST API that is exposed by Azure Mobile Apps. What I implemented was a simple pass-through. It didn’t support authentication, and if a link was returned (for example, the “next-page” link in a query result),it pointed right back at the original source. It wasn’t much of an improvement. I’m going to change that today with a couple of improvements: Caching of read-only results. ...

Using API Management with Azure Mobile Apps

June 08, 2021  6 minute read  

Over the years, I’ve been asked for several features within Azure Mobile Apps that I’ve been reluctant to support out of the box. Azure Mobile Apps provides a toolkit in the context of the Node.js and ASP.NET Framework environments, so you can - theoretically - provide a lot of this functionality yourself. You can also use external services to provide that functionality. This is the start of a new series of blogs about Azure Mobile Apps, and my first foray into using Azure API Management t...

Back to top ↑

bicep

Build a Blog: Going to production with Azure Static Web Apps

June 08, 2024  4 minute read  

I’m almost ready to take my Static Web App to production and make it public. However, there are a few things that I want to make sure I do before going to production. This is true of any application hosted in the cloud, so it;s a good reminder of things to think about. This post is part of a sequence showing how to deploy a blog on Azure Static Web Apps: Deploying Azure Static Web Apps Configuring Azure DNS Configuring Static Web Apps Custom Domains Taking Static Web Apps to Pr...

Build a Blog: Custom domains for Azure Static Web Apps

June 07, 2024  8 minute read  

In my last post, I registered a DNS domain name and set up Azure DNS for it. I want my blog to use that domain name, so I need to set up a custom domain in Static Web Apps using Azure DNS. Of course, nothing is that simple. My blog uses repeatable deployments via Azure Developer CLI, so there is a little bit of extra work to do. This post is part of a sequence showing how to deploy a blog on Azure Static Web Apps: Deploying Azure Static Web Apps Configuring Azure DNS Configuring ...

Build a Blog: Set up DNS in Azure

June 06, 2024  4 minute read  

Today, I’m continuing on the job of setting up a new blog. I’ve now got three blog posts, so that’s enough for me to consider what I need to do for production. I don’t have a domain yet, so this post is all about setting up the domain. This post is part of a sequence showing how to deploy a blog on Azure Static Web Apps: Deploying Azure Static Web Apps Configuring Azure DNS Configuring Static Web Apps Custom Domains Taking Static Web Apps to Production Step 1: Pick a name Wh...

Build a Blog: Deploy Azure Infrastructure three ways

June 05, 2024  16 minute read  

For most developers, dealing with the infrastructure part of the job is hard. I like to say “give me a database and a web site” and prefer not to get into the other requirements like DNS, security, and multi-region reliability. My web sites and other cloud projects (including this one) are pretty open. So, what’s the minimum I need to know to deploy stuff on Azure? How can I get my project deployed on Azure for development with the minimum of hassle? This post is part of a sequence show...

Type-checking Bicep arrays and objects

November 28, 2022  3 minute read  

As you may have guessed by now, I’m delving heavily into the world of Bicep right now, mostly in order to describe the infrastructure for my personal projects in a readable way. JSON and YAML (used by ARM) is most definitely not readable for the average consumer. Part of that work was learning about bicep modules, which I love for modularizing my code. However, there is one distinctive problem with this. Let’s take an example to show off the problem. I have a bicep fragment that looks li...

Bicep, loops, and defaults

November 21, 2022  3 minute read  

I’ve been playing around a lot with bicep recently. I like it because it is much more readable than ARM templates and lets me modularize my deployments easily. Recently, I was writing a module for creating named values in Azure API Management. Here is my service.bicep: @description('The name of the API Management instance to deploy this API to.') param serviceName string = 'apim${uniqueString(resourceGroup().id)}' @description('Location for all resources') param location string = resourc...

Build a GraphQL API on Azure API Management using Bicep

October 10, 2022  5 minute read  

When I build a service in the cloud, I describe the infrastructure as a blob of code. There are lots of solutions out there for this. Azure has the Azure Resource Manager (or ARM), which has it’s own JSON or YAML format, for example. Terraform is cross-cloud capable, as is the Serverless Framework. Since I mostly work in Azure, these days, I’be been working more and more with Bicep for my Infrastructure as Code standard. Bicep uses declarative syntax to deploy Azure resources (much like ...

Back to top ↑

testing

The State of JavaScript Testing Frameworks 2024

August 03, 2024  11 minute read  

This week, I am adding a test framework to my ESM module template. I use a testing framework for both unit testing and integration testing. Like everything, test frameworks have evolved, and no test framework is suitable for all situations. However, it is one of those things you have to do if your project is destined to be long-lived. You should get into the habit of adding tests even if your project is not going to be long-lived. It’s a good habit. The words you want to look for are “tes...

Add unit testing to your React app

April 02, 2020  9 minute read  

Thus far, in my journey to produce a customized toolchain for my React development, I’ve covered a lot of ground. See part 1 and part 2 for that coverage. I’ve come to the point where I need to discuss testing, which is a complex area. First, there are at least four types of testing you need to do: Unit testing is something you should be running on a regular basis - a series of tests that test each component to ensure that the functionality is correct from the outside. Integration te...

Add visual testing to your React app with Storybook

March 31, 2020  7 minute read  

In my last article, I started a React app from scratch, then integrated Parcel as the bundler, TypeScript for language support, SASS, ESLint for linting the code, and Stylelint for linting the style sheets. I didn’t include any testing capabilities, so that is next on my agenda. Let’s write a simple component to get started with testing. The component takes an “isBusy” flag. If it is true, then one icon is displayed. If false, a different icon is displayed. I’ll use text nodes in this v...

Run TypeScript Mocha Tests in Visual Studio Code

July 04, 2018  7 minute read  

I’m spending my July 4th getting back to basics and learning some data structures and algorithms. I’ve decided to do my stuff in TypeScript since it’s been a while since I’ve played with TypeScript and I wanted to see what has changed at the same time. This is not a blog post about how to do data structures and algorithms in TypeScript, JavaScript or any other language. If you are studying for an interview or classes, there are plenty of places on the Internet you can go to do that. Personal...

Unit Testing in Android Studio with Kotlin

May 12, 2018  5 minute read  

I made myself a promise a couple of months ago. My next app would be fully unit tested for the non-UI components and fully instrument-tested for the UI components. That’s a tall order, especially since I’m using the latest and greatest Android Studio Canary. I ran into a few problems. Some can’t be solved and some can. Let’s start with a simple test. I’ve got a class that looks this: data class Note(val id: String = UUID.randomUUID().toString()) { var updated: Long = System.currentTimeMil...

Testing Mobile Apps: A Primer

March 11, 2018  10 minute read  

Why should you test your mobile app? A recent study showed that almost a quarter of users only use a mobile app once, and a shocking 95% abandon an app within the first month. Some of the reasons that users abandon an app are due to content and engagement. The biggest non-content reasons for abandonment are application crashes and security concerns. No one can prevent all application crashes. The mobile ecosystem is too broad and unpredictable to provide a 100% guarantee. However, testing ens...

Back to top ↑

react

The State of React UI libraries in 2024

June 27, 2024  7 minute read  

As I mentioned in my last post, I’ve been away from React development for a while, and I’m intending on writing a web application. I’m comparing the various libraries that I can use for my application. In this post, I’m going to be comparing UI component libraries. Thus far, my tech stack is: Base web framework: React Frontend tooling: Vite Hosting: Azure Static Web Apps State management: Redux Toolkit React UI component libraries are collections of ready-to-use UI elements that...

The State of React state management in 2024

June 25, 2024  13 minute read  

I’ve been away from React development for a while. I stupidly asked what the best way to create a React app was in 2024 on the React subreddit, and found that reddit is not a friendly or welcoming community. For those wondering, there are three ways of creating a React app - Vite, Remix, and NextJS - but the community suggests Vite. Given the somewhat frosty reception I got on the React subreddit, I decided to do my own research across a number of topics for a new project - a social media c...

Add visual testing to your React app with Storybook

March 31, 2020  7 minute read  

In my last article, I started a React app from scratch, then integrated Parcel as the bundler, TypeScript for language support, SASS, ESLint for linting the code, and Stylelint for linting the style sheets. I didn’t include any testing capabilities, so that is next on my agenda. Let’s write a simple component to get started with testing. The component takes an “isBusy” flag. If it is true, then one icon is displayed. If false, a different icon is displayed. I’ll use text nodes in this v...

Building a React app with Parcel, Typescript, SASS, and ESLint

March 29, 2020  9 minute read  

create-react-app (CRA) is great for getting started super-fast. It has just about everything you need for building all but the most demanding apps. It is, however, opinionated in how things get set up, and I’ve been chafing at the limitations for a while. You can’t alter the tsconfig.json except in some non-important ways. It uses webpack underneath, and that is unchangeable. It uses jest and testing-library. Changing this is a pain. There are even packages that rewire the CRA so...

Integrating Microsoft Login and MSAL with React and Redux

March 06, 2020  9 minute read  

I have a new app I am working on. It’s sort of a 1990’s style text MUD, but I’m bringing it “up to this century” with a host of new features. I’m writing the first front-end in React. So, what does a modern MUD app look like? Well, I’m not into storing usernames and password any more, so I’m going to use a Microsoft OAuth service instead of a user database. My front end application handles state through Redux. Configuring Redux I’ve got a store set up as follows: import { applyMiddlew...

The React Toolbox - 2018 Edition

March 23, 2018  5 minute read  

It’s been a while since I’ve been in web development. I’ve mostly been concentrating on mobile development instead. But this week I had cause to delve again. It’s amazing how much change there has been in the web world in just 2 years. React has become the force in web frameworks (Sorry Angular — I never liked you anyway) and developers are starting to coalesce around libraries and tools that make their life easier. I thought I’d put down my thoughts on the libraries that are making it into m...

Back to top ↑

comparison

The State of JavaScript Testing Frameworks 2024

August 03, 2024  11 minute read  

This week, I am adding a test framework to my ESM module template. I use a testing framework for both unit testing and integration testing. Like everything, test frameworks have evolved, and no test framework is suitable for all situations. However, it is one of those things you have to do if your project is destined to be long-lived. You should get into the habit of adding tests even if your project is not going to be long-lived. It’s a good habit. The words you want to look for are “tes...

The State of React UI libraries in 2024

June 27, 2024  7 minute read  

As I mentioned in my last post, I’ve been away from React development for a while, and I’m intending on writing a web application. I’m comparing the various libraries that I can use for my application. In this post, I’m going to be comparing UI component libraries. Thus far, my tech stack is: Base web framework: React Frontend tooling: Vite Hosting: Azure Static Web Apps State management: Redux Toolkit React UI component libraries are collections of ready-to-use UI elements that...

The State of React state management in 2024

June 25, 2024  13 minute read  

I’ve been away from React development for a while. I stupidly asked what the best way to create a React app was in 2024 on the React subreddit, and found that reddit is not a friendly or welcoming community. For those wondering, there are three ways of creating a React app - Vite, Remix, and NextJS - but the community suggests Vite. Given the somewhat frosty reception I got on the React subreddit, I decided to do my own research across a number of topics for a new project - a social media c...

Choosing a hosting option for your web app in Azure

March 10, 2021  6 minute read  

Azure, like all the other clouds, has a plethora of mechanisms for getting your web site published. You have Static Web Apps, Azure App Service, Azure Blob Storage, Web Apps for Containers, and then there are the compute ones like virtual machines, and Azure Functions. It can be a little overwhelming. For this analysis, I’m going to assume you want to deploy a stand alone web site - either straight HTML, CSS, and JavaScript or a React, Angular, Vue, or similar app. I’m going to break it d...

What AWS service should you use to publish a web site?

January 31, 2019  4 minute read  

There are at least five different services you can use to publish a web site on AWS: Amazon S3 + Amazon Cloudfront AWS Amplify Console Amazon Lightsail AWS Elastic Beanstalk Do-it-yourself compute / storage / network stack Which one of these do you choose? Well, “it depends” is a great answer to this question, but I hope that this article will demystify the strengths of each choice and give you a roadmap to make a choice. This article is not designed for the person who knows a ...

Bootstrapping a React Native App: A Comparison

December 10, 2018  7 minute read  

It’s been a while since I have worked on a React Native app. In that time, create-react-native-app (CRNA) has been deprecated, and expo-cli has taken its place as the advised route. There is still react-native init, and Infinite Red has ignite. That is four different ways of bootstrapping a React Native app. Before I continue, let me be clear on what I want: I want to use “best practices” in my app architecture - for state, communication with my AWS-based backend, navigation, and so on. ...

Back to top ↑

azure_active_directory

Create an App Registration for RBAC with PowerShell and Microsoft Graph.

January 19, 2024  5 minute read  

I’m currently working on some automation within Azure to deploy a hub-spoke web application. This web application authenticates with Entra ID using an App Registration and Role-Based Access Controls (RBAS) using App Roles. So, I need to create an app registration, enterprise app, and create the app roles. Seems easy, right? Get an access token Since this is part of a deployment, I’m going to assume the user has already connected to Azure using Connect-AzAccount and selected a subscriptio...

Azure Active Directory Authentication for Blazor WASM (Part 4: SignalR)

September 23, 2022  3 minute read  

I really thought I was through with Azure Active Directory! Honest! However, another key piece came up. My CloudMud is a real-time pub/sub application that uses SignalR. How do I authenticate to the SignalR connection? Well, like most things, there is a recipe. So let’s get to it. The Server side of things Let’s take a look at the unauthenticated version first. I need to integrate SignalR into my app. Fortunately, there is a tutorial for that. I just followed it. This involved: ...

Azure Active Directory Authentication for Blazor WASM (Part 3: Production)

September 03, 2022  12 minute read  

Recently, I’ve been working on integrating authentication with Azure Active Directory into my Blazor app. I’ve covered the server side and the client side, so what’s left? Well, firstly, I left “secrets” in my client app in the form of an appsettings.json file. They aren’t exactly secret values, but having specific values in there means I can’t have different values for different environments. Similarly, I can’t change those values over time - I have to re-build the app in order to change...

Azure Active Directory Authentication for Blazor WASM (Part 2: The Client)

September 02, 2022  7 minute read  

I’m in the middle of adding authentication to my Blazor WASM app. In the last article, I introduced the service side of things to consider when integrating Azure Active Directory authentication. It’s now time to complete the work by considering the Blazor WASM client. As there was last time, this is [well documented], but comes with some wrinkles when you consider bringing authentication into an app later. I’ve got a Sign-in button called AuthButton.razor that looks like this: <button...

Azure Active Directory Authentication for Blazor WASM (Part 1: The Server)

September 01, 2022  8 minute read  

Continuing my foray into Blazor WASM, I decided to tackle authentication. The Microsoft documentation has an excellent article on how to do this using the built-in tooling to create an AAD-enabled Blazor WASM application. However, I’m beyond the tooling at this point. My Blazor app is created. I need to augment the solution with the right code to enable authentication. I also want to make sure that I am not leaking secrets and the same code will work from development, through staging, to...

Integrating Microsoft Login and MSAL with React and Redux

March 06, 2020  9 minute read  

I have a new app I am working on. It’s sort of a 1990’s style text MUD, but I’m bringing it “up to this century” with a host of new features. I’m writing the first front-end in React. So, what does a modern MUD app look like? Well, I’m not into storing usernames and password any more, so I’m going to use a Microsoft OAuth service instead of a user database. My front end application handles state through Redux. Configuring Redux I’ve got a store set up as follows: import { applyMiddlew...

Back to top ↑

microsoft_entra

Create an App Registration for RBAC with PowerShell and Microsoft Graph.

January 19, 2024  5 minute read  

I’m currently working on some automation within Azure to deploy a hub-spoke web application. This web application authenticates with Entra ID using an App Registration and Role-Based Access Controls (RBAS) using App Roles. So, I need to create an app registration, enterprise app, and create the app roles. Seems easy, right? Get an access token Since this is part of a deployment, I’m going to assume the user has already connected to Azure using Connect-AzAccount and selected a subscriptio...

Azure Active Directory Authentication for Blazor WASM (Part 4: SignalR)

September 23, 2022  3 minute read  

I really thought I was through with Azure Active Directory! Honest! However, another key piece came up. My CloudMud is a real-time pub/sub application that uses SignalR. How do I authenticate to the SignalR connection? Well, like most things, there is a recipe. So let’s get to it. The Server side of things Let’s take a look at the unauthenticated version first. I need to integrate SignalR into my app. Fortunately, there is a tutorial for that. I just followed it. This involved: ...

Azure Active Directory Authentication for Blazor WASM (Part 3: Production)

September 03, 2022  12 minute read  

Recently, I’ve been working on integrating authentication with Azure Active Directory into my Blazor app. I’ve covered the server side and the client side, so what’s left? Well, firstly, I left “secrets” in my client app in the form of an appsettings.json file. They aren’t exactly secret values, but having specific values in there means I can’t have different values for different environments. Similarly, I can’t change those values over time - I have to re-build the app in order to change...

Azure Active Directory Authentication for Blazor WASM (Part 2: The Client)

September 02, 2022  7 minute read  

I’m in the middle of adding authentication to my Blazor WASM app. In the last article, I introduced the service side of things to consider when integrating Azure Active Directory authentication. It’s now time to complete the work by considering the Blazor WASM client. As there was last time, this is [well documented], but comes with some wrinkles when you consider bringing authentication into an app later. I’ve got a Sign-in button called AuthButton.razor that looks like this: <button...

Azure Active Directory Authentication for Blazor WASM (Part 1: The Server)

September 01, 2022  8 minute read  

Continuing my foray into Blazor WASM, I decided to tackle authentication. The Microsoft documentation has an excellent article on how to do this using the built-in tooling to create an AAD-enabled Blazor WASM application. However, I’m beyond the tooling at this point. My Blazor app is created. I need to augment the solution with the right code to enable authentication. I also want to make sure that I am not leaking secrets and the same code will work from development, through staging, to...

Integrating Microsoft Login and MSAL with React and Redux

March 06, 2020  9 minute read  

I have a new app I am working on. It’s sort of a 1990’s style text MUD, but I’m bringing it “up to this century” with a host of new features. I’m writing the first front-end in React. So, what does a modern MUD app look like? Well, I’m not into storing usernames and password any more, so I’m going to use a Microsoft OAuth service instead of a user database. My front end application handles state through Redux. Configuring Redux I’ve got a store set up as follows: import { applyMiddlew...

Back to top ↑

azure_apim

Bicep, loops, and defaults

November 21, 2022  3 minute read  

I’ve been playing around a lot with bicep recently. I like it because it is much more readable than ARM templates and lets me modularize my deployments easily. Recently, I was writing a module for creating named values in Azure API Management. Here is my service.bicep: @description('The name of the API Management instance to deploy this API to.') param serviceName string = 'apim${uniqueString(resourceGroup().id)}' @description('Location for all resources') param location string = resourc...

Build a GraphQL API on Azure API Management using Bicep

October 10, 2022  5 minute read  

When I build a service in the cloud, I describe the infrastructure as a blob of code. There are lots of solutions out there for this. Azure has the Azure Resource Manager (or ARM), which has it’s own JSON or YAML format, for example. Terraform is cross-cloud capable, as is the Serverless Framework. Since I mostly work in Azure, these days, I’be been working more and more with Bicep for my Infrastructure as Code standard. Bicep uses declarative syntax to deploy Azure resources (much like ...

Adding an API Key to Azure Mobile Apps with API Management

June 29, 2021  3 minute read  

I’ve written in the past that API keys are not security. They do not authenticate the app or user and they are easily interceptable (or extracted from distributed mobile apps). Despite that, that are good for a bunch of things, including figuring out which version of the app is being run, and ensuring that a certain version of the app you are running is using a specific backend or a specific set of policies. API keys are useful. I’m continually asked to support API keys. They are super-s...

Service Routing for Azure Mobile Apps with API Management

June 15, 2021  6 minute read  

Todays topic is “how do I upgrade the service backend to support the new ASP.NET Core service without affecting my current customers?” Let’s assume, for a moment, that I have already created an API Management service, and added caching to my API. Finally, I’ve adjusted the client application so everything is routing through the API Management service instead of direct to the backend. Azure Mobile Apps uses a header to indicate the version of the protocol that is in use. This head (ZUMO-AP...

Enabling caching for Azure Mobile Apps with API Management

June 11, 2021  7 minute read  

In my last article I introduced API Management and showed how it can be used to provide a front door to the REST API that is exposed by Azure Mobile Apps. What I implemented was a simple pass-through. It didn’t support authentication, and if a link was returned (for example, the “next-page” link in a query result),it pointed right back at the original source. It wasn’t much of an improvement. I’m going to change that today with a couple of improvements: Caching of read-only results. ...

Using API Management with Azure Mobile Apps

June 08, 2021  6 minute read  

Over the years, I’ve been asked for several features within Azure Mobile Apps that I’ve been reluctant to support out of the box. Azure Mobile Apps provides a toolkit in the context of the Node.js and ASP.NET Framework environments, so you can - theoretically - provide a lot of this functionality yourself. You can also use external services to provide that functionality. This is the start of a new series of blogs about Azure Mobile Apps, and my first foray into using Azure API Management t...

Back to top ↑

aspnet_identity

ASP.NET Identity deep dive - Part 6 (Social logins)

September 20, 2024  11 minute read  

This article is one of a number of articles I will write over the coming month and will go into depth about the ASP.NET Identity system. My outline thus far: Project setup Account registration Signing in and out with a username and password Password reset Email confirmations Social logins Now that I have the basic flows sorted out (which includes username/password with registration, self-service password reset, and account lockout support), it’s time to turn my attention to o...

ASP.NET Identity deep dive - Part 5 (Sending email)

September 18, 2024  12 minute read  

This article is one of a number of articles I will write over the coming month and will go into depth about the ASP.NET Identity system. My outline thus far: Project setup Account registration Signing in and out with a username and password Password reset Email confirmations Social logins Today is the final spot for the basic flows. Up to this point, I’ve been logging links in places where I should be sending emails. Sending emails in development is scary. First, things co...

ASP.NET Identity deep dive - Part 4 (Password reset)

September 16, 2024  7 minute read  

This article is one of a number of articles I will write over the coming month and will go into depth about the ASP.NET Identity system. My outline thus far: Project setup Account registration Signing in and out with a username and password Password reset Email confirmations Social logins I’ve already implemented the registration and login/logout functionality. I’ve also done some updates since the last check in. Most notably, I’ve automatically signed the user in after regis...

ASP.NET Identity deep dive - Part 3 (Authentication)

September 14, 2024  6 minute read  

This article is one of a number of articles I will write over the coming month and will go into depth about the ASP.NET Identity system. My outline thus far: Project setup Account registration Signing in and out with a username and password Password reset Email confirmations Social logins Today, I’m tackling authentication - that is, signing in and out of an account using the web UI. You may remember from my last article that I set up the initial web UI to include a link to ...

ASP.NET Identity deep dive - Part 2 (Registration)

September 13, 2024  13 minute read  

This article is one of a number of articles I will write over the coming month and will go into depth about the ASP.NET Identity system. My outline thus far: Project setup Account registration Signing in and out with a username and password Password reset Email confirmations Social logins As you may remember from the last article, the first user journey I am going to implement is the registration journey. This is actually one of the more complex journeys with several parts t...

ASP.NET Identity deep dive - Part 1 (Project setup)

September 11, 2024  8 minute read  

You may have noticed that I included ASP.NET Identity in a project a couple of posts ago. I’m currently doing a deep dive into ASP.NET Identity with an eye towards an OIDC identity service based on OpenIddict. Identity is a complex topic and I still recommend that developers integrate another service rather than write their own: Keycloak is a good option if you have to store your own data, Auth0 is a good option when you just want a bunch of social providers, Corbado has support for...

Back to top ↑

swift

Rounded corner panels and masks in SwiftUI

May 03, 2020  3 minute read  

I’ve been working on my UI developer skills recently (and I’ve done a few other posts about this as well). If you look at any of the recent design trends on Dribbble or UPLabs, you will see plenty of rounded corners. SwiftUI makes it simple to create rounded corners on all the corners - just add .cornerRadius(radius) as a modifier to the view. What happens when you only want a couple of corners rounded? For this, you need to dive into custom shapes and masks. Let’s set up a view to exper...

Handle location and geocoding with SwiftUI

November 05, 2019  5 minute read  

I’m continuing on my Weather app research in SwiftUI. My next problem is this: How do I get the current location (as a longitude / latitude) and a place (like a city) in my app such that the UI is updated when location updates happen? It turns out that this is a fairly easy problem, but it does come with some knowledge that you just have to know. Here is the list: How can I update the UI based on programmatic changes to the value? How can I listen for location updates? How can I c...

Create a bubble background in SwiftUI

November 02, 2019  3 minute read  

I’m continuing to explore SwiftUI, trying to recreate user interfaces that I see on design labs. The latest one is a task list app, found on Uplabs, and created by Rudi Hartano. I liked the design so I decided to replicate it from the Adobe XD file that he provided. One of the pieces he uses is a bubble background: The Adobe XD file shows me that I can use a linear gradient between two colors. However, there are also two slightly translucent circles on the top of it. If I were in Andr...

Why SwiftUI might just convert me to an iOS developer

October 31, 2019  9 minute read  

Confession time. I hated iOS development. First, there was Objective-C (which was a nightmare of epic proportions for cryptic syntax), then there was the Storyboards. Both of them forced you into using what is quite possibly the worst IDE on the market today (XCode), all so you could fit into the Apple ecosystem walled garden, where everything is controlled. Then Swift came along, so I took another look. I loved the direction that Swift was going, but Storyboards and the unintuitive IDE ...

The things I like (and don’t like) about Swift?

June 19, 2017  6 minute read  

Recently, I’ve given myself the task of learning the “native” mobile development platforms. That means Java or Kotlin for Android and Swift or Objective-C for iOS development. Kotlin is a ways behind Java for Android development and I already knew (somewhat) the Java language, so that one was relatively easy. Swift is the new kid on the block, but it’s obviously the way to go for iOS Development. This is not a blog post about how to learn Swift. In fact, I’m probably not going to teach y...

Back to top ↑

blazor

Azure Active Directory Authentication for Blazor WASM (Part 4: SignalR)

September 23, 2022  3 minute read  

I really thought I was through with Azure Active Directory! Honest! However, another key piece came up. My CloudMud is a real-time pub/sub application that uses SignalR. How do I authenticate to the SignalR connection? Well, like most things, there is a recipe. So let’s get to it. The Server side of things Let’s take a look at the unauthenticated version first. I need to integrate SignalR into my app. Fortunately, there is a tutorial for that. I just followed it. This involved: ...

Azure Active Directory Authentication for Blazor WASM (Part 3: Production)

September 03, 2022  12 minute read  

Recently, I’ve been working on integrating authentication with Azure Active Directory into my Blazor app. I’ve covered the server side and the client side, so what’s left? Well, firstly, I left “secrets” in my client app in the form of an appsettings.json file. They aren’t exactly secret values, but having specific values in there means I can’t have different values for different environments. Similarly, I can’t change those values over time - I have to re-build the app in order to change...

Azure Active Directory Authentication for Blazor WASM (Part 2: The Client)

September 02, 2022  7 minute read  

I’m in the middle of adding authentication to my Blazor WASM app. In the last article, I introduced the service side of things to consider when integrating Azure Active Directory authentication. It’s now time to complete the work by considering the Blazor WASM client. As there was last time, this is [well documented], but comes with some wrinkles when you consider bringing authentication into an app later. I’ve got a Sign-in button called AuthButton.razor that looks like this: <button...

Azure Active Directory Authentication for Blazor WASM (Part 1: The Server)

September 01, 2022  8 minute read  

Continuing my foray into Blazor WASM, I decided to tackle authentication. The Microsoft documentation has an excellent article on how to do this using the built-in tooling to create an AAD-enabled Blazor WASM application. However, I’m beyond the tooling at this point. My Blazor app is created. I need to augment the solution with the right code to enable authentication. I also want to make sure that I am not leaking secrets and the same code will work from development, through staging, to...

Building Stylesheets for Blazor with SASS

August 26, 2022  8 minute read  

As I mentioned in my last article, I’m building a cloud-based MUD using all the modern techniques that I have available to me. One of the things I decided was that I was going to use an ASP.NET Core application hosting a single-page web application written in Blazor and I’m going to be running that inside a Docker image so I can deploy it onto Azure Container Apps. Scaffolding the app out is easy: $ mkdir cloudmud $ cd cloudmud $ dotnet new blazorwasm $ .\cloudmud.sln This opens up Visual...

Back to top ↑

aspire

Customizing Keycloak with Aspire - Part 3

October 04, 2024  6 minute read  

This is the last article in a trio of articles about incorporating Keycloak into .NET Aspire applications. Thus far, I’ve covered the basics and some common customizations. This part covers what you need to do if you want to store the identity information within a PostgreSQL database. I’ve chosen PostgreSQL for this because it seems to be the database of choice for Aspire when you want to run things locally and in the cloud and also because the PostgreSQL database driver is included by def...

Customizing Keycloak with Aspire - Part 2

September 30, 2024  4 minute read  

In my last article, I introduced the Keycloak identity service and showed how the development version can be easily integrated into a project. Development services get you started quickly and allow you to defer the details until later on. At some point, however, you need to take control of your service and start working towards production. There are a number of things that the development version of the Keycloak identity service doesn’t do that you need in production. These include SSL/TL...

Integrating Keycloak with Aspire - Part 1

September 26, 2024  8 minute read  

In my series on ASP.NET Identity, I mentioned (several times) that you should be using Keycloak, Auth0, Corbado, or another identity service instead of rolling your own. That’s all good, but I left it up to you to figure out exactly how to do that. I thought it would be a good idea to configure an Aspire project from the beginning and show how authentication and authorization with a service works. This article will be more of a “make the code work” type of article, with follow-on articles ...

.NET Aspire configuration patterns

September 09, 2024  10 minute read  

If you recall my last article, I transitioned my working application to .NET Aspire. This opinionated pattern allows me to run a complete microservice application within Docker Desktop, but then seamlessly deploy to Azure Container Apps and other platform services with the same code base. This is a great productivity boost for a developer. My current project builds an OIDC identity service that has both username/password (local) authentication and social logins like Google and Facebook. To ...

Local development for the cloud: Transitioning to .NET Aspire

September 05, 2024  13 minute read  

I’ve been working on a new project recently. It requires that I work with microservices and containers as it will eventually be runnable on either Kubernetes or (more likely) Azure Container Apps. My latest task is to get ASP.NET Identity working with PostgreSQL. In order to properly debug the code, I need the ASP.NET bits to be running locally. But to integrate with PostgreSQL, I need to set up containers and docker compose. This all feels like “too much work”. Wouldn’t it be amazing if...

Back to top ↑

swiftui

Rounded corner panels and masks in SwiftUI

May 03, 2020  3 minute read  

I’ve been working on my UI developer skills recently (and I’ve done a few other posts about this as well). If you look at any of the recent design trends on Dribbble or UPLabs, you will see plenty of rounded corners. SwiftUI makes it simple to create rounded corners on all the corners - just add .cornerRadius(radius) as a modifier to the view. What happens when you only want a couple of corners rounded? For this, you need to dive into custom shapes and masks. Let’s set up a view to exper...

Handle location and geocoding with SwiftUI

November 05, 2019  5 minute read  

I’m continuing on my Weather app research in SwiftUI. My next problem is this: How do I get the current location (as a longitude / latitude) and a place (like a city) in my app such that the UI is updated when location updates happen? It turns out that this is a fairly easy problem, but it does come with some knowledge that you just have to know. Here is the list: How can I update the UI based on programmatic changes to the value? How can I listen for location updates? How can I c...

Create a bubble background in SwiftUI

November 02, 2019  3 minute read  

I’m continuing to explore SwiftUI, trying to recreate user interfaces that I see on design labs. The latest one is a task list app, found on Uplabs, and created by Rudi Hartano. I liked the design so I decided to replicate it from the Adobe XD file that he provided. One of the pieces he uses is a bubble background: The Adobe XD file shows me that I can use a linear gradient between two colors. However, there are also two slightly translucent circles on the top of it. If I were in Andr...

Why SwiftUI might just convert me to an iOS developer

October 31, 2019  9 minute read  

Confession time. I hated iOS development. First, there was Objective-C (which was a nightmare of epic proportions for cryptic syntax), then there was the Storyboards. Both of them forced you into using what is quite possibly the worst IDE on the market today (XCode), all so you could fit into the Apple ecosystem walled garden, where everything is controlled. Then Swift came along, so I took another look. I loved the direction that Swift was going, but Storyboards and the unintuitive IDE ...

Back to top ↑

azure_swa

Build a Blog: Going to production with Azure Static Web Apps

June 08, 2024  4 minute read  

I’m almost ready to take my Static Web App to production and make it public. However, there are a few things that I want to make sure I do before going to production. This is true of any application hosted in the cloud, so it;s a good reminder of things to think about. This post is part of a sequence showing how to deploy a blog on Azure Static Web Apps: Deploying Azure Static Web Apps Configuring Azure DNS Configuring Static Web Apps Custom Domains Taking Static Web Apps to Pr...

Build a Blog: Custom domains for Azure Static Web Apps

June 07, 2024  8 minute read  

In my last post, I registered a DNS domain name and set up Azure DNS for it. I want my blog to use that domain name, so I need to set up a custom domain in Static Web Apps using Azure DNS. Of course, nothing is that simple. My blog uses repeatable deployments via Azure Developer CLI, so there is a little bit of extra work to do. This post is part of a sequence showing how to deploy a blog on Azure Static Web Apps: Deploying Azure Static Web Apps Configuring Azure DNS Configuring ...

Build a Blog: Deploy Azure Infrastructure three ways

June 05, 2024  16 minute read  

For most developers, dealing with the infrastructure part of the job is hard. I like to say “give me a database and a web site” and prefer not to get into the other requirements like DNS, security, and multi-region reliability. My web sites and other cloud projects (including this one) are pretty open. So, what’s the minimum I need to know to deploy stuff on Azure? How can I get my project deployed on Azure for development with the minimum of hassle? This post is part of a sequence show...

Choosing a hosting option for your web app in Azure

March 10, 2021  6 minute read  

Azure, like all the other clouds, has a plethora of mechanisms for getting your web site published. You have Static Web Apps, Azure App Service, Azure Blob Storage, Web Apps for Containers, and then there are the compute ones like virtual machines, and Azure Functions. It can be a little overwhelming. For this analysis, I’m going to assume you want to deploy a stand alone web site - either straight HTML, CSS, and JavaScript or a React, Angular, Vue, or similar app. I’m going to break it d...

Back to top ↑

serverless

Learn to build mobile and web apps with AWS Amplify and Serverless Framework

October 02, 2018  3 minute read  

There has always been a bit of a problem between deploying your backend and then integrating that same backend with your front end code. The front end needs to know where the back end is located. The traditional approach is to create a configuration file for the purpose. But how? The AWS Mobile team created the awsmobile CLI and followed that with the AWS Amplify CLI. These tools are great for new projects. They provide for best practices deployment capabilities on the backend — and automati...

How to deploy a GraphQL API on AWS with the Serverless Framework

August 14, 2018  8 minute read  

In previous posts, we’ve explored how to deploy a GraphQL service based on AWS AppSync and Amazon DynamoDB using AWS CloudFormation. The articles reinforce how automatic and repeatable deployments are central to moving towards a DevOps mindset. However, there are a few problems with the AWS CloudFormation template. The most notable issue is the inability to separate the schema and resolver mapping templates from the actual CloudFormation template. Overcoming this obstacle requires developers...

Building a service in the Cloud

May 08, 2017  7 minute read  

I’ve been thinking about providing services in the cloud for a few years now. A common question I see time and time again is this: “What pieces of the cloud do I need to build my solution?” The answer is always “it depends.” This post is about those options. A service – whether it be a mobile backend, web server or public API – generally has different kinds of content. A web site, for example, will have images, stylesheets and other static content. However, that same web site may als...

Back to top ↑

xamarin

Bottom Bar Tabs for your Xamarin Forms app

May 15, 2021  3 minute read  

Following on from last weeks article, I am continuing on my UI journey for my contacts app. My app design calls for a bottom app bar, with three sections - contacts, groups, and profile. The contacts and groups will be lists, and the profile will be a detail page for your own details with an editor. To start, I created the three pages as ContentPage views, complete with XAML layout. For example, here is my ListContactsPage XAML file: <?xml version="1.0" encoding="utf-8" ?> <Cont...

Adding an icon font to your Xamarin Forms apps

May 09, 2021  5 minute read  

I’ve started building a new app using Xamarin Forms from scratch. The idea is that I have a list of contacts stored in the cloud. There isn’t anything revolutionary about that, but I’m going to allow sharing of specific lists with others. You could, for example, create a tag called “Cycling Buddies”, and then tag your friends with that. Everyone who subscribes to the same list gets the same information. Even better, you can “broadcast” your information to certain groups, allowing other p...

Which is better - React Native or Xamarin Forms?

May 25, 2017  5 minute read  

Let’s talk about a loaded question. After my recent forays into both React Native and Xamarin Forms, I got asked on Twitter – which is better, React Native or Xamarin Forms? Further, I should answer this for JavaScript experts, C# XAML experts and for developers with experience in both. After all, both produce native apps and both use a common codebase. The Short Version There isn’t a clear winner here. If I am a JavaScript expert, I’ll gravitate towards React Native. If I’m a C# exper...

Back to top ↑

azure

Deleting Azure resources the right way.

July 12, 2023  3 minute read  

If you are an Azure developer, you likely spin up an application, do some work, then shut it down again. However, shutting down resources and deleting them has an order to them. If your service is network isolated (in a virtual network), then you can’t delete the application until the private endpoints are shut down. Budgets don’t get deleted with the resource group. Diagnostic settings can’t be deleted if the resource no longer exists. There is an order you should do things: Private...

Purge Azure API Management soft-deleted services with ease.

January 20, 2023  4 minute read  

I work a lot with Azure API Management, which means I turn up and down services quite a few times a day. Azure API Management has an awesome feature that prevents you from accidentally deleting a service, called soft-delete. Instead of immediately deleting the service, it marks it as soft deleted and purges it later on. Unfortunately, that means that you can’t immediately reuse that service name. In production, this is a great thing to have. In development, it turns into a pain. That’s b...

Building a serverless MUD infrastructure in Azure

August 25, 2022  12 minute read  

If you went to college back in the 1980’s or 90’s and studied computer science, then it is likely you bumped into the MUD (multi-user dungeon) craze. Back then, computer science was different. The primary languages were the languages of the day - Pascal and C were big. We had access to UNIX systems and would write text-based multi-user games that users would telnet into to get access. We didn’t have the web back then. I learned a lot from writing a MUD - from parser design to network comm...

Back to top ↑

powershell

Create an App Registration for RBAC with PowerShell and Microsoft Graph.

January 19, 2024  5 minute read  

I’m currently working on some automation within Azure to deploy a hub-spoke web application. This web application authenticates with Entra ID using an App Registration and Role-Based Access Controls (RBAS) using App Roles. So, I need to create an app registration, enterprise app, and create the app roles. Seems easy, right? Get an access token Since this is part of a deployment, I’m going to assume the user has already connected to Azure using Connect-AzAccount and selected a subscriptio...

Deleting Azure resources the right way.

July 12, 2023  3 minute read  

If you are an Azure developer, you likely spin up an application, do some work, then shut it down again. However, shutting down resources and deleting them has an order to them. If your service is network isolated (in a virtual network), then you can’t delete the application until the private endpoints are shut down. Budgets don’t get deleted with the resource group. Diagnostic settings can’t be deleted if the resource no longer exists. There is an order you should do things: Private...

Purge Azure API Management soft-deleted services with ease.

January 20, 2023  4 minute read  

I work a lot with Azure API Management, which means I turn up and down services quite a few times a day. Azure API Management has an awesome feature that prevents you from accidentally deleting a service, called soft-delete. Instead of immediately deleting the service, it marks it as soft deleted and purges it later on. Unfortunately, that means that you can’t immediately reuse that service name. In production, this is a great thing to have. In development, it turns into a pain. That’s b...

Back to top ↑

azd

Build a Blog: Going to production with Azure Static Web Apps

June 08, 2024  4 minute read  

I’m almost ready to take my Static Web App to production and make it public. However, there are a few things that I want to make sure I do before going to production. This is true of any application hosted in the cloud, so it;s a good reminder of things to think about. This post is part of a sequence showing how to deploy a blog on Azure Static Web Apps: Deploying Azure Static Web Apps Configuring Azure DNS Configuring Static Web Apps Custom Domains Taking Static Web Apps to Pr...

Build a Blog: Custom domains for Azure Static Web Apps

June 07, 2024  8 minute read  

In my last post, I registered a DNS domain name and set up Azure DNS for it. I want my blog to use that domain name, so I need to set up a custom domain in Static Web Apps using Azure DNS. Of course, nothing is that simple. My blog uses repeatable deployments via Azure Developer CLI, so there is a little bit of extra work to do. This post is part of a sequence showing how to deploy a blog on Azure Static Web Apps: Deploying Azure Static Web Apps Configuring Azure DNS Configuring ...

Build a Blog: Deploy Azure Infrastructure three ways

June 05, 2024  16 minute read  

For most developers, dealing with the infrastructure part of the job is hard. I like to say “give me a database and a web site” and prefer not to get into the other requirements like DNS, security, and multi-region reliability. My web sites and other cloud projects (including this one) are pretty open. So, what’s the minimum I need to know to deploy stuff on Azure? How can I get my project deployed on Azure for development with the minimum of hassle? This post is part of a sequence show...

Back to top ↑

azure_dns

Build a Blog: Going to production with Azure Static Web Apps

June 08, 2024  4 minute read  

I’m almost ready to take my Static Web App to production and make it public. However, there are a few things that I want to make sure I do before going to production. This is true of any application hosted in the cloud, so it;s a good reminder of things to think about. This post is part of a sequence showing how to deploy a blog on Azure Static Web Apps: Deploying Azure Static Web Apps Configuring Azure DNS Configuring Static Web Apps Custom Domains Taking Static Web Apps to Pr...

Build a Blog: Custom domains for Azure Static Web Apps

June 07, 2024  8 minute read  

In my last post, I registered a DNS domain name and set up Azure DNS for it. I want my blog to use that domain name, so I need to set up a custom domain in Static Web Apps using Azure DNS. Of course, nothing is that simple. My blog uses repeatable deployments via Azure Developer CLI, so there is a little bit of extra work to do. This post is part of a sequence showing how to deploy a blog on Azure Static Web Apps: Deploying Azure Static Web Apps Configuring Azure DNS Configuring ...

Build a Blog: Set up DNS in Azure

June 06, 2024  4 minute read  

Today, I’m continuing on the job of setting up a new blog. I’ve now got three blog posts, so that’s enough for me to consider what I need to do for production. I don’t have a domain yet, so this post is all about setting up the domain. This post is part of a sequence showing how to deploy a blog on Azure Static Web Apps: Deploying Azure Static Web Apps Configuring Azure DNS Configuring Static Web Apps Custom Domains Taking Static Web Apps to Production Step 1: Pick a name Wh...

Back to top ↑

csharp

Making ASP.NET Core applications readable - the options patterns

September 03, 2024  6 minute read  

Applications are read more often than they are written. The normal situation when a developer comes onto a project is that anything from a couple of weeks to several months is requried to come “up to speed” on the code base. Making the efforts required for readability of the code is important, and I spend a ton of time up front to ensure my applications are understandable without needing an in-depth lesson from me on how it works. Let’s take an application I am starting (today actually). I...

Centrally managing dependencies in your C# solutions

August 15, 2024  3 minute read  

Today, I’d like to talk about the best way to centrally manage dependencies in your dotNET solutions. It’s common for a single solution to comprise multiple projects. The happy path for maintaining dependencies in Visual Studio involves right-clicking on the project and selecting “Manage NuGet packages…”. Once you have a set of packages, you can keep them in sync by right-clicking on the solution and doing the same thing. By using “Manage NuGet packages” for the solution, you can update m...

Better data validation exceptions with C#

August 10, 2024  6 minute read  

There are times when I look at code I have written and think to myself “there has to be a better way.” When I start thinking like this, I start by looking at the documentation - the .NET official documentation is incredibly well written and simple to digest, and the fundamentals section is something I believe every language documentation should aspire to. Take exceptions, for example. When I started my career in software development, methods were written with a block of validations at the ...

Back to top ↑

keycloak

Customizing Keycloak with Aspire - Part 3

October 04, 2024  6 minute read  

This is the last article in a trio of articles about incorporating Keycloak into .NET Aspire applications. Thus far, I’ve covered the basics and some common customizations. This part covers what you need to do if you want to store the identity information within a PostgreSQL database. I’ve chosen PostgreSQL for this because it seems to be the database of choice for Aspire when you want to run things locally and in the cloud and also because the PostgreSQL database driver is included by def...

Customizing Keycloak with Aspire - Part 2

September 30, 2024  4 minute read  

In my last article, I introduced the Keycloak identity service and showed how the development version can be easily integrated into a project. Development services get you started quickly and allow you to defer the details until later on. At some point, however, you need to take control of your service and start working towards production. There are a number of things that the development version of the Keycloak identity service doesn’t do that you need in production. These include SSL/TL...

Integrating Keycloak with Aspire - Part 1

September 26, 2024  8 minute read  

In my series on ASP.NET Identity, I mentioned (several times) that you should be using Keycloak, Auth0, Corbado, or another identity service instead of rolling your own. That’s all good, but I left it up to you to figure out exactly how to do that. I thought it would be a good idea to configure an Aspire project from the beginning and show how authentication and authorization with a service works. This article will be more of a “make the code work” type of article, with follow-on articles ...

Back to top ↑

azure_appconfig

.NET Aspire configuration patterns

September 09, 2024  10 minute read  

If you recall my last article, I transitioned my working application to .NET Aspire. This opinionated pattern allows me to run a complete microservice application within Docker Desktop, but then seamlessly deploy to Azure Container Apps and other platform services with the same code base. This is a great productivity boost for a developer. My current project builds an OIDC identity service that has both username/password (local) authentication and social logins like Google and Facebook. To ...

Using Azure App Configuration for Remote Config with Android

September 22, 2019  11 minute read  

I’ve been playing with a new app recently. I decided I needed some support from the cloud around feature flags (turning on and off features for specific people so I can test things) and for remote configuration. Fortunately, Azure has a service in preview - App Configuration - and it does both of these things. There are preview libraries to go along with it for .NET, Java 8, JavaScript, and Python. Sadly, there is no library for Android Java. Fortunately, we can fix that! Let’s take a l...

Back to top ↑

azure_functions

Reducing the deployment size of your JavaScript Azure Functions

January 12, 2020  1 minute read  

I’m doing some Azure Functions development in JavaScript at the moment, using the new azure-functions-core-tools. One of the features it has is command line publication, like this: $ func azure functionapp publish my-function-app I have a single function right now (called ping). Running the publish step creates a ZIP file: $ npx func azure functionapp publish my-function-app Getting site publishing info... Creating archive for current directory... Uploading 187.62 MB [##--...

Deploying an Azure Function App with Terraform

October 23, 2019  7 minute read  

You may have caught this from my previous blog posts, but I like automated deployments. I like something where I can run one command and magic happens, resulting in my whole deployment changing to a new state. I’ve recently been looking around at options for Azure, checking out Serverless Framework, Azure Resource Manager (ARM), and others. My favorite thus far has been Terraform. These are the instructions for deploying a basic Azure Function app with TypeScript code from start to finish...

Back to top ↑

terraform

Deploy your React app to Azure

April 04, 2020  7 minute read  

I’ve got to the point with my template where I am thinking about deployment options. There is already a great option (the gh-pages module) for deploying to a github.io site. However, I am going to be running most of my services on Microsoft Azure. I want to deploy my service automatically and copy the web application to a web site on Azure. Just like AWS, you can deploy a website directly to Azure Storage. This is a great option if you just want cheap web hosting plus the option of consu...

Deploying an Azure Function App with Terraform

October 23, 2019  7 minute read  

You may have caught this from my previous blog posts, but I like automated deployments. I like something where I can run one command and magic happens, resulting in my whole deployment changing to a new state. I’ve recently been looking around at options for Azure, checking out Serverless Framework, Azure Resource Manager (ARM), and others. My favorite thus far has been Terraform. These are the instructions for deploying a basic Azure Function app with TypeScript code from start to finish...

Back to top ↑

azure_storage

Choosing a hosting option for your web app in Azure

March 10, 2021  6 minute read  

Azure, like all the other clouds, has a plethora of mechanisms for getting your web site published. You have Static Web Apps, Azure App Service, Azure Blob Storage, Web Apps for Containers, and then there are the compute ones like virtual machines, and Azure Functions. It can be a little overwhelming. For this analysis, I’m going to assume you want to deploy a stand alone web site - either straight HTML, CSS, and JavaScript or a React, Angular, Vue, or similar app. I’m going to break it d...

Deploy your React app to Azure

April 04, 2020  7 minute read  

I’ve got to the point with my template where I am thinking about deployment options. There is already a great option (the gh-pages module) for deploying to a github.io site. However, I am going to be running most of my services on Microsoft Azure. I want to deploy my service automatically and copy the web application to a web site on Azure. Just like AWS, you can deploy a website directly to Azure Storage. This is a great option if you just want cheap web hosting plus the option of consu...

Back to top ↑

xamarin_forms

Bottom Bar Tabs for your Xamarin Forms app

May 15, 2021  3 minute read  

Following on from last weeks article, I am continuing on my UI journey for my contacts app. My app design calls for a bottom app bar, with three sections - contacts, groups, and profile. The contacts and groups will be lists, and the profile will be a detail page for your own details with an editor. To start, I created the three pages as ContentPage views, complete with XAML layout. For example, here is my ListContactsPage XAML file: <?xml version="1.0" encoding="utf-8" ?> <Cont...

Adding an icon font to your Xamarin Forms apps

May 09, 2021  5 minute read  

I’ve started building a new app using Xamarin Forms from scratch. The idea is that I have a list of contacts stored in the cloud. There isn’t anything revolutionary about that, but I’m going to allow sharing of specific lists with others. You could, for example, create a tag called “Cycling Buddies”, and then tag your friends with that. Everyone who subscribes to the same list gets the same information. Even better, you can “broadcast” your information to certain groups, allowing other p...

Back to top ↑

scss

Building Bootstrap apps from SASS with ASP.NET Core

August 08, 2024  6 minute read  

I’m building a new web application with ASP.NET Core, and I’m using Visual Studio Code with the C# Dev Kit so that I can really dive deep into the benefits and problems of using VS Code as a Visual Studio replacement. A frontend project is a good one to start with since I can check out the ways that the solution is presented while still having all the goodness of the VS Code development experience for JavaScript and TypeScript. As part of the application, I wanted to build a lean Bootstrap C...

Building Stylesheets for Blazor with SASS

August 26, 2022  8 minute read  

As I mentioned in my last article, I’m building a cloud-based MUD using all the modern techniques that I have available to me. One of the things I decided was that I was going to use an ASP.NET Core application hosting a single-page web application written in Blazor and I’m going to be running that inside a Docker image so I can deploy it onto Azure Container Apps. Scaffolding the app out is easy: $ mkdir cloudmud $ cd cloudmud $ dotnet new blazorwasm $ .\cloudmud.sln This opens up Visual...

Back to top ↑

comparisons

Which is better - React Native or Xamarin Forms?

May 25, 2017  5 minute read  

Let’s talk about a loaded question. After my recent forays into both React Native and Xamarin Forms, I got asked on Twitter – which is better, React Native or Xamarin Forms? Further, I should answer this for JavaScript experts, C# XAML experts and for developers with experience in both. After all, both produce native apps and both use a common codebase. The Short Version There isn’t a clear winner here. If I am a JavaScript expert, I’ll gravitate towards React Native. If I’m a C# exper...

Back to top ↑

debugging

Debugging React Native with TypeScript and Visual Studio Code

August 09, 2017  2 minute read  

One of the things I really miss from React Native was the support for TypeScript. TypeScript helps me immensely, but it really comes into its own with React programming as the PropTypes are specified for you (no more propTypes static). I’m also getting into MobX as a flux implementation and that uses decorators, which is native in TypeScript. There is lots to love in TypeScript. However, every single guide I saw for implementing TypeScript within React Native was flawed. Specifically, there ...

Back to top ↑

async_programming

AsyncStorage, TypeScript, and Async/await in React Native

August 21, 2017  4 minute read  

In the last few posts, I’ve been working on a Notes app in a master-detail pattern for React Native using TypeScript. This is the last post about that project. So far, I’ve: Worked out how to handle orientation changes. Worked out how to implement swipe-to-delete. Figured out the best way to use TypeScript. Integrated MobX for the Flux pattern. Fixed up the project for universal iOS apps. Finally written the Master-Detail pattern. That’s a lot of stuff. This last post is about...

Back to top ↑

documentation

Documenting open-source projects

February 12, 2019  6 minute read  

Over the last 25 years, I’ve contributed to and written a lot of technical documentation, whether it is in the form of official documentation, blogs, tutorials, or books. Tech writers, who have nothing but access to engineers to work with, turn conversations into a guide that is equally suitable for a complete beginner and an expert. If you are an engineer, you definitely need to institute a “Tech Writer Appreciation Day”. That being said, learning research is rooted in psychology. The way w...

Back to top ↑

flutter

Pre-build steps for Flutter using Visual Studio Code

February 20, 2020  2 minute read  

Flutter is not a build system. I know, it’s a terrible way to start, but you have to accept that you need to produce a build system for Flutter. There are build systems written in Dart (such as this one), and I’m sure this situation will get better, but right now? There isn’t a good build system. So I use the node package manager. Here is my basic flow: Run npm init -y. Edit the produced package.json file to use flutter under the covers. Run flutter with npm start instead of the ...

Back to top ↑

vscode

Pre-build steps for Flutter using Visual Studio Code

February 20, 2020  2 minute read  

Flutter is not a build system. I know, it’s a terrible way to start, but you have to accept that you need to produce a build system for Flutter. There are build systems written in Dart (such as this one), and I’m sure this situation will get better, but right now? There isn’t a good build system. So I use the node package manager. Here is my basic flow: Run npm init -y. Edit the produced package.json file to use flutter under the covers. Run flutter with npm start instead of the ...

Back to top ↑

azure_appservice

Choosing a hosting option for your web app in Azure

March 10, 2021  6 minute read  

Azure, like all the other clouds, has a plethora of mechanisms for getting your web site published. You have Static Web Apps, Azure App Service, Azure Blob Storage, Web Apps for Containers, and then there are the compute ones like virtual machines, and Azure Functions. It can be a little overwhelming. For this analysis, I’m going to assume you want to deploy a stand alone web site - either straight HTML, CSS, and JavaScript or a React, Angular, Vue, or similar app. I’m going to break it d...

Back to top ↑

signalr

Azure Active Directory Authentication for Blazor WASM (Part 4: SignalR)

September 23, 2022  3 minute read  

I really thought I was through with Azure Active Directory! Honest! However, another key piece came up. My CloudMud is a real-time pub/sub application that uses SignalR. How do I authenticate to the SignalR connection? Well, like most things, there is a recipe. So let’s get to it. The Server side of things Let’s take a look at the unauthenticated version first. I need to integrate SignalR into my app. Fortunately, there is a tutorial for that. I just followed it. This involved: ...

Back to top ↑

msgraph

Create an App Registration for RBAC with PowerShell and Microsoft Graph.

January 19, 2024  5 minute read  

I’m currently working on some automation within Azure to deploy a hub-spoke web application. This web application authenticates with Entra ID using an App Registration and Role-Based Access Controls (RBAS) using App Roles. So, I need to create an app registration, enterprise app, and create the app roles. Seems easy, right? Get an access token Since this is part of a deployment, I’m going to assume the user has already connected to Azure using Connect-AzAccount and selected a subscriptio...

Back to top ↑

containers

Dev containers are a developers best friend

June 04, 2024  6 minute read  

If you’ve ever had to rebuild or significantly upgrade your machine in the middle of a project, then you will recognize the pain. You find that some versions of your favorite tools have changed, or you don’t remember the specific build command or tool download location for that one thing you rely on. Dev containers was designed with this in mind. It’s the technology behind Codespaces and supported in Visual Studio Code. In this tutorial, I’ll walk through the steps to create your own dev ...

Back to top ↑

jekyll

Dev containers are a developers best friend

June 04, 2024  6 minute read  

If you’ve ever had to rebuild or significantly upgrade your machine in the middle of a project, then you will recognize the pain. You find that some versions of your favorite tools have changed, or you don’t remember the specific build command or tool download location for that one thing you rely on. Dev containers was designed with this in mind. It’s the technology behind Codespaces and supported in Visual Studio Code. In this tutorial, I’ll walk through the steps to create your own dev ...

Back to top ↑

minimal_apis

Organizing service injection in ASP.NET Core Minimal APIs

August 07, 2024  4 minute read  

For the longest time, the Controller was the only way to introduce an API into your application. With the latest versions of ASP.NET Core, Minimal APIs became available. These offered the potential to write less code and be more efficient since they didn’t carry the baggage of the controller with them. That does come with some drawbacks, however. For me, one of the main ones is that it is so much easier to write unreadable code. WIth some basic practices, however, you can use minimal APIs ...

Back to top ↑

bootstrap

Building Bootstrap apps from SASS with ASP.NET Core

August 08, 2024  6 minute read  

I’m building a new web application with ASP.NET Core, and I’m using Visual Studio Code with the C# Dev Kit so that I can really dive deep into the benefits and problems of using VS Code as a Visual Studio replacement. A frontend project is a good one to start with since I can check out the ways that the solution is presented while still having all the goodness of the VS Code development experience for JavaScript and TypeScript. As part of the application, I wanted to build a lean Bootstrap C...

Back to top ↑

data_validation

Better data validation exceptions with C#

August 10, 2024  6 minute read  

There are times when I look at code I have written and think to myself “there has to be a better way.” When I start thinking like this, I start by looking at the documentation - the .NET official documentation is incredibly well written and simple to digest, and the fundamentals section is something I believe every language documentation should aspire to. Take exceptions, for example. When I started my career in software development, methods were written with a block of validations at the ...

Back to top ↑

dependencies

Centrally managing dependencies in your C# solutions

August 15, 2024  3 minute read  

Today, I’d like to talk about the best way to centrally manage dependencies in your dotNET solutions. It’s common for a single solution to comprise multiple projects. The happy path for maintaining dependencies in Visual Studio involves right-clicking on the project and selecting “Manage NuGet packages…”. Once you have a set of packages, you can keep them in sync by right-clicking on the solution and doing the same thing. By using “Manage NuGet packages” for the solution, you can update m...

Back to top ↑

azure_keyvault

.NET Aspire configuration patterns

September 09, 2024  10 minute read  

If you recall my last article, I transitioned my working application to .NET Aspire. This opinionated pattern allows me to run a complete microservice application within Docker Desktop, but then seamlessly deploy to Azure Container Apps and other platform services with the same code base. This is a great productivity boost for a developer. My current project builds an OIDC identity service that has both username/password (local) authentication and social logins like Google and Facebook. To ...

Back to top ↑