Firebase review — 9 months in

Photo by Lum3n (CC)

TLDR: Initially only planned to use Firebase to help kickstart a side-project, ended up falling in love with it.

The Good

  • Beautiful user authentication API and management
  • One of the best (and cheapest) hosted database solutions around
  • Fantastic documentation
  • Amazing UI
  • Decent integration libraries

The Bad

  • Firebase does not fully replace a backend
    Update: now with Cloud Functions, a ‘serverless’ app is possible!
  • Firebase SDK library is closed source
    Update: Firebase has open sourced the SDKs!

The Good

Authentication

Chances are, if you’re building an app, you’re going to need some form of user authentication and management. Let’s take a look at how you can add Google Sign-in to a (Firebase-configured) app:

Well… that was easy. The more discerning readers among you will notice that the syntax isn’t that far from the (non-Firebase) standard Google Sign-in flow. However, what isn’t available with the standard Google Sign-in, is a fully-fledged backend where you can create, delete or temporarily disable users to your heart’s content.

Pushing my digital design skills with blurred boxes

It’s not possible to talk about JavaScript user authentication frameworks without mentioning passport.js, by far the most popular and widely-known solution out there. However, it’s important to remember that passport.js only runs on Node.js, so if you’re looking for a client-side framework, Firebase is the way to go.

Database

Initially, I only planned to use Firebase Database in the early stages of development. I saw it as a convenient option, as I didn’t have to set up my own MongoDB instance, but I was constantly aware of becoming too dependent on it. My main gripe was that it’s a proprietary standard and I didn’t want to outsource control of my data.

A few months into the project I decided to finally set up my own MongoDB instance. I realised my requirements were:

  • ~99.9% uptime
  • Excellent performance
  • Easy application of security updates
  • A front-end to view the data
  • Automated backups

Some important context is required here; the side-project I’m working on isn’t a technical hobbyist-type project, it’s a business. My aim is to make a product available for real users to use (and eventually pay for). Therefore I wasn’t keen on the idea of spending an extra month working on configuring a database setup to meet the above requirements.

Fortunately, there are a number of hosted database solutions available. One such solution is MongoDB Atlas (from the team who make MongoDB). This was starting to sound like a good option until I saw the pricing calculator. The cheapest instance is $0.09 an hour, or ~$64 a month. Compare this to the Blaze plan with Firebase Database, which meets all of the requirements above (including automated backups!) and costs only $0.026/GB. With my usage of a few hundred users (saving text-only data), my last monthly bill came to $0.30. Google is no stranger to storing data, so it makes sense they would be able to provide the most cost-efficient storage plans for a hosted database.

My remaining qualm was that Firebase Database is a proprietary standard, which I was apprehensive about until I discovered that it’s possible to export your entire database at any time to a JSON file. That means you’re free to leave whenever you like and transfer your data to another NoSQL database program. To summarise, staying with Firebase Database would give me a cheap, secure, hosted database with guaranteed uptime, along with the option to leave at any time. My search for a hosted database provider was over!

Now let’s check out how you can go about saving data to Firebase Database:

Yep. It’s genuinely as simple as that.

Now to retrieve some data:

So pretty I want to cry.

Now also feels like a good time to mention that Firebase Database automatically syncs your data across clients in realtime. That means if you have your app open on both your phone and your laptop, and you edit some data on your phone, the change will automatically be reflected on your laptop.

Documentation

It’s not uncommon to see people complaining about Google’s “poor documentation” on sites like Reddit and Hacker News. After spending time with the Firebase documentation, I couldn't disagree more and I would suggest anyone who still holds Google in a poor regard to check it out.

Amazing UI

Screenshots can only do this so much justice. It’s free to create projects with Firebase so if you’re curious, sign up and “have a butchers” for yourself.

Integration Libraries

There’s certainly no shortage of libraries available. That being said, I avoided the React library as it seemed quite out of date and heavily dependent on mixins, which are now considered harmful to use in React.

The two libraries I did make use of were the Web and Node.js Firebase SDKs. Both libraries integrate well with the Firebase Auth service making it a breeze to save user-protected data to the database.

The Bad

Firebase does not fully replace a backend


Update: now with Cloud Functions, a ‘serverless’ app is possible!


In my case, I feel I’ve managed to offload about 80% of the backend to Firebase. (Note - this is a still huge number in terms of development time for an independent developer like myself.) As for the remaining 20%, what Firebase couldn’t help me with was my need to send automated emails on a daily basis.

Tantalisingly, Firebase does actually have email support, but this is limited to just basic configuration of “password reset” and “email address change” emails. If support was added for more generic templates, then Firebase users could extend this to build any type of email, such as a welcome email when a user initially signs up.

Firebase SDK library is closed source


Update: Firebase has open sourced the SDKs!


There are more than 60 open source repos on the Firebase GitHub page. These repos are made up of numerous example and integration libraries. I cannot fathom why the main Firebase SDK library is still closed-source. I understand it must have been a security decision, but I’m sure the Firebase team could make the majority of the main SDK library open source whilst still keeping the more sensitive sections private.

While I am generally happy with the Firebase documentation, as is always the case with documentation, it doesn’t cover everything and sometimes a dive into the code is the only way to find answers. I had one such case when trying to find out if the Firebase Auth service was available as a promise, rather than just an observable. It did take me by surprise to find only a minified, obfuscated library script within my node_modules directory. As I mentioned before, relying on proprietary code and standards can be unsettling so I hope this is something the Firebase team can tackle in the near future.

Would I recommend Firebase?

Absolutely. For one-man bands like myself Firebase is virtually indispensable. Obviously, if you’re working in a team which can spare people to manage a backend and maintain a database, you won’t have a real need for it. But if you’re an independent developer working on an app which requires a full stack, I can’t recommend Firebase enough.


Like any of the words from this story? Check out Vocabify, a vocabulary builder which helps you learn the words you come across.