How are we using Firebase in our mobile development?

Firebase is a flexible, scalable Backend-as-a-Service app development platform. It offers a bunch of tools that are very widely used in most of the apps. You can develop the whole fully functioning app without any server-side code. That is very helpful for projects with small budgets or limited resources. It can be a good choice for MVP apps when you need to get quick results and try them on the market before the bigger launch.

What are the advantages of starting to use Firebase?

undefined

What is the pricing?

Firebase has just 2 plans. One is the free Spark plan. Spark plan has some restrictions of course and, for example, does not allow access to Cloud Functions at all. With this plan for the first quarter of 2024, you have:

  • 1 Gib for Cloud Firestore
  • 5 GB for Cloud Storage
  • 100 connections to Realtime database
  • 10 SMS/day for user authentications
  • 10 GB for hosting

A/B Testing, Analytics, App Distribution, Cloud Messaging, Crashlytics, and several other offerings are fully no-cost for both plans.

These are some options that are available within the Spark plan.

Blaze is a pay-as-you-go plan with segmented pricing for different services. If you are interested in the question “How will my monthly bill look with the Blaze plan?”, then Firebase has a built-in calculator here . We used it to get an approximate price of the project architecture.

Our experience

We’re using Firebase in almost all of our mobile applications. Here are the most used services:

undefined

Cloud Messaging

A very wide range of mobile apps have a push notifications feature, right? It’s a notification about a new message in the chat, your delivery status, special offers, and many many others. This helps to increase user experience within the app. So this is where this service comes in. All you need to do is configure Firebase to work with your app on the Firebase console, include a Google autogenerated file into the project and you are good to go.

App distribution

As a team, we’re using this service in nearly all of our projects that include mobile development. This is the fastest way to distribute new builds across the team. It is very convenient to have an internal channel for the team where we can distribute the builds for internal testing before they are ready to send to the client as a final version. Additionally, the global content delivery network (CDN) provided by Firebase Hosting ensures fast and reliable access to applications for users around the world, enhancing the overall user experience.

Hosting

Firebase Hosting allows you to deploy web apps and static content with ease. It gives clients a quicker time to market. Additionally, the global content delivery network (CDN) provided by Firebase Hosting ensures fast and reliable access to your application for users around the world, enhancing the overall user experience. One of the most important things for the web is scaling and in Firebase Hosting scaling options are automatic. This allows clients to save money and time for server management work. We were using Firebase Hosting on some projects, for example, to deploy a landing website or website business card. On one of our projects related to food delivery, we used this service to host the Admin CMS website.

Authentication

Firebase offers a bunch of ways to authenticate your user in the app. From email/password and phone to Github and Yahoo. Everyone wants to reduce the number of steps users need to go through during the registration process, so registration using external providers is a solution that lets us achieve this.

Crashlytics

As mobile app developers, we know how important it is to have the ability to catch errors that might happen during user sessions in the app. And that’s why we’re including a crash reporter tool in our apps. It’s a must-have tool to include in the project, especially when not very obvious errors happen. It also helps when it comes to tracking errors in the background processes when a user might be going through other screens in the app. During our mobile development journey, there were enough examples when the Crashlytic tool helped to understand the real causes of the errors, which helped efficiently fix them.

Database

It is always a question of project budget and goals what way to choose when a project requires a cloud-hosted database. And both Realtime Database and Firestore one suggest a robust solution to use. Data real-time updates, and offline open ways to power up the applications. It’s a good choice when you want to have a quick working solution with a minimum of the cost. However, you need to keep in mind that it is much better for big projects and applications to have a full-fledged server that will be responsible for communication with the database, rather than the client-side applications.

What limitations did we face?

Here we will describe our experience working with Firebase Realtime Database.

Query capabilities

On one of our projects, we were using a Realtime Database. The project had a mobile application, web application, and serverless architecture. Picture a mobile application featuring an interactive map adorned with numerous locations. Each location has a set of properties available for user-defined filtering. The end users are actively involved in various activities within these designated locations.

So our task was to build a complex query to fetch locations filtered not only by the location properties but also by the activities users were undertaking at these sites. And this is the place where we hit the wall. Unfortunately, it is not possible to perform cross queries. The only possible solution that we come up with is to combine the outcomes of two queries in a unified result. While it may seem like we've resolved the issue and things are on track, there's a nuance to consider. You're partially correct. However, there's another aspect to consider with this solution. The actual challenge with this approach arises when you need to paginate the results of a unified query result or need the results to be grouped or sorted. The reality is that Firebase cannot fulfill these specific requirements. The more complex and multiple conditions you need your query to perform, the more challenges need to be resolved if we’re talking about the Firebase databases.

Data migration

There is also one of the major things that we as a development team needed to think about. It is a data migration. The more the project grows, the more issues you can face at this point. When you want to move data in an SQL database, you just write a script with queries and retrieve the information that you need. At the same time, this is not an option in Firebase. Data migration is a way more complex process rather than in most SQL databases.

Business logic updates

The next limitation is not about the Firebase side. It is more related to all applications that follow serverless architecture. Since Firebase suggests a serverless approach only, this portion is good to be considered as well. Imagine the application with events feeds on the main screen. As the application is serverless, it is the application's responsibility to write a query to fetch feed items from the database, right? On the next circle of improvements, the client requested to update the sorting conditions of the events. How does it usually work with cloud-hosted servers? The query that fetches data needs to be updated on the server side. Once the server is updated, all the users automatically see the updated list in their applications. But with serverless applications, not only the query logic should be updated. If talking about mobile applications, a new version must be submitted to the stores, Apple and Google. This means only users with the newest version will see the updated list and everyone with older ones never would have access to this. Moreover, the update process is not predictable, meaning you cannot be 100% sure when the user rich the update. Of course, there are ways to notify users about the app updates, like dialogs or push notifications, for example. In some cases, it is not a big issue, but sometimes this is crucial for businesses to show content in the correct order.

undefined

Conclusion

This article explained why Firebase is used so widely in projects that include mobile development, and the bright and dark sides of this usage. It is worth including Analytic and Crashlytic tools in your mobile application if you want to increase user engagement and improve app user experience. Firebase also provides a Test Lab that uses real, production devices running in a Google data center to test the applications whether it’s Android or iOS. It’s a great service to quickly bring your MVP application to life with lower costs by implementing serverless architecture. But once you are ready to expand and scale, from our experience, we would recommend processing with a cloud-based server.