Weekly Update No. 2

Researching serverless architecure options for a low cost (free) blog

Published on August 4, 2019

This past week I was digging into Firebase and its product offerings, specifically Firebase Authentication and Cloud Firestore (Firestore). I had some previous experience with both of these when I was trying to create a low cost (free) blog engine, which was supposed to replace this one. I'm giving it another shot to find out concretely whether it’s a good idea or not to use Firebase to speed up deployments of my personal prototypes.

Firebase Authentication

I got this working pretty fast. It was a nice win. Firebase tutorials make it pretty easy to set up and I found a good example on how to integrate it into Vue. Then I had to start thinking about how I could use this authentication flow with securing access to my own API endpoints. You can do this generating tokens from the client once you have authenticated with Firebase and then use the Firebase Admin SDK, which supports C# and Node (among other languages), to verify the tokens at your API endpoints. What’s cool is that even if you’re language isn’t supported, you can still verify client tokens, because they are JWT tokens and the documentation tells you how to do this. I haven’t tried this approach yet, but depending on how things go, I will probably explore that option.

Cloud Firestore

I decided to take a detour from my API endpoints and try using Firestore for storing my data. The reason being is that I want to see how far I can take my app with it and hopefully not have to pay much to do it. The only downside is that I have do things differently like make “database” calls in my front end, which is kind of weird. My goal is to make headway as fast as possible, not just this time, but next time as well. It didn’t take me too long to set up Firestore and start writing to it. That was another quick win. Now I had to start reading from it and do it in a way that would be manageable once I started writing and reading more data in my app. This got me starting to use Vuex, which is a state management pattern and library for Vue, inspired by Flux and Redux. I just dived into it and it looks like I’m going to need to read a little more about it to get my fundamentals in order. I am able to read data, but I’m not loading the data properly into my state for my component that displays listings. Anyways, the point is that I’m reading up on Vuex and getting that sorted out. The rest should be easier.

Firebase Hosting

After looking into Firebase Authentication and Firestore, the tutorials kept mentioning Firebase Hosting and so I decided to check that out. I was surprised by this service, because it was the first one I came across that will offer you free hosting and let you use a custom domain name. They take care of the SSL certificate and you just need to update your DNS records and verify ownership of the domain. It sounds like a pretty good deal. I’ll be trying this out later on once I get further into my project. It’s definitely a better price than Azure at the moment.

Serverless Architecture

I looked into the concept of serverless architecture and I have to do more reading on it. I get the general concept that I wouldn’t need to worry about provisioning servers, but how to do that with the different providers is another thing. Google, Amazon, and Microsoft all have their product offerings for serverless and how they let you achieve that. For example, Google Cloud has Cloud Functions, Microsoft has Azure Functions, and Amazon has Lambda Functions. It looks like only Azure Functions and Lambda Functions support C# and they both do it differently. Azure Functions seems a little more straight forward (and it should, since that’s a Microsoft language). Anyways, I don’t want to talk too much about it, because I haven’t actually tried any of them out, but I’m curious now. Like I said before, if it helps me build faster prototypes, and it's cheaper, then I’m in.