When you should and shouldn't use firebase

Firebase

Firebase is a set of tools offered by Google to build excellent scalable applications in the cloud. It is a powerful service that helps in building applications quickly without reinventing the components or modules. Services like analytics, authentication, databases, configuration, file storage, push messaging are provided by firebase thereby making it easy for the developers to focus on the user experience of the application.

Many times, we receive queries to develop the application using firebase, but then we do a complete analysis of the requirement and suggest them the correct solution. The overall objective of the blog is to advise people on when they can choose firebase for their app and when it’s not a good choice to use it.

Key interesting features and benefits of Firebase

  • Authentication

    Firebase Auth product provides various methods to authenticate that includes email and password. Additionally, more methods are available to authenticate 3rd party providers like Google. You can either create your own interface or use the open source customizable user interface. Firebase offers easy to use SDK and ready-made UI libraries to authenticate the apps.

  • Real time database

    This feature ensures that the data between the users are stored and synchronized in real time with the help of the NoSQL database. When you want the app data to remain available even if the app goes offline, firebase will be the right choice. It updates the data syncs in just a few milliseconds. Firebase for mobile app development is scalable and accessible from client devices.

  • Dynamic links

    With dynamic links, firebase ensures a customized user experience for your application across all the platforms. You can use dynamic links to drive the native app conversions. The user opening the dynamic link will be prompted to install the app in case the application is not already installed. By this, many people can install your application easily.

  • Cloud Messaging

    The firebase cloud messaging (FCM) allows you in delivering the push messages to indicate something of interest to the users of your app. You can send a message through two easy ways. First, you can write code on the backend to ping your app every time something gets updated, for example, direct users notifications. Another option is, you can compose a message with the help of firebase console to ping users with information of interest. This is direct user notification which is commonly used.

    It is always better to send a message to members of analytics audience. This helps you in targeting users with information which interest them instead of blasting irrelevant messages to everyone.

  • Automatic Scaling

    Firebase is built for performance and scalability. As and when there is a change in data, Firebase helps in the calculation of the minimum set of updates needed to keep all your clients synchronized. Additionally, the API functions of firebase are designed in order to scale linearly with the size of data being synchronized. It handles the scaling operations. Your application will scale from its first user to its first million user without any change in the code.

When to prefer firebase as your backend service

  • When your intended application has preferences that need to be shared across multiple clients, opt for firebase. To implement functionalities like recent search history, recently viewed items, firebase would be the best option. This is possible since firebase is just a bucket of data that can be easily allocated for each user.

  • Queries with limited sorting and filtering functionality can be performed with the firebase database. Cloud firestore assures automatic scaling and can handle 1 million concurrent connections and 10,000 writes/second. If your application’s scalability and concurrency level fall within this category, you can opt for the cloud firestore.
  • When your applications require a minimal level of integration with legacy systems or third-party services, firebase will be the right choice. Firebase also becomes an ideal choice when your application does not require heavy data processing or any form of complex user authentication requirements.

  • Firebase is a good choice if you plan to either write a brand-new application or rewrite an existing one from scratch. Additionally, firebase helps in the easy storing and retrieval of dynamic content. If you decide to develop the application without any form of custom coding the backend, firebase makes this easy. For example, the chat app or a video conferencing application where the backend is not required in managing the things.

  • When you want to add the real-time features without touching the other parts of the code, firebase will be the right choice. In this type of architecture, the firebase sits with the already existing server. Your clients can be connected to the server as well as the firebase to power the real time features without the interference with the other parts of the application. With the help of this, you can develop a real-time notification system for users, embed a chat system in your website and create a comment feed that updates in real time. Twitch.tv is one such popular website that uses firebase along with its infrastructure.

  • When you have a short development time it would be best to go with firebase. Firebase helps in creating a prototype in a very short period. It helps to cut down the development time and avoids messing with servers and data storage to a great extent.

  • A big highlight of firebase is that it offers integration to Google Ads, AdMob, the Play Store, Data Studio and the BigQuery. This will eventually help to make your app efficient and with accurate management. Analytics, crashing reports are also provided by the firebase so that the development teams can stay focused on enhancing the user experience.

When not to prefer firebase as your backend service

  • Firebase for android app development completely relies on a flat hierarchy of nested data. Relational queries cannot be dealt with ease using firebase. Additional ways are required to ensure that the data is synchronized whenever any update occurs resulting in high overhead processing time. If your data model needs something more than a single join query, never choose firebase.

  • It is highly suggested not to choose Firebase for android application if your intended operation is to perform deep and complex querying. Queries like reversing the order of elements in a collection cannot be performed with Firebase as the backend.

  • There is a good probability of facing the inconsistency issue when handling complex queries. Though firebase supports offline operations, the concurrency that happens during the period often leads to inconsistencies.

  • When you don’t want to share any of your data to the third party, it is recommended not to opt for the firebase database. Security rules are limited in firebase that makes it very difficult in building enterprise platforms over them.

  • If you intend to integrate your firebase with the microservices, it is recommended not to move ahead with the firebase database. Since it caches data in memory, the process becomes slow and the unused references never get released.

  • Many Business Intelligence tools are not supported by Firebase. This lack of tools makes it very difficult to perform various BI functionalities. The only way to resolve this issue is to use Kafka, but that again will be a big infrastructure to build.

  • Data migration in your application becomes difficult with firebase. It is not like the general SQL database or the object-relational mapping. You will have to use complicated check criteria that might result in performance issues.

Conclusion:

Foremost it is important to understand your application completely and analyze the functionalities required. One should see how much the application needs to be scaled, the type of queries required, the number and frequency of update operations to be performed. Only after an in-depth analysis, one can conclude whether to select firebase as the backend service for their application.