Firebase Pros and Cons (for Flutter app development)

Firebase is a BaaS (Backend-as-a-Service) offering a wide range of features that would be very complex to implement on your own.

Firebase is popular because it’s very easy to use. In fact, you can easily add authentication, remote database, and server-side functions to your app with little effort.

And since Firebase is hosted on Google Cloud, you don't have to worry about managing your own server and scaling issues if your app becomes successful and is used by millions of users.

But of course, Firebase is not a silver bullet. And depending on your app requirements, it may or may not be the right choice.

So in this article, we’ll see if Firebase is well suited for Flutter app development, by looking at this criteria:

  1. Available features
  2. Remote database (Cloud Firestore advantages and drawbacks)
  3. Supported platforms
  4. Dart support (client-side and server-side)
  5. Pricing
  6. Portability and vendor lock-in
  7. Documentation & developer experience

We'll conclude with a summary of Firebase's pros and cons, so you can decide whether it's the right backend for your app.

Note: this is a high-level overview of what's good (and not so good) about Firebase. If you're already experienced with Firebase, you'll get more value from my upcoming articles, which will cover specific topics in more detail.

Let's dive in!

1. Available Features

Firebase offers a robust suite of features, making it a strong choice for mobile and web app development.

The full list includes: Firebase Authentication, Cloud Firestore, Realtime Database, Cloud Storage, Cloud Functions, Remote Config, Firebase Extensions, App Check, Cloud Messaging, Firebase Hosting, Firebase Machine Learning, Crashlytics, Google Analytics, Performance Monitoring, Firebase Test Lab, App Distribution, A/B Testing, Dynamic Links, and In-App Messaging.

With so many features, Firebase is likely to offer everything you need for most apps.

In comparison, alternatives like Supabase, Appwrite, and Serverpod have a more limited suite of products.

There are many other Firebase alternatives you could consider. But if you’re building Flutter apps, you may as well choose one with good support for Dart and Flutter.

But as they say, the devil is in the details.

And one of the most important things to consider when starting a new project is what kind of database you need. 👇

2. Remote Database

With Firebase, you can choose between two databases:

Both are NoSQL databases, and Cloud Firestore is the recommended choice for most apps:

Cloud Firestore page in the Firebase console
Cloud Firestore page in the Firebase console

Cloud Firestore Advantages

Firestore is very easy to use, offering features like real-time listeners, caching, and offline mode.

  • Real-time listeners make it easy to sync your data across multiple devices and rebuild your UI automatically when the data changes.
  • Caching reduces the overall network usage (and the cost of your Firebase bill) because when you’re listening to a large collection, only the data that changes is sent to the client.
  • Offline mode ensures that Cloud Firestore works smoothly even when your users go offline for a while (within the cache size limit).

All these features come out of the box, so you can benefit from them without writing a single line of code.

Cloud Firestore Disadvantages

With Cloud Firestore, not everything is sunshine and rainbows. 🌈

And there are some disadvantages too. 👇

Full-Text Search (or lack thereof)

For starters, full-text search is not supported. This is needed in many kinds of applications, such as eCommerce sites, where you need to be able to query an entire product catalogue.

If full-text search is important to you, you’ll have to use external services like Algolia:

Firestore search with Algolia
Firestore search with Algolia

Search with Algolia is available as a Firebase extension, and it is quite easy to set up, but it is also quite expensive at $0.5 per 1000 requests.

And it would be nice if we had full-text search directly with Cloud Firestore without relying on 3rd party services.

Querying

You can use queries to filter the documents you want to retrieve from a collection or collection group.

When writing queries, you can use all these comparison operators: <, <=, ==, >, >=, !=, array-contains, array-contains-any, in, not-in:

final citiesRef = FirebaseFirestore.instance.collection("cities"); citiesRef .where("state", isEqualTo: "CO") .where("name", isEqualTo: "Denver"); citiesRef .where("state", isEqualTo: "CA") .where("population", isLessThan: 1000000);

And If you need to run compound queries, you can use the OR and AND filters:

FirebaseFirestore.instance.collection('jobs').where( Filter.and( Filter.or( Filter('jobLevel', isEqualTo = 'Senior'), Filter('ratePerHour', isGreaterThan = 100), Filter('yearlySalary', isGreaterThan = 150000), ), Filter('offerType', arrayContainsAny = ['permanent', 'contract']), ), )

However, Cloud Firestore has some query limitations.

These limitations may not be obvious when you're just starting out, but they can bite you later when your database structure and queries become more complex.

NoSQL or Relational database?

When starting a new project, you should ask yourself if a NoSQL database is what you want, or if you should go with a relational database such as PostgreSQL or MySQL.

While relational databases come with a steeper learning curve, they can make life easier down the line, especially if your data is highly structured and will benefit from being able to run complex SQL queries.

In fact, relational databases allow you to join multiple tables and perform queries on the result. But with Firestore, you can only run queries on individual collections or collection groups.


Next, let's switch gears and discuss what platforms are supported.

3. Supported platforms

A quick search on pub.dev reveals that the Firebase packages can be used on Android, iOS, macOS, and web:

Firebase supports Android, iOS, macOS, and web as target platforms
Firebase supports Android, iOS, macOS, and web as target platforms

But if you're building a Flutter app with Windows or Linux as a build target, then you're out of luck because Firebase does not support these platforms.

The only exception to this is Firebase Auth, which can be used on Windows and Linux with the firebase_auth_desktop package.

It’s important to note that all the FlutterFire plugins rely on the underlying iOS, Android and web SDKs, rather than being implemented in pure Dart.

And this also means that they require some platform-specific configuration (using files like GoogleService.plist on iOS and google-services.json on Android).

For simple apps, the FlutterFire CLI can generate these files for you.

But as soon as you start adding more complex features like analytics and push notifications, configuring everything correctly on each platform can become a challenge (and for the most part, it must be done manually).

If you need dev, staging, and prod environments, be prepared to do some extra work. This article covers some of the required steps: Flutter Flavors Setup with multiple Firebase Environments using FlutterFire and Very Good CLI

4. Dart support

The Firebase packages on pub.dev make it easy to use Firebase on the client using Dart.

But if you want to write server-side code using Cloud Functions, you have to use the Firebase Admin SDK, which runs on Node.js and is available for JavaScript and TypeScript, but not for Dart.

In other words: there’s no official way to write full-stack applications in Dart using Firebase.

Having to write Firebase Cloud Functions in JS or TS is not ideal because:

  • you have to learn two different languages (and ecosystems), which impacts your development speed
  • you can't share your business logic and data models across the entire stack
  • you can't reuse your favourite Dart packages on the server

On the plus side, you get access to the entire JS ecosystem, and this is far more mature than the Dart ecosystem:

npmjs package manager (left), pub.dev (right)
npmjs package manager (left), pub.dev (right)

But without doubt, using a single language brings many benefits, especially on the client-server boundary. For example, Serverpod makes it easy to generate serializable classes that can be passed between server and client or used to communicate with the database.

Code generation is a great solution for repetitive tasks like data serialization, and the cloud_firestore_odm package is a step in the right direction. But it is not well documented and doesn’t go far enough compared to some of the Firebase alternatives.

5. Pricing

For some reason, many people are scared about Firebase pricing.

But the reality is that Firebase has a very generous free tier, meaning that for most hobby projects, your cost will be a big fat zero:

Firestore free quota and price per unit beyond free quota
Firestore free quota and price per unit beyond free quota

And if you ever exceed the free tier, you’ll incur some costs that will scale up based on usage.

But you’ll have to make millions of monthly document reads/writes/deletes before you start spending some real money.

And the Firebase pricing calculator helps you get an estimate:

Firebase pricing calculator
Firebase pricing calculator

Usage and Billing

In any case, most Firebase products include a “Usage” tab where you can see your usage for any given period. Example:

Usage tab → billable metrics
Usage tab → billable metrics

Along the same lines, you can see the cost of your project directly in the Firebase console (under “Usage and Billing”):

Usage and Billing → project cost
Usage and Billing → project cost

And for extra peace of mind, you can go to your Google Cloud account and configure budgets and email alerts, so you’re notified if your usage exceeds certain thresholds.

Budget alerts in the Google Cloud Console
Budget alerts in the Google Cloud Console

So the biggest takeaway is that pricing shouldn't be your main concern.

6. Portability & Vendor Lock-in

When choosing a BaaS, there are two important factors to consider:

  • how easy is it to migrate the data to an alternative service?
  • is there a self-hosted option?

Data Migrations

One of the biggest drawbacks about Firebase is that Cloud Firestore is a proprietary database.

And while you can choose between different locations (or regions) when you create a Firebase project, your customers’ data is always stored on Google servers.

But if you want to migrate your data to a different backend, what can you do?

As it turns out, Supabase offers a Firestore Data Migration tool that you can use to convert data from a Firestore DB to a Supabase PostgreSQL DB. And it looks like AWS offers a migration guide as well.

Though don't expect the process to be easy, especially if your app already has active users in production.

I’ll just quote Jeff Delaney (Fireship.io) on this one:

Firebase is just like cocaine. It feels great to get things done quickly, but trying to come off of it is not very fun.

No self-hosted option

Unlike other popular backends like Supabase, Firebase doesn't offer a self-hosted solution.

On one hand, this is not a big problem since the whole point of a BaaS is that you don't want to manage your own servers.

On the other hand, all your data is hosted on Google Servers, and you don't have full control over your backend.

Backups

Though at least, Firestore offers some options to backup your data using the Google Cloud Console:

Firestore export option in the Google Cloud Console
Firestore export option in the Google Cloud Console

You can use these options to export the entire database or select one or more collection groups, which will be saved to a Google Cloud Storage bucket of your choice.

And if you want to go a step further, you can automate the entire process and create backups at regular intervals, following the steps on this guide.

Note that you'll be billed for data usage when doing backups, based on the number of document reads and writes.

Documentation & Developer Experience

Documentation is something where Firebase is doing a good job (mostly).

In fact, Firebase comes with extensive documentation covering the most important features, and you'll find that many of the examples in the docs include code snippets written in Dart:

Firebase documentation with code snippets
Firebase documentation with code snippets

However, the documentation for Flutter can be spotty sometimes, and there are cases where you'll only find what you need in the old FlutterFire website, which is no longer updated.

The Firebase YouTube channel deserves special mention, as it contains some great educational videos and in-depth series about products like Cloud Firestore and Cloud Functions.

Getting started with FlutterFire CLI

Adding Firebase to a mobile or web app used to be a long and painful process.

But these days, the setup only takes a few minutes and can be done with a CLI tool called FlutterFire.

The easiest way to get started is to choose your desired platform from the Firebase console:

Adding Firebase to your Flutter app
Adding Firebase to your Flutter app

Then, you can follow all the required steps:

Step-by-step guide to add Firebase to your Flutter app
Step-by-step guide to add Firebase to your Flutter app

And once you've added Firebase to your Flutter app, you can use the Firebase UI packages to integrate various Firebase features into your app easily.

For example, you can add email & password auth or Google Sign In with just a few lines of code:

The firebase_ui_auth package makes it easy to add a custom sign in screen with a few lines of code
The firebase_ui_auth package makes it easy to add a custom sign in screen with a few lines of code

Summary: Firebase Pros and Cons

Time for a summary of all the Firebase pros and cons. 👇

Firebase Pros

  • many available features to choose from 😀
  • ease of use + good developer experience 👨🏻‍💻
  • affordable pricing 💳
  • quick time to market 🚀
  • great for shipping secure apps at scale 🔥

Firebase Cons

  • no Windows and Linux support (yet) ⏳
  • no native Dart SDK 😞
  • Firebase Cloud Functions only support TS and JS → bigger learning curve and less code reuse when writing full-stack apps 😢
  • No full-text search and Cloud Firestore query limitations 😐
  • vendor lock-in 😨

Conclusion

On balance, Firebase is a very mature platform and it integrates very well with Flutter.

And I've been happy to use it as a backend for most of my Flutter apps for many years.

But of course, the best way to find out if Firebase is right for you is to try it yourself and figure out if it ticks all the boxes, based on your app requirements.

New Flutter & Firebase Course

If you want to learn Flutter & Firebase, consider taking my new course.

Inside, we’ll start from the basics, by building a simple app using the FlutterFire CLI, Firebase Authentication, Cloud Firestore, and the Firebase UI packages.

Then, we’ll learn how to build a full-stack eCommerce app and dive deeper into data modelling, queries, CRUD operations, image uploads, role-based authorization, how to run server-side code securely, how to work with 3rd party integrations on the backend, and much more.

Check it out for all the details. 👇

Want More?

Invest in yourself with my high-quality Flutter courses.

Flutter Foundations Course

Flutter Foundations Course

Learn about State Management, App Architecture, Navigation, Testing, and much more by building a Flutter eCommerce app on iOS, Android, and web.

The Complete Dart Developer Guide

The Complete Dart Developer Guide

Learn Dart Programming in depth. Includes: basic to advanced topics, exercises, and projects. Fully updated to Dart 2.15.

Flutter Animations Masterclass

Flutter Animations Masterclass

Master Flutter animations and build a completely custom habit tracking application.