Firebase Cloud Firestore, the scalable real time database

July 2nd, 2018 - Justin Friebel
Cloud Firestore

Over the years I have read quite a bit about Firebase, mostly about it’s real time database. This includes some of the things people said about it having troubles scaling for larger usage.

Then came a new beta product from the Google Firebase team called Firebase Cloud Firestore. The Firebase team took everything people loved about the original real time database and made a slightly less real time database that can scale. It hits the sweet spot, and is really close to the Firebase real time database.

Google recommends using the new Cloud Firestore for most projects, unless you’re building a game or something that needs that instant feedback. The best part is you can use both in a single project if needed!

How does Cloud Firestore scale?

Cloud Firestore is more structured. Cloud Firestore is a document-model database, which means that all of your data is stored in objects called documents that consist of key-value pairs — and these values can contain any number of things, from strings to floats to binary data to JSON-y looking objects the team likes to call maps. These documents, in turn, are grouped into collections. Cloud Firestore also lets you build indexes for particular queries so they can maintain and scale them for you!

Cloud Firestore is a multi-region database. This means that your data is automatically copied to multiple geographically separate regions at once. This enables replication and the ability to scale with ease.

The multi-region database offers strong consistency (just like Cloud Spanner!), which means that you get the benefits of multi-region support, while also knowing that you’ll be getting the latest version of your data whenever you perform a read.

Firebase Cloud Firestore and your development time

In my current project named HelpFlow I’ve been using Google’s Firebase Cloud Firestore to build out the MVP. I can tell you right now, it’s really nice not having to worry about a server, scaling multiple servers, server side API endpoints, authentication, authorization, caching, you name it.

You just need to learn the basics of Firestore by reading through the documentation, and then do a little experimenting. I will admit, it took me a couple days to read everything, experiment, and figure out how it all works. Once I did, I could see how Cloud Firestore is an amazing database that will save a lot of time down the road with a little learning up front.

Cloud Firestore pairs really well with Firebase’s other Beta product, Cloud Functions. You can write cloud functions that are triggered when you create, update, delete, and write data, without any extra work! I’ll be writing a detailed post about Firebase Cloud Functions soon.

It is amazing to see an application come to life with real time and synced UI with offline support. Thank you Google, for basically giving this tech away.

I plan on writing a detailed post on everything I learned using Firebase Cloud Firestore soon!

© 2022 Justin Friebel. Powered by Next.js, prismic, & Vercel.