Skip to main content
Software Development

Firebase – A way to develop real time applications quickly

By December 4, 2014No Comments

There is big buzz around Firebase, especially since Google announced that it has acquired Firebase and would be making it a part of Google Cloud Platform.
What is Firebase?
Firebase is a realtime backend for applications. What Dropbox did for files, Firebase does to application data. Applications using Firebase can just use and manipulate data, without having to think about how data would be stored, and synchronized across various instances of the application in real time. There is no need to write server side code, or to deploy a complex server infrastructure to get an app started with Firebase.
Why Firebase?
Syncing data across different devices is a difficult problem to solve. Studies have indicated that companies can spend as much as 70% of their time on solving problems around Sync/Networking rather than spending that time on Business features.
Firebase’s history is based around the same notion. Firebase came from a company named Envolve, where the founders learned how difficult Sync is, more over they found that Envolve (a Chat Server with API) was used by other companies not for chat but more for syncing data like Game data. This is how Firebase came into existence.
How is Firebase used?
Traditional architectures would have a Backend Server cluster which provides a RESTful API and clients connecting to the Backend server via REST calls.
Firebase replaces the traditional backend server.
The Firebase client is added to an application by including the relevant Firebase library (Firebase has libraries for Javascript, JAVA, Android, iOS, and a REST API). Once the Firebase client is added any data structures can be saved to Firebase. This will automagically save data to Firebase backend and synchronize the data across various instance of the application.
As seen from the code snippet, there are no REST API calls to be made, no server side code and changes in data are reflected in real time, without having to reload pages.
The way a simplistic architecture would look like is like the above, where all clients are connected to Firebase, and use Firebase to store and access data in real time.
Things to be aware of
Though Firebase is great tool to quickly build applications without a backend, there are things you need to be aware of before choosing Firebase.

  • Integrations – A backend server would be required to be deployed If an application needs to integrate to
    • Third party services like Email or SMS providers
    • Platforms like SalesForce or Zendesk
    • Integrate with a legacy authentication mechanism
    • Security – A Firebase instance is accessible to anyone who knows the URL. Firebase does provide a robust security mechanism wherein security rules can be set for access rights to data. If these security rules are not set properly, hackers can gain easy access to your data.
    • Data filtering – Firebase is a schemaless datastore. It does not provide a RDBMS like mechanism to construct complex queries to retrieve data.

In a complex scenario a Firebase deployment would look like the diagram below, with realtime components of the application interacting with Firebase, while legacy or components not fitting into the Firebase way of doing things directly communicate with the Application servers.
Firebase in the real world
Consider a scenario where someone is building a product, which would help the organization identify experts in the company around conversations happening in the company. These conversations happen around chat, where certain users are upgraded to expert status which ensures they are invited to future conversations.
One of the important component of this product would indeed be the Chat Server and Syncing of messages across users. Implementing this from scratch, many iterations would have been dedicated for just writing an effective sync engine and deploying to cloud.
Usually writing a chat application involves

  1. Installing a chat server
  2. Code to push messages to the chat server
  3. Code to handle events for new messages

Using Firebase and the excellent AngularFire which provides 3-way data binding, the chat application can be reduced to about 10 lines of code with no worry of maintaining the Chat server.
Firebase enables quick development of a usable product in quick time. This Minimal Viable Product, can be quickly pushed to Beta Customers to test hypothesis, thus significantly reducing time to take the product to market and get feedback.
This article gives an high level overview of Firebase and how it can be used to reduce time to market for startups, and enable adding realtime features to legacy applications.
Get in touch with Synerzip today to talk to our Firebase experts and understand how Firebase can help power your application.