Why Firestore, Part I: reasons to love it

LeanCode
5 min readNov 18, 2020

--

by Jakub Fijałkowski

Firestore & Firebase suite are great technologies. They allow us to build some features really fast. Showing your stakeholders that you’ve built real-time, collaborative features in almost no time gets you the “wow effect”, so needed in some fields. However, Firestore has also many pain points that, in my opinion, outweigh the pros in most of the more advanced cases.

This is a series of articles where we are comprehensively describing the pros and cons of using Firestore as the backend for your next mobile application. In this series, we will try to show you that making this decision is not a simple process and you need to analyze your app from multiple perspectives.

Posts in the series:
1. Why Firestore, Part I: reasons to love it [you are currently reading it].
2. Why Firestore, Part II: reasons to hate it
3.
Why Firestore, Part III: 6 things you need to know before using Firestore
4. Why Firestore, Part IV: how to escape it

Is Firestore appropriate for you? As with everything in IT — it depends. Read on to find out why!

Easy to integrate

Firestore has outstanding libraries for mobile. Android (Kotlin!), iOS (Swift!), Flutter (Dart!) — every one of them works magically. For free you get services that complement each other with ergonomic and easy-to-bootstrap libraries. With Firestore libs you get all the goodies of Firebase suite — auth, serverless, storage, ML, and others perfectly blended with the language specifics.

The only bad thing about it is that they are pervasive — once you get them, you start using them everywhere. In all layers. Generally, that is a bad thing, but let’s be honest here, most small apps don’t need any additional abstractions and using the libraries directly is a good thing.

Offline capabilities

This is a major trait of Firestore. The truly killer feature — it can work (to some extent) offline. Seamlessly. If you have accessed the data previously, you can do so again without the Internet connection. You can even save the data there without an active connection. Firestore libraries handle all the syncing, data merging, notifications, and other problems.

This feature alone makes Firestore worth considering for some of your functionalities. Being able to easily do offline browsing is a great advantage over your competitors. Firestore isn’t the only solution supporting this (there is Realm) and others might provide more configuration knobs, but some apps just don’t need it. And Firestore gives you a very powerful and very easy solution to start with.

You don’t need a backend… sometimes

Firebase platform (that Firestore is part of) might be a viable “backend” option for small, user-focused apps. If you use it alongside other SaaS solutions (e-mails, voice calls, etc.), you might be even able to build a not-so-small app without creating any traditional backend system.

Firebase suite provides you with

  1. Auth — Firebase Auth,
  2. Storage — Firebase Cloud Storage,
  3. Serverless — Firebase Cloud Functions,
  4. Basic machine learning — Firebase ML,
  5. A/B tests & user-scoped configuration — Firebase Remote Configuration,
  6. App distribution & monitoring — Firebase App Distribution & Crashlytics,
  7. Many, many more.

Being Google’s product, it also integrates well with GCP. It blends with it more and more with every release and I suppose that soon, these two will be fully merged.

Having all these solutions in a single place, governed by the same IAM services and configured the same gives you a great advantage right at the beginning. It allows you to focus on what matters, leaving all the gritty details to Firebase. Even if you end up needing some more advanced backend features, you can always use Cloud Functions and do it the normal way.

Examples

Firestore is great for many things. If you are working on highly collaborative applications like a whiteboard, you can use it with great success — just like we did.

If you need to have offline capabilities, using Firestore for that is also great — we used this approach in Activy and it worked wonders.

We need there to record GPS tracks as reliably as sport devices (e.g. watches), but being a casual gaming app, it needs to do so in very rough conditions without specialized hardware. Jagged GPS signal, no Internet, very slow connection, intermittent Internet connection, apparent connection — all need to be taken care of. With Firestore, we were able to handle all of the cases and give our users a solution that works everywhere, even in very remote areas, without that much of a development.

There are tons of other places where Firestore is a great solution, but Firestore simplicity can take its toll. Where Firestore shines and simplifies things at the beginning, it can make your hair gray after the application gets complicated enough. As with everything in programming — you need to wage pros and cons, consider the future and select what is best for your app.

Do you want to find out how the Firestore pricing works or what traps wait for you if you want to properly secure it? Maybe you want to create an auction-based app that requires very fast updates? We learned about this the hard way. Paying thousands for improper usage, breaking live apps because of deployments, overcoming all the shortcomings of Firestore — we’ve been there. Read the next one in the series to find out more about our story!

Read the 2nd part of our series on “Why Firestore” to learn about the biggest limitations of Firestore.

--

--

LeanCode
LeanCode

Written by LeanCode

We‘re a group of technology enthusiasts working together for our clients to create better solutions for their digital consumers. See more at https://leancode.co