What is Firebase? Want to know the 15 reasons? Keep reading.
Contemporary, a bunch of clouds (server-side) technologies exists created by many companies, offering their services and easing the work of developers.
The best part?
You no longer need to write all the server-side code if you just want to implement the sign-in/sign-up feature saving a ton of time, moreover, it is not just limited to sign-in/sign-up only.
Server-side technologies nowadays can handle pretty much as long as it is concerned with the cloud, like saving/reading the files, data-security, building a huge database, sending push notifications, as I said, pretty much everything, you just name it.
Many companies but here, today, we will explore only one of them. Which is no other than Firebase by Google itself!
- 1 What is Firebase?
- 1.1 1. Development Products
- 1.2 2. Improvements Products
- 1.3 3. Grow Products
What is Firebase?
Firebase is a mobile and web application development platform developed by Firebase, Inc in 2011. Later, it was acquired by Google in 2014.
More technically, Firebase is a BAAS short for Backend-as-a-service which helps you to build better apps, websites or games regardless of server-side coding, API or backend data storage.
Firebase offers a handful of products, which can significantly reduce the amount of time you write code.
We can split its product into 3 categories:
- Development products
- Improvement products
- Grow products
Now, we will jump into each category and will give you the know-how of each product. We will not be covering the topics which are in the beta state.
1. Development Products
Developments products offer a great help while your product is in the development phase when I say your product it could be anything you are working on and it concerns with Firebase: it could be a mobile app, a web app, an IoT project, anything.
So the development products by Firebase are as below:
a) Firebase Database
Firebase Database is quite a confusing thing for beginners. If you go to the Firebase Console, open any project and open the Database section from the left sidebar then there would be two options waiting for you.
- Firebase Realtime Database
- Firebase Cloud Firestore
Let’s explore each of these in detail but keep in mind that both of these are non-SQL and realtime databases.
First I wanna make you clear about what is a Real-time Database. You can read the nerdy definition here on Wikipedia about the real-time database, but long story short:
It is a database, where we don’t need to request the data, the server provides it in realtime.
In fact, the Realtime Database is the Firebase’s first and original cloud-based database. For the mobile apps requiring synced states across clients in realtime, it is an efficient and low-latency solution.
Let me make it more understandable with an example.
Suppose you are going to develop a chat app, where a user can sign-in and chat with their friends. The sign-in part can easily be handled by Firebase Authentication (later described in this article).
But for sending and receiving messages, we need a database, except apart from Firebase there are thousands of online databases out there but most of them don’t provide the functionality of Real-Time.
And, of course, without a real-time database, we need to hit the refresh button to check if there is any other message or not, and I think it is scary, isn’t?
b) Firebase Real-time Database
Real-time Database is the way of the future, now most of the servers need HTTP requests to read or write data where most database gives data only when you ask them.
But when you are connecting your app to the Firebase Real-time database, you are not connecting through normal HTTP but through Web Sockets which are a lot faster than HTTP.
Data is stored in JSON and synchronized in realtime to every connected client.
Here comes the more advantage of Real-time Database:
- It automatically calls a function when some change is happening in the database, and through that function, we can easily create a notification to inform the user about the new message.
- You don’t need to restart your app or push a button to check if there is any change in the database. It can be a lot more helpful for Apps and especially Games.
We do that using Firebase Cloud Functions that we will be learning too in this tutorial.
Real-time Database works very fine even when there is no internet connection, it persists your data to disk. And once, the connectivity is back the client device receives any changes it missed.
Real-time Database supports iOS, Android, Web, C++, and unity
c) Firebase Cloud Firestore
Cloud Firestore —which was released way after the Firebase Realtime Database — is the new flagship database for mobile apps.
It is faster, richer and more scalable than the realtime database.
Cloud Firestores uses documents and collections to store data.
Documents will also frequently be pointed to subcollections, which contain other documents, which themselves can contain other documents, so on and on.
And this document-based database makes it faster while performing a search since you can request the document without grabbing all the data underneath.
The other difference between both of these databases is their pricing model.
Realtime Database charges on the base of storage or network bandwidth where Cloud Firestore charges you on the base of operations performed.
Which one is best for you? That depends on your app.
Like if you are developing a news app, the turn-based multiplayer game then Cloud Firestore would be the best option for you from Pricing point of view but if you are developing an app which sends multiple updates to multiple users in a fraction of second then Firebase Realtime Database is the thing for you.
Cloud Firestore supports iOS, Android, and Web
d) Firebase Cloud Storage
Well, there is a difference between Storage and Database.
You can find a lot of fancy differences between them but the main thing is the Database. It is more organized and we can perform queries on them while Storage is not organized and we can not perform queries on them.
The thing we discussed above deals with Database, that’s why it’s called Firebase Database, where the Firebase Cloud Storage deals with Storage as the name suggests.
Now that difference is clear so we can move on now.
You know storage is a necessity, even an app with just registration feature have to store at least the profile picture of the user. So that simple app does need some server to save the picture and retrieve upon request. And that’s exactly what Firebase Cloud Storage does.
Firebase Cloud Storage provides the easiest way to save binary files – most often images but you can save anything like a video, pdf, etc. – to Google Cloud Storage directly from the client.
Cloud Storage supports iOS, Android, Web, C++, and unity.
e) Firebase Cloud Functions
There comes a need when you want to do a certain task on the base of some change. Like in the chat app, we want to notify the user when someone sent a message. If I make it more technical then, we need to notify the user when there is some change in the database did by some other user.
That’s where Firebase Cloud Functions play their roles. You need to write code that you want to be executed when a specific change happens. Your code is stored in Google’s cloud and runs in a managed environment. There’s no need to manage and scale your own servers
The code is written in Node.js language. And can be triggered by other Firebase and Google Cloud features like
Cloud Firestore triggers: which can help you to trigger the function on the base of following events
|onCreate||Triggered when a document is written to for the first time.|
|onUpdate||Triggered when a document already exists and has any value changed.|
|onDelete||Triggered when a document with data is deleted.|
|onWrite||Triggered when onCreate, onUpdate or onDelete is triggered.|
Realtime Database Triggers: This also provides almost the same events as Cloud Firestore triggers, to trigger function.
There are many more triggers like:
- Remote Config Triggers
- Firebase Test Lab Triggers
- Firebase Authentication Triggers
- Google Analytics Triggers
- Crashlytics Triggers
- Cloud Storage Triggers
- Cloud Pub/Sub Triggers
- HTTP Triggers
f) Firebase Authentication
In our chat app, we need to know the identity of the user, which allows us to save the user chat and the same personalized experience across all the devices.
Firebase Authentication provides the best back-end service. You can authenticate the user by integrating Federated Identity Providers. Firebase Authentication SDK’s provide multiple options for sign-in like sign in with Google, Facebook, Twitter, GitHub, Phone Number or Email address.
Not only this but it handles everything that is required for Sign Up like email/phone number verification and even the password reset process.
Everyone wants to provide rich user experience, but to provide smooth UX as well as solving all the backend problems could be a lot of work.
Luckily FirebaseUI makes all of these really easy. You can use this open-source library to provide a rich user experience. FirebaseUI provides a drop-in auth solution that handles the UI flows for signing in users with email addresses and passwords, phone numbers, and with popular federated identity providers, including Google Sign-In and Facebook Login.
Firebase Authentication supports iOS, Android, Web, C++, and unity
g) Firebase Hosting
Firebase Hosting — as the name suggests — provides hosting for web either you are building a simple landing page for your app or you are going to develop a very complex Progressive Web App (PWA), it can help you in both.
The special thing is, you can use Cloud Functions for Firebase or Cloud Run to serve dynamic content and host microservices on your sites.
2. Improvements Products
Now that you have successfully developed your product using Firebase amazing features, now is the time to improve your product, otherwise, your product may become outdated over time.
So, speaking of improvements, Firebase is there for you as well. There are a few products that can save you a lot.
Whenever an app is crashed, it invites your users to rate the app poorly or uninstall it. Even after testing your app multiple times, it’s quite possible that it can get crashed or stop responding to several devices depending on different factors.
To avoid that situation, we can use Firebase Crashlytics. It is quite easy to implement and tries to show the crashes of your app in Firebase Console as soon as possible. So that you can get rid of the crash before it hit a large number of users.
Crashlytics can intelligently group the crashes and highlight the circumstances.
Crashlytics supports Android, iOS, and Unity only.
b) Performance Monitoring
After your product is deployed, it’s very crucial to check its performance. Not only it will help you to remove the bugs but it will also be very useful when you are making a decision regarding your product.
Firebase Performance Monitoring is services that can help you get detailed insights into your iOS, Android or Web app. You implement the performance monitoring SDK and the reports will be available on Firebase Console.
There are three types of traces that performance monitor SDK monitor for you before I explain those first understand what is a trace?
A trace is a report of performance data measured between two points in time in your app.
Now the three types of traces are as below:
i) Automatic duration traces
Performance monitor automatically includes several default duration traces
For native apps (Android, iOS) it includes
- App Start traces – measure the time between when the user opens the app and when it becomes responsive
- Foreground and Background traces: shows how your app performs when in foreground and background
For web apps, the automatic duration trace is page load, which breaks down into the following metrics:
- first paint and first contentful paint — measure when the browser starts to render your app versus when the user first sees actual content on the page
ii) Custom traces
In Custom traces, you define the start and end of the trace and then the task performed within that scope will be monitored. Moreover, you can also configure a custom trace to record custom metrics.
iii) HTTP/S Network Request Traces
HTTP/S Network Request Traces are helpful to monitor the network-related tasks. An HTTP/S Network Request Trace is a report that captures the time between when your app issues a request and when that requested is completed
c) Test Lab
As we all know that Android is an open-source Operating System, which means that anyone can use or modify it, so a mobile company only needs to create hardware, inject the Android and device is ready.
There are many mobile manufacturing companies out there, creating a variety of mobiles – different sizes and specs – all running Android.
So as an Android Developer, you have to provide a great user experience across all those Android Devices. It could be hard to test your app on all android versions and screen-sized Android Devices. Here Firebase Test Lab comes into action.
Firebase Test Lab lets you test your Android app on Real Android Devices hosted in a Google Data Center.
Test Lab helps you to find issues that only occur on specific device configurations (for example, a Nexus 5 running a specific Android API level and specific locale settings). You can run the Robo Test, Instrumentation Test or a Game Loop.
They are all different types of tests that are more than enough to get the results. At the end of the test, Firebase Test labs provide you LOGS, Screenshots, Activity Map, Video, and Performance report. It can help you a lot to understand the workflow of your app across different Android devices.
Firebase Test Labs supports Android only because only Android Contains a large variety of devices and I think it is logical.
3. Grow Products
Now comes my favorite pack of Firebase Products. Grow products are more intended for the growth of the product. It can help you perform A/B Testing, engage with users, check insights and much more. Let’s jump into it.
a) Google Analytics
This is my most favorite product. Not only because it is easy to implement, but also because it’s free. Moreover, it helps you to understand how people use your product. So that you can make an informed decision when marketing your product.
It automatically captures a number of events and user properties and also allows you to create custom events.
The captured data then becomes available to the Firebase Console dashboard. This dashboard provides detailed insights about your data — from summary data such as active users and demographics to more detailed data such as identifying your most purchased items
It is highly compatible with other Firebase Services like it automatically logs the corresponding event when a notification is opened which was sent using Firebase Cloud Messaging.
Predictions a little new to the Firebase Products list but it could be very helpful. It just reads the analytical data of your app, applies machine learning to it and then creates dynamic user segments based on your users’ predicted behavior.
These predictions are automatically available for use with Firebase Remote Config, the Notifications composer, Firebase In-App Messaging, and A/B Testing.
Like it can create a segment of users which are more likely to perform certain In-App purchase in your app, and make it available to Firebase Remote Config, which then you can use to provide discounts or encourage them to perform the In-App Purchase
c) Cloud Messaging
Notifications are a great way to grab the attention of your dormant users, they help us re-engage the user and increases the chance of using the app. That’s why Google-branded it is a Grow Product.
Firebase Cloud Messaging or often known is FCM is a perfect messaging solution. You can send push notification using FCM. Push notification is some simple messages that appear with a notification in the notification tray or like a popup messaging – depends on the platform. Push Notifications are usually pushed from some backend server like Firebase in this case. It is the way to deliver users a messaging without opening the app. It is a highly effective tool for developers and advertisers to re-target/re-engage your dormant users.
Firebase Cloud allows two types of push notifications to be sent
- Notification Messages: handled by FCM SDK
- Data Messages: handled by the client application
I already explained in detail about how you can send push notification on android
d) Remote Config
Probably the best free tool out there for executing A/B Testing. You can change the behavior and appearance of your app for an unlimited number of devices. You can target the user based on the platform, device language, country/region and much more.
For example, if you want to show a greeting message to the users of India for their local event then you can do that easily by using Remote Config.