Hey there, everyone.
How are you doing?
This write-up is a comprehensive insight into Firebase. A one-stop solution for mobile developers, offering every service required when writing a mobile app. Right from writing code, to testing, to production monitoring & quality maintenance.
Cool stuff isn’t it?
I bumped into Firebase while searching for a quicker way of writing & deploying mobile apps. If you are a mobile developer, professionally or even a hobbyist. Chances are you have already read something about it in the past.
Anyway, it doesn’t matter even if you haven’t. We will find out everything about it in this article.
Hmm… So, without any further ado. Let’s get on with it.
1. What is Firebase & What is it Used For?
Firebase is a suite of services ideally required when writing a mobile app, for instance, running analytics, integrating messaging into the app, having access to a fast real-time database for storage,
gaining an insight into crash reporting etc. These are just a few of so many features out there offered by Firebase.
The availability of all the services at one place enables the developer to focus on the business logic of the app rather than wasting time in scouting for third-party services in the market, checking for compatibilities & plumbing them together. With Firebase all we need to do is focus on user functionality instead of worrying about the infrastructure.
Firebase is a comprehensive mobile development platform offered by Google & backed by Google Cloud platform.
What does backed by Google Cloud Platform mean?
Besides the features offered by Firebase, developers can leverage the services & computing resources offered by the Google Cloud Platform too. Such as BigQuery etc.
Also, Firebase is built on Google infrastructure, which helped Pokemon Go scale to the moon. So, naturally, we can assume there would be no issues with scalability when our business explodes in future.
2. Features Offered by Firebase
Firebase supports many platforms, for instance, IOS, Android, Web, Unity for the mobile apps to run on. The integration is really easy & smooth with these platforms. Besides platforms, it also supports several programming languages such as C++, Java etc.
Firebase provides a gamut of features to the developers such as:
For App Development
Cloud firestore, ML Kit, Cloud functions, Authentication, Hosting, Cloud Storage, Real-time Database, In-App Messaging, Dynamic links, Cloud Messaging, Predictions, Remote Config, App Indexing etc.
Test lab, A/B testing
Monitoring & Analytics
Crash analytics, performance monitoring, Google Analytics.
Google ads, Ad Mob, Google marketing platform, Play store, Slack etc.
Fellas, this was the gist of the features offered by Firebase. Let’s have a quick insight into some of the important terms. What do they really mean?
Cloud Firestore – This is a scalable NoSQL database offered from Firebase. It helps in maintaining a consistent user state across several devices. It also offers offline support for apps in case of any network latency issues.
ML Kit – Firebase ML Kit enables the developers to use Machine Learning in their apps to solve the real world problems. Devs can implement machine learning features via APIs with just a few lines of code.
Cloud Functions – These help run backend code in response to events triggered by Firebase or HTTP Requests.
Authentication – Firebase manages the entire user authentication flow. No need for developers to write authentication & security code from scratch.
Hosting – With simple commands, it’s really easy to deploy your app on Firebase cloud. It provides production grade hosting for developers.
Cloud Storage – Storage is available to developers who intend to store massive amounts of user-generated content in their apps for instance pictures & videos.
Real-Time Database – This is the original database of Firebase. It facilitates the synchronization of user data across devices. I’ve talked about the difference between Real Time Database & Cloud Firestore further down in the article.
Cloud Messaging – This is a cross-platform messaging solution. Enabling the developers to send messages & notifications in their system.
Remote Config – This is one of the most unique features of Firebase. Remote config enables the developers to change the appearance & behaviour of the app without requiring the users to download an update. Pretty Cool Huh?
Test Lab – Test lab helps the team test their app across several devices & device configurations. And analyse the logs, videos & screenshots in the Firebase console.
Dynamic Links – I’ve talked about this in depth in the below use case section. Users can create dynamic links with custom payload providing a new user with a richer on-boarding experience.
3. Firebase Use Cases
3.1 Creating A Custom Onboarding Experience for the User
Firebase enables the developers to programmatically create dynamic links with custom parameters. Creating a tailored, custom onboarding UI for the user when he navigates to the app by clicking on the custom link.
Needless to say, everyone prefers a tailored custom UI thus potentially increasing the retention rate of your app.
With Firebase Invites, end users can also create invite links with custom payload to share with their friends on the web.
With Open Authorization OAuth feature, users can sign in to your app via Facebook, Twitter, GitHub or Google. This cuts down the hassle of manually inputting user details in the signup form. Eventually improving the user on-boarding rate by notches.
Via Google Analytics every step of the onboarding process can be tracked to see where the users are dropping off.
3.2 Rolling Out New Features Progressively
With the help of Google Analytics & Remote Config for Firebase. Dev teams can roll out new features to a limited group of users. Get user feedback, run a thorough testing & when everything is fine. Roll out the features on a larger scale.
3.3 Manage User Activity Across Several Devices
We often or always use the same app via mobile, desktop & tabs. Firebase facilitates a smooth management of user sessions & user activity across several devices.
With Firebase developers can maintain the same user state irrespective of the number of devices a user logs in the app from.
3.4 Manage Third Party Payments Without Setting Up Our Own Servers
To enable in-app purchases. Firebase helps developers streamline the third-party payment API integration process. Without any need for setting up & managing our own servers to run the payment feature.
3.5 Displaying Related Ads as Per the User Behaviour
With the help of Google Analytics. Dev Teams can monitor the user behaviour & accordingly display related ads in their apps.
These are some of the use cases in mobile app development where Firebase really stands out.
Let’s move on to the design & architecture. And understand how Firebase fits into our app, be it new or existing.
4. Firebase Architecture
There are primarily 3 ways or shall I say architectural patterns in which our app integrates with Firebase.
4.1 App solely runs on Firebase. No backend server
In this pattern, our app solely, cent per cent runs on Firebase. There is no backend server. Firebase takes care of all the backend functionalities.
When is this type of pattern suitable?
- When we intend to write a separate, dedicated mobile app without any integration with any of the existing enterprise systems.
- When writing a new app from scratch
- The app doesn’t require any heavy backend computations.
In this scenario, the app would have static data which would sit on the client. I can also call it a Thick Client. The dynamic is data is exchanged to & fro from Firebase.
4.2 App runs on Firebase. But also requires a backend server
In this scenario, besides leveraging the features offered by Firebase. The mobile app also needs to run some custom backend logic.
In this kind of architecture, all the data between the client & the backend server goes through Firebase. This design is ideally suitable when the app needs to run a computational heavy task or needs to integrate with a third party API & run some business logic on the backend.
Using Google App Engine with Firebase would be ideal in this kind of scenario.
4.3 App runs on Firebase in conjunction with a backend server
In this type of architecture, the client communicates with both Firebase & the backend server separately. This design is useful when the app is an already existing enterprise app & needs to leverage the state of the art Firebase features. Twitch.TV is an ideal example of this.
Alright, now with the use cases, architecture & Firebase features sorted out. I will answer some of the most common questions on Firebase I’ve come across on the web.
5. Frequently Asked Questions on Firebase Answered
5.1 When to use Firebase?
Consider using Firebase when you intend to write a mobile app from scratch dedicatedly for your business. Firebase offers state of the art, out of the box features to quickly write a mobile app & make it production ready in minimum time.
Also, to get more insight into the architecture & how Firebase fits into your app. Consider reading the Firebase Architecture section of this write-up.
5.2 Is Firebase a Database?
Along with other features, Firebase provides a Real-Time Database & a Cloud Firestore. Both are No-SQL scalable databases to store data. So, Firebase is not just a database, it’s an entire suite of services for writing a mobile app.
5.3 What is the difference between Firebase Real-Time Database & Cloud Firestore?
The real-time database is Firebase’s original database. It’s a really efficient solution to store data in real time & sync client’s state across several devices.
Whereas Cloud Firestore is the Firebase’s new flagship database with a more intuitive data model. It facilitates faster query execution & scales better in comparison to the Real-Time Database.
5.4 Is Firebase SQL or NoSQL?
Firebase offers NoSQL based storage solutions, a Real-Time Database & a Cloud Firestore. It does not offer any SQL solution in my knowledge.
5.5 How is Firebase related to Mongo DB since it also NoSQL?
Firebase & Mongo DB both offer fast NoSQL document-oriented object stores. But they are both separate products & have no relation. Firebase is specifically built for mobile whereas MongoDB can also be used for enterprise apps.
5.6 Does Firebase use WebSockets?
Yes, Firebase uses WebSockets to push data from the server to the clients. It reverts to long polling if the browser doesn’t support Web Sockets.
5.7 Is Firebase free?
Firebase does have a free tier upto a certain limit. It has a free plan called spark for hobbyist devs. You can build your app test out the waters & when it starts gaining traction you can pay for the computing resources.
It also has a pricing calculator. Calculate the price as per your requirements.
Please visit the pricing page for further details.
5.8 Which apps use Firebase?
According to the Firebase website. It is implemented by Trivago, Lyft, Newyork Times, The Economist etc.
5.9 What is the difference between Google App Engine & Firebase?
With Firebase there is not much of a backend logic. It’s primarily focussed towards mobile developments whereas the Google App Engine is an enterprise app server capable of running industry frameworks like Spring.
Firebase sort of does everything for you. It’s a move ASAP to production kind of thing.
It more like just a dedicated mobile app without any massive enterprise infrastructure on the backend.
Firebase is heavy on the client code. Whereas the entire business logic is abstracted away on the server with Google App Engine.
5.10 What is the difference between Google Cloud Platform & Firebase?
We can always use the features of GCP with Firebase. Firebase is built on Google Cloud Platform.
So the underlying infrastructure of Firebase is GCP.
Firebase is used by client-side app devs both web and mobile. GCP is preferred by server-side devs. It’s the core backend infrastructure. A suite of cloud computing services like computation, storage, ML and so on.
Also, Firebase cannot run heavy computational tasks by itself. It relies on the Google cloud platform for that.
6. My Experience with Firebase
I recently published an app on Android with Firebase. I am more of a backend developer, with not much experience with mobile development.
I needed to write a mobile app & was looking for something simple, intuitive & powerful at the same time.
Though, I did had some experience with building apps with Google App Engine in the past.
I wrote the app solely on Firebase without any backend server. It was a fun experience building it. There is almost no learning curve. A simple app can be deployed in a few days. Almost over a weekend.
Besides, I really felt it’s a complete solution in a true sense. You’ve always got Google’s Computing platform if you need to run any of the heavy computational tasks.
The best thing I liked about Firebase, App Engine & Google Cloud or be it any product is its free tier.
You really don’t have to worry about the pricing stuff in the initial days of your business.
Pay only when your business starts gaining training. To me, that’s a hell of a thing.
So, if you are a solo developer with Google Cloud you can always bring your idea to reality & show it to the world.
Being a comprehensive suite of services, generally, you do not have to look for any other tool outside of the Google infrastructure. Until & unless you have a very specific or a unique requirement.
Deploy your app to the cloud. Show it to the community. Get feedback.
Pitch it to the potential investors without paying a dime.
Once you get the green light from them or plan to break your piggy bank, to build it further to a full-fledged thing. Google’s infrastructure has got your back. Well, what more can I say?
It’s a like dedicated infrastructure team works with you. No worries about the deployment & infrastructural stuff. Just build your app focus on the unique features & deploy it instantly with simple commands.
More on the Blog
Guys, I think this is pretty much it on Firebase. If you think I missed anything do let me know in the comments.
Also, I would love to know your views on this.
If you enjoyed reading the article, do share it with your geek friends.
See you in the next article.
- Best Handpicked Resources To Learn Software Architecture & System Design
- Platforms & Resources Worth Checking Out That Give You A Push Ahead In Your Software Career
- YouTube Architecture – How Does It Serve High-Quality Videos With Low Latency
- Full List Of Articles In The Decentralized Web Category
- Full List Of Articles In The Software Engineering Category