Firebase

Firebase replaces traditional server-side infrastructure. Source: devangj9689 2020.
Firebase replaces traditional server-side infrastructure. Source: devangj9689 2020.

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?
    An overview of Firebase products. Source: Sevilleja 2016.
    An overview of Firebase products. Source: Sevilleja 2016.

    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?
    Firebase web hosting. Source: Firebase YouTube 2016.

    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?
    Three possible deployment architectures with Firebase. Source: Narayanan 2013.
    Three possible deployment architectures with Firebase. Source: Narayanan 2013.

    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)?
    Components of Firebase Cloud Messaging. Source: Firebase Docs 2018a.
    Components of Firebase Cloud Messaging. Source: Firebase Docs 2018a.

    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

Sep
2011

Firebase starts as a startup named Envolve, founded by James Tamplin and Andrew Lee. It provides developers an API to integrate online chat functionality into their websites.

Apr
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.

Oct
2014

Google acquires Firebase. In following years, other Google acquisitions of Fabric/Crashlytics, Divshot, and LaunchKit add value to Firebase portfolio of products.

May
2016

Google announces Firebase at Google I/O as a unified platform for mobile developers. Firebase now integrates deeply with some of Google cloud tools. The user base of Firebase is now 470,000, up from about 110,000 when Google acquired it.

Mar
2017
Firebase Hosting redirects configured URLs to Cloud Functions. Source: O'Leary 2020.
Firebase Hosting redirects configured URLs to Cloud Functions. Source: O'Leary 2020.

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.

Oct
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.

May
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.

Oct
2018

It's reported that over 1.5 million apps are using Firebase every month. India's Hotstar entertainment app is a Firebase-based app with over 150 million monthly active users.

Apr
2019

Firebase announces integration with Google's Cloud Run service. Whereas Cloud Functions is limited to Node.js backend, Cloud Run enables developers write server-side functionality in any language. This requires a docker image that can respond to HTTP requests on the configured port.

Sep
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

  • // Example showing how to use Firebase in a Node.js application
    // Source: https://firebase.google.com/docs/web/setup
     
    // Install Firebase module by running: npm install firebase --save
     
    var firebase = require("firebase");
     
    // Initialize Firebase
    // TODO: Replace with your project's customized code snippet
    var config = {
      apiKey: "<API_KEY>",
      authDomain: "<PROJECT_ID>.firebaseapp.com",
      databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
      storageBucket: "<BUCKET>.appspot.com",
    };
    firebase.initializeApp(config);
     

References

  1. Anastasyev, Dmytro. 2016. "Firebase Framework Review." MLSDev, October 16. Accessed 2018-11-12.
  2. Bover, Pier. 2017. "Firebase: the great, the meh, and the ugly." freeCodeCamp, January 13. Accessed 2018-11-12.
  3. Crunchbase. 2018. "Firebase." Accessed 2018-11-03.
  4. Dufetel, Alex. 2017. "Introducing Cloud Firestore: Our New Document Database for Apps." The Firebase Blog, October 03. Accessed 2018-11-12.
  5. Firebase. 2018a. "Firebase Homepage." Accessed 2018-11-01.
  6. Firebase. 2018b. "Use Cases." Accessed 2018-11-12.
  7. Firebase. 2018c. "Pricing Plans." Accessed 2018-11-03.
  8. Firebase. 2018d. "Products." Accessed 2018-11-12.
  9. Firebase. 2021. "Firebase Extensions." Accessed 2021-08-26.
  10. Firebase Docs. 2018a. "Firebase Cloud Messaging." Firebase, November 01. Accessed 2018-11-01.
  11. Firebase Docs. 2018c. "About Firebase Cloud Messaging server." Firebase, November 08. Accessed 2018-11-12.
  12. Firebase Docs. 2018d. "Firebase Hosting." Firebase, October 26. Accessed 2018-11-12.
  13. Firebase YouTube. 2016. "Introducing Firebase Hosting." YouTube, May 18. Accessed 2018-11-12.
  14. FirebaseExtended GitHub. 2021. " FirebaseExtended/experimental-extensions." FirebaseExtended, on GitHub, July 8. Accessed 2021-08-26.
  15. Google Developers. 2018. "Migrate a GCM Client App for Android to Firebase Cloud Messaging." Cloud Messaging, Google, September 06. Accessed 2018-11-03.
  16. H Fatima. 2017. "Why is Firebase the best Mobile Backend-as-a-Service." Blog, Reseller Club, December 12. Accessed 2018-11-03.
  17. Jamin, Baptiste. 2016. "Reasons Not To Use Firebase." Blog, Crisp Insights, September 18. Accessed 2018-11-12.
  18. Kudlack, Chris. 2018. "Android UI Testing with Firebase." Tura Engineering, Medium, April 18. Accessed 2018-11-12.
  19. Lardinois, Frederic. 2016. "Google turns Firebase into its unified platform for mobile developers." TechCrunch, May 18. Accessed 2018-11-12.
  20. Lim, Brendan. 2017. "Introducing Cloud Functions for Firebase." The Firebase Blog, March 9. Accessed 2021-08-26.
  21. Ma, Francis. 2018a. "What's new in Firebase at I/O 2018." The Firebase Blog, May 08. Accessed 2018-11-12.
  22. Ma, Francis. 2018b. "What's new at Firebase Summit 2018." Firebase, Google Blog, October 29. Accessed 2018-11-12.
  23. Martin, Patrick. 2019. "Firebase Hosting for Cloud Run." The Firebase Blog, April 11. Accessed 2021-08-26.
  24. Narayanan, Anant. 2013. " Where does Firebase fit in your app?" The Firebase Blog, March 25. Accessed 2021-08-26.
  25. O'Leary, Brendan. 2020. "How to leverage GitLab CI/CD for Google Firebase." Blog, GitLab, Mar 16. Accessed 2021-08-26.
  26. Rajat S. 2017. "Introduction to Firebase." GeekyAnts on Hacker Noon, December 28. Accessed 2018-11-12.
  27. Rouse, Alex. 2016. "Firebase: The Good, Bad, and the Ugly." Raizlabs, December 01. Accessed 2018-11-12.
  28. Ruffrey. 2018. "Firebase Pros and Cons for a SaaS Company." Symbolic Logic, April 06. Accessed 2018-11-12.
  29. Sevilleja, Chris. 2016. "A Look at the New Firebase: A Powerful Google Platform." Scotch, May 23. Accessed 2018-11-12.
  30. 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.
  31. devangj9689. 2020. "Firebase – Introduction." GeeksforGeeks, November 11. Updated 2021-07-15. Accessed 2021-08-26.

Further Reading

  1. Rajat S. 2017. "Introduction to Firebase." GeekyAnts on Hacker Noon, December 28. Accessed 2018-11-12.
  2. Ruffrey. 2018. "Firebase Pros and Cons for a SaaS Company." Symbolic Logic, April 06. Accessed 2018-11-12.
  3. FriendlyPix: a cross-platform Firebase example app
  4. The Firebase Blog
  5. Senior, Ngenge. 2018. "Database Structure of One to One Chat App With Firebase." Medium, September 07. Accessed 2018-11-12.

Article Stats

Author-wise Stats for Article Edits

Author
No. of Edits
No. of Chats
DevCoins
6
1
1338
31
0
626
2
0
15
1592
Words
4
Likes
12K
Hits

Cite As

Devopedia. 2021. "Firebase." Version 39, August 26. Accessed 2023-11-12. https://devopedia.org/firebase
Contributed by
3 authors


Last updated on
2021-08-26 12:05:53

Improve this article
  • Backend-as-a-Service
  • Firebase Performance
  • Cloud Firestore
  • Serverless Architecture
  • Real-Time Apps
  • Parse Platform

Article Warnings

  • In References, replace these sub-standard sources: geeksforgeeks.org