Going Serverless Firebase
Tags: firebase, serverless, functions, lambda
Published: 2020-01-11 14:21:05

---
title: Going Serverless Firebase
published: true
description: Focusing on Firebase as a Serverless Service.
tags: firebase, serverless, functions, lambda
canonical_url: https://jordanfinners.dev/blogs/going-serverless-firebase
---


Continuing from my previous [post](https://dev.to/jordanfinners/going-serverless-2o9p).

I want to focus on a few serverless providers, the first one being [Firebase](https://firebase.google.com/).

If you are building a mobile app or web app, I would highly recommend Firebase. It provides you with everything you need to get started.

Want [Authentication](https://firebase.google.com/products/auth/)? ✔️  
[Hosting](https://firebase.google.com/products/hosting/) for your site? ✔️  
A [database](https://firebase.google.com/products/firestore/) for any generated data? ✔️  
[Blob storage](https://firebase.google.com/products/storage/) for user images? ✔️  
[Serverless API endpoints](https://firebase.google.com/products/functions/)? ✔️  
Analytics? ✔️  
[And loads more features](https://firebase.google.com/products/)…

Basically anything you could want to do in an app or website Firebase has got you covered. Its a service provided by Google, so it has the support, up time and integrations you would expect.

Its also priced the way you would expect and is great value for money with tons of usage totally free! [https://firebase.google.com/pricing/](https://firebase.google.com/pricing/)

Developer Experience
--------------------

The docs for all of these different features are great, contain loads of samples and is super easy to get up and running!

There is a Firebase CLI which means that you can init projects and deploy in seconds. Once you’ve got the CLI and logged in, getting going with hosting is as simple as:

```
firebase init  
firebase deploy
```

Now I’ve only used it with one environment, so I don’t know how easy it is to switch between them like you would in a production environment.

> Converting from Express  
> I also came across these [docs](https://firebase.google.com/docs/functions/http-events?authuser=0) on converting an Express app to serverless functions which makes it amazingly simple, caveat I don’t know how the will affect the cold start time and performance of the functions.

Some down sides is that _(at the time of writing)_ you can’t run the functions locally, which means you always have to spin some functions up to test them, so can’t always go as fast as you might want to and it can mean mistakes take longer to debug.

The language options for the Firebase functions is pretty limited as well, both in terms of version (only Node 6 supported) and the only language its JavaScript (I’m okay with this, because I ❤️ JavaScript, but it might not suit everyone).

Downsides
---------

The cold start times are pretty variable for the Cloud Functions, as with most providers.

There is the obvious cloud lock in, all Firebase products work really well with each other and is more tricky if interacting with them.

I’ve also yet to figure out if there a way to version any changes and roll back, especially with changes to the Authentication system for example.

Then there is logging, now logging is okay, pretty standard across the cloud providers.  
However I have to compare it to my experiences with my favourite tool for logging/debugging [Azure Monitor (previously called App Insights)](https://azure.microsoft.com/en-us/services/monitor/) and right now its not even in the same league. You can’t tell the difference between logs of different deployments, nor the intelligent debugging you can do with Monitor.

Conclusion
----------

Firebase is great to get up and going really quickly and giving you loads of features right out of the box, perfect for side projects, start ups or demos.

However in an Enterprise situation, I feel like you would need to have a lot of processes in place to make sure that mistakes and breaking changes aren’t made and deployed.

I’d still recommend checking it out as there is so much you can achieve with Firebase, with very little effort, cost and complexity.

Let me know how you get on!