Firebase - My New Favorite Toy

Adam Prentice
Adam Prentice
13 Aug 2015
blog post featured image

Firebase Logo

Allow me to sing Firebase's praise for a second.

Firebase is a service that allows you to, in their words, "focus on your users". It is a tool that combines data storage with user authentication, and basically takes most of the hassle out of creating the backend of a website. But it's not just for the web. There are libraries available for iOS and Android, as well as official integrations with major javascript frameworks such as Ember, React and Angular

I've been using Firebase for a while now, with small projects that need a quick start up or some PoC ideas and it has been invaluable when just trying to get up and running. For a simple website, all that you need to do to start writing data to your database is add the CDN to firebase.js, and then reference your firebase database in your javascript somewhere and voilà! You have yourself a functioning database connection! See below:

    <script src=''></script>
      var myDataRef = new Firebase('https://<INSERT-FIREBASE-NAME-HERE>');

It implements a JSON style database, with all of your data written into one file. The data is synchronised between all of the connected clients in real time, meaning that everyone will always have the most current data to use. This is especially useful when making a chat client or news feed, as it doesn't require the user to refresh the page, or a periodic AJAX call.

There are various forms of user authentication that you can use. You can choose to use a simple Email and Password combination, which Firebase handles with ease (including being able to customise the email that gets sent to users who have forgotten their passwords). oAuth is also an option, with access to Facebook, Twitter, Google and Github. And finally, you can use your own authentication server to log users into your system. The details about the user are stored in the database, with access granted to those with clearance. And this is all done on the client side!

The security of your database is dependent on your situation. For this reason, Firebase leaves it up to you to write your security rules, however this is simply a JSON file that you can specify which parts of the database can be accessed by who, or when. There is an excellent guide provided to help you set this up, so this isn't as daunting as it may seem.

On the subject of guides, the documentation for Firebase is extensive. It includes examples that have been created to show off what can be done, and how easy it is. There is a "quickstart" section under every platform so that you can get yourself up and running in under 5 minutes, and if you're really stuck, then there are several pre-made recipes that you can drop into your code that will add that functionality.

But that's not all! Firebase can also host your site for you! Every app has its own domain, with paid apps having access to custom domains.

And the best part about all of this? It's free! There is a tiered pricing structure if you plan to use Firebase in production, but for PoC and small apps, the free version is plenty. I've included the pricing structure below, which is correct as of 12/08/2015. For the most up to date prices, visit Firebase Pricing

Firebase Pricing

If you have 5 minutes spare, I implore you to try it out. There is a Tutorial that will walk you through making a simple messaging system. All you need is the ability to copy and paste! It's certainly an invaluable tool in my Web Dev Arsenal, and if, like me, you create websites frequently that require authentication and a database connection, then this could be invaluable for you too.

I will shortly be writing a series of blog posts that go into Firebase in more depth, creating a simple website that has all of the functionality you are most likely going to need to use when creating your own. So make sure to stay tuned!

Close chatbot
Open chatbot
Open chatbot