Firebase
- Summary
-
Discussion
- Why should I adopt Firebase for my next web/mobile app?
- What are the products offered by Firebase?
- What exactly is Firebase Hosting?
- What's a suitable deployment architecture when using Firebase?
- Could you share more details on Firebase Cloud Messaging (FCM)?
- How's the pricing of Firebase products?
- What are some criticisms of Firebase?
- Milestones
- Sample Code
- References
- Further Reading
- Article Stats
- Cite As
Modern web and mobile apps are typically built with a mix of backend services and frontend frameworks. Wouldn't it be nice if there was a way for developers to focus on just the frontend and user experience, and let someone else take care of all backend requirements? It's exactly in this context that Backend-as-a-Service (BaaS) has emerged.
Firebase started as a BaaS but after its acquisition by Google in 2014, it's now more deeply integrated to some parts of Google Cloud Platform. Since then, Firebase is described as "a comprehensive mobile development platform". The idea is to build apps faster without managing infrastructure.
Discussion
-
Why should I adopt Firebase for my next web/mobile app? Firebase provides easy-to-use workflows common to many apps. Examples include onboarding flow, customizing the "welcome back" screen, progressively rolling out new features, following the user journey across devices, adding chat to your app, optimizing ads based on user behaviour, enabling users to share and resize photos, processing third-party payments, and more. These typically involve significant development on the server side. Instead, Firebase offers out-of-the-box and easily deployable solutions to do these.
As developers, you don't have to worry about server-side software. Mobile and web SDKs enable this. The main offering is real-time sync of data between client apps and Firebase via Realtime Database and Cloud Firestore. Using Authentication, user authentication feature is easy to build, even if it involves third-party providers such as Facebook or Twitter. Messaging and notifications are efficiently done using Firebase Cloud Messaging (FCM). Unlike native apps updated via app stores, Remote Config can update Firebase apps without asking users to update their installation. Using Crashlytics and Performance Monitoring app stability and performance can be improved. There's good integration with Adwords and Admob. Even UI testing across multiple devices is simplified via Test Lab.
-
What are the products offered by Firebase? Firebase products can be grouped into three categories:
- Build: Helps developers build more powerful, secure and scalable apps. Products include Cloud Firestore, ML Kit, Cloud Functions, Authentication, Hosting, Cloud Storage, Realtime Database.
- Improve: Gives developers insights into app performance and stability. Products include Crashlytics, Performance Monitoring, Test Lab.
- Grow: Helps your app to grow. Products include In-App Messaging, Google Analytics, Predictions, A/B Testing, Cloud Messaging, Remote Config, Dynamic Links, App Indexing.
-
What exactly is Firebase Hosting? With the rise of powerful frontend frameworks (Angular) and static site generators (Jekyll) it's become possible to develop web apps without much server-side processing. For hosting such web apps, Firebase Hosting is a suitable solution. It serves content over secure connections, delivers content quickly due to caching on solid-state devices at CDN edges, enables rapid deployment and supports one-click rollbacks. CDN edge servers ensure global availability of your app. SSL certificates are free and automatically provisioned even for custom domains.
It's also easy to deploy a sophisticated Progressive Web App (PWA). While Firebase Hosting serves static content, dynamic content can be served using Cloud Functions for Firebase or Google's Cloud Run.
-
What's a suitable deployment architecture when using Firebase? With Firebase, a web/mobile app can be deployed without running your own backend server. However, Firebase can also co-exist with an app server.
If the app requires only client-side code or doesn't require complex processing, then all the backend needs can be served by Firebase. If the app needs more complex processing or integration with third-party APIs, then Firebase can sit between clients and the app server. Clients access Firebase data and the server listens to changes to the data. Server manipulates data in Firebase, to which clients are notified. In another deployment architecture, Firebase sits logically next to the app server. Clients communicate to both. This architecture is ideal for large legacy apps where some parts (such as real-time features) are served by Firebase while older parts are served by the legacy server code.
Given that Firebase supports server-side execution (Cloud Functions since March 2017, Cloud Run since April 2019 ), it's possible that even when an architecture requires an app server, it could be offloaded to the serverless cloud infrastructure.
-
Could you share more details on Firebase Cloud Messaging (FCM)? FCM a cross-platform messaging solution that can be used for pushing new data to client apps or notifying users. Instant messaging has a payload limit of 2KB. From client to server, acknowledgments, chats, and other messages can be sent.
FCM consists of FCM servers managed by Google and an app server or other trusted environment such as Cloud Functions for Firebase. All message go via FCM servers. Developers can use raw protocols (HTTP/XMPP) or use Admin SDK. HTTP is synchronous and downstream. XMPP is asynchronous and both downstream and upstream. HTTP supports multicast as well.
In April 2018, Google deprecated its Google Cloud Messaging (GCM) service. GCM APIs will be available only till April 2019. Since GCM and FCM cannot coexist in an app, developers must migrate to FCM. FCM inherits GCM infrastructure and adds many new features. For more details, refer to the GCM/FCM FAQ.
-
How's the pricing of Firebase products? Firebase gives following services under free tier: A/B Testing, Analytics, App Indexing, Authentication (except Phone Auth), Cloud Messaging (FCM), Crashlytics, Dynamic Links, Invites, Performance Monitoring, Predictions, and Remote Config. With free tier, you get some free access to other products with limits on storage, bandwidth, number of reads/writes/deletes/uploads/downloads/tests, etc. Realtime Database allows only 100 simultaneous connections.
Besides the free tier, there's a fixed price per month and pay-as-you-go plans. With the latter, the pricing of Realtime Database, Cloud Firestore, Storage, Phone-Auth, Hosting, Test Lab, ML Kit, Use of BigQuery & other IaaS, is based on the use.
-
What are some criticisms of Firebase? Since 2016, developers have noted many problems with Firebase. While it's good for enabling real-time apps with client-side logic, running complex database queries is almost impossible. Firebase Realtime Database is nothing more than a large JSON file. Data is duplicated since the benefits of relationships in a relational database are absent. Filtering or paginating records are not possible. More recently, the situation has improved with Cloud Firestore that manages data using collections and documents.
Your data is on a server that you don't control. There's no easy way to import/export data. Firebase is also not open source. If the service is discontinued, you have no choice but to rework your app. While initial development may be faster, scaling up later may prove difficult. Moving business logic from client to server won't be trivial. When you scale, the cost of using Firebase will be higher than adopting a platform-as-a-service.
Developers can't work with a local installation. Network connection is required. They're also at the mercy of Firebase's upgrade cycles.
Milestones
2011
2012
It's noticed that some apps using Envolve are doing things beyond chat. They use Envolve's capability for synchronizing app data in real time. This prompts its creators to separate chat functionality from the underlying framework that enables real-time communications. The latter could now be offered as a standalone service. Thus, Firebase as a separate company is born.
2014
2016
2017
Firebase releases Cloud Functions for Firebase. This makes is possible to execute JavaScript (Node.js) on the server side, on Google's cloud infrastructure. Cloud Functions has integrations with many components of Firebase. Projects that needed to deploy servers until now, can migrate to Cloud Functions and become completely server-free.
2017
Firebase team announces a beta release of Cloud Firestore, a fully managed NoSQL document database. Built in close collaboration with Google Cloud Platform team, it's replicated across regions and offers strong consistency. However, for special use cases where cost and latency are important, Firebase Realtime Database may be preferred.
2018
As a beta release, ML Kit becomes available on Firebase. This allows developers to add machine learning features into their apps. Use cases supported are recognizing text, detecting faces, scanning barcodes, labelling images and recognizing landmarks. For advanced use cases, developers can also import TensorFlow Lite models.
2018
2019
2019
At the fourth annual Firebase Summit, Firebase launches Firebase Extensions, Firebase App Distribution and integration with Google Analytics. Firebase Extensions could to be a time saver, particularly for independent developers. These extensions implement common tasks. Examples include image resizer, URL shortener and text translation. As on August 2021, there are 11 extensions and many more experimental extensions.
Sample Code
References
- Anastasyev, Dmytro. 2016. "Firebase Framework Review." MLSDev, October 16. Accessed 2018-11-12.
- Bover, Pier. 2017. "Firebase: the great, the meh, and the ugly." freeCodeCamp, January 13. Accessed 2018-11-12.
- Crunchbase. 2018. "Firebase." Accessed 2018-11-03.
- Dufetel, Alex. 2017. "Introducing Cloud Firestore: Our New Document Database for Apps." The Firebase Blog, October 03. Accessed 2018-11-12.
- Firebase. 2018a. "Firebase Homepage." Accessed 2018-11-01.
- Firebase. 2018b. "Use Cases." Accessed 2018-11-12.
- Firebase. 2018c. "Pricing Plans." Accessed 2018-11-03.
- Firebase. 2018d. "Products." Accessed 2018-11-12.
- Firebase. 2021. "Firebase Extensions." Accessed 2021-08-26.
- Firebase Docs. 2018a. "Firebase Cloud Messaging." Firebase, November 01. Accessed 2018-11-01.
- Firebase Docs. 2018c. "About Firebase Cloud Messaging server." Firebase, November 08. Accessed 2018-11-12.
- Firebase Docs. 2018d. "Firebase Hosting." Firebase, October 26. Accessed 2018-11-12.
- Firebase YouTube. 2016. "Introducing Firebase Hosting." YouTube, May 18. Accessed 2018-11-12.
- FirebaseExtended GitHub. 2021. " FirebaseExtended/experimental-extensions." FirebaseExtended, on GitHub, July 8. Accessed 2021-08-26.
- Google Developers. 2018. "Migrate a GCM Client App for Android to Firebase Cloud Messaging." Cloud Messaging, Google, September 06. Accessed 2018-11-03.
- H Fatima. 2017. "Why is Firebase the best Mobile Backend-as-a-Service." Blog, Reseller Club, December 12. Accessed 2018-11-03.
- Jamin, Baptiste. 2016. "Reasons Not To Use Firebase." Blog, Crisp Insights, September 18. Accessed 2018-11-12.
- Kudlack, Chris. 2018. "Android UI Testing with Firebase." Tura Engineering, Medium, April 18. Accessed 2018-11-12.
- Lardinois, Frederic. 2016. "Google turns Firebase into its unified platform for mobile developers." TechCrunch, May 18. Accessed 2018-11-12.
- Lim, Brendan. 2017. "Introducing Cloud Functions for Firebase." The Firebase Blog, March 9. Accessed 2021-08-26.
- Ma, Francis. 2018a. "What's new in Firebase at I/O 2018." The Firebase Blog, May 08. Accessed 2018-11-12.
- Ma, Francis. 2018b. "What's new at Firebase Summit 2018." Firebase, Google Blog, October 29. Accessed 2018-11-12.
- Martin, Patrick. 2019. "Firebase Hosting for Cloud Run." The Firebase Blog, April 11. Accessed 2021-08-26.
- Narayanan, Anant. 2013. " Where does Firebase fit in your app?" The Firebase Blog, March 25. Accessed 2021-08-26.
- O'Leary, Brendan. 2020. "How to leverage GitLab CI/CD for Google Firebase." Blog, GitLab, Mar 16. Accessed 2021-08-26.
- Rajat S. 2017. "Introduction to Firebase." GeekyAnts on Hacker Noon, December 28. Accessed 2018-11-12.
- Rouse, Alex. 2016. "Firebase: The Good, Bad, and the Ugly." Raizlabs, December 01. Accessed 2018-11-12.
- Ruffrey. 2018. "Firebase Pros and Cons for a SaaS Company." Symbolic Logic, April 06. Accessed 2018-11-12.
- Sevilleja, Chris. 2016. "A Look at the New Firebase: A Powerful Google Platform." Scotch, May 23. Accessed 2018-11-12.
- Toombs, Cody. 2019. "Google Firebase announces Extensions, App Distribution for iOS and Android, and web app analytics." Android Police, September 27. Accessed 2021-08-26.
- devangj9689. 2020. "Firebase – Introduction." GeeksforGeeks, November 11. Updated 2021-07-15. Accessed 2021-08-26.
Further Reading
- Rajat S. 2017. "Introduction to Firebase." GeekyAnts on Hacker Noon, December 28. Accessed 2018-11-12.
- Ruffrey. 2018. "Firebase Pros and Cons for a SaaS Company." Symbolic Logic, April 06. Accessed 2018-11-12.
- FriendlyPix: a cross-platform Firebase example app
- The Firebase Blog
- Senior, Ngenge. 2018. "Database Structure of One to One Chat App With Firebase." Medium, September 07. Accessed 2018-11-12.