Getting Started: Firebase
I help you get started with Google’s Firebase. Firebase can replace or complement your back-end. Many of its services are free of charge.
Table Of Contents
- What’s This?
- Firebase Overview
- SDKs & Client Libraries
Firebase is Google’s “Back-end as a Service”. It provides services such as authentication, data storage, push notifications, crash reporting, and beta app distribution. Many services are free of charge.
We can use Firebase for all sorts of apps - mobile, web, and desktop. I used Firebase with Flutter and with Angular.
SDKs & Client Libraries
Firebase has a number of SDKs and client libraries. I’ve used these:
- The Flutter SDK is FlutterFire.
- The React Native SDK is React Native Firebase.
- The Angular SDK is AngularFire.
- The Java SDK is the firebase-admin Maven dependency.
Authentication (Mostly Free)
Firebase Authentication lets users of our apps authenticate - and we don’t have to store passwords or worry about password resets. Authentication offers various sign-in methods: email and password, social login (such as Google, Facebook, or Apple), phone number, custom integration, and anonymous. Google charges for phone authentication.
For web & mobile, Firebase also offers pre-built UIs for sign-in.
In Firebase Authentication, every user has a globally unique ID (GUID). We store that GUID in our applications. The result of successful sign-in with Firebase Authentication is a JWT from which we can extract the GUID. It least in my apps, Firebase automatically refreshes the JWT about every hour.
Cloud Storage ($)
Cloud Storage stores files - think Dropbox, OneDrive, or Google Drive. It integrates with Firebase Authentication so we can protect file access. Firebase offers security rules to more access control.
Google charges for Cloud Storage.
In my apps, Google’s SDKs give me a short-lived link to a access a file. So even authenticated users quickly can’t use that link anymore.
App Distribution (Free)
Firebase App Distribution lets us ship test versions of iOS and Android apps to users. Its advantage is that it’s one system instead of two (Apple TestFlight and Android Play Console). Its disadvantage is that participants of Firebase App Distribution need a Google account.
Firebase App Distribution is a website on iOS. Setting up test app distribution on iOS is an involved process: We need to register test devices individually, there’s certificates & profiles, and test users need to install a profile on their phone (which expires after a year). If that sounds complicated - it is!
App Distribution is an app on Android. There’s no test device registration, and there are no certificates & profiles. Test users have to allow test app installation through the Google Play Store, though.
I’ve used App Distribution. It has its quirks but works. Which quirks?
- Sometimes it can install over an existing app version, sometimes it can’t.
- It failed to download test versions a couple of times but then succeeded later on.
- On Android, App Distribution opens a page in the Google Play Store that you can’t navigate from. You have to kill the Google Play Store to access it normally.
Firebase Crashlytics reports app crashes on iOS and Android. Its advantage is that it’s one system instead of two (Apple and Google both have crash reporting). Twitter bought the start-up Crashlytics in 2013 and sold it to Google in 2017.
Cloud Firestore ($)
Cloud Firestore is a NoSQL database. It caches data automatically and also works offline. Like Cloud Storage, it It integrates with Firebase Authentication and offers security rules to protect data access.
Google charges for storing, downloading, reading, writing & deleting data in Firestore.
I only used Cloud Firestore in a prototype in 2019 (YouTube video). As with many NoSQL databases, we may have to structure data storage specifically to allow for all the queries we need.
Remote Config (Free)
Firebase Remote Config lets us change app behavior without rolling out app updates. It does this by defining parameters with in-app default values. We can then overwrite these defaults per user or per user segment.
I haven’t used Remote Config.
Cloud Messaging (Free)
Firebase Cloud Messaging enables push notifications to mobile apps and web apps. I think the number of push notifications is unlimited.
We can send push notifications with an admin SDK or through a REST API.
A/B Testing (Free)
Firebase A/B Testing lets us ran experiments in our apps. It uses Remote Config to change the app behavior and Cloud Messaging to send push notifications.
I haven’t used A/B Testing.
Google Analytics (Free)
Firebase Google Analytics measures app usage and user engagement. It’s available for iOS, Android, and web apps.
When considering Google Analytics, we should think about whether we’re ready to act on the results we’d get. If not, the cost of Google Analytics may not be worth it. For instance, Apple’s App Store and the Google Play Store require disclosure of analytics packages such as Google Analytics.
I tested Google Analytics but haven’t used it in production.
Performance Monitoring (Free)
Firebase Performance Monitoring measures app performance. It monitors start-up time and HTTP requests automatically. We can do custom measurements. It’s available for iOS, Android, and web apps.
As with Google Analytics, we also need to think about whether we’re ready to act on the results of Performance Monitoring: It’s also an analytics package we need to disclose on Apple’s App Store and the Google Play Store.
I tested Performance Monitoring but haven’t used it in production.