What We Learned From Using Firebase: Building a Quick MVP

If you’re planning to build a better app and grow your business, Firebase might be the answer.

Firebase is a Google-backed platform for creating web and mobile apps. It provides technologies that help you develop applications with a real-time database, remote configuration, cloud messaging, and more. Let’s explore why we at Amplified chose Firebase and the benefits you can get from it with your own project.

How We Use Firebase

At Amplified, we needed to deliver an MVP in just 2 weeks, and Firebase seemed to be the right solution for that. It was a very fast way to start up (and speed of development was our main goal at the beginning).

Additionally, it was easier to handle the project when hosting and authentication were also in Firebase, since we didn’t have to worry about setting it up from scratch.

The Pros of Using Firebase
Fast Development

Configuring Firebase is fast, allowing you and your team to start any project quickly. It also comes with built-in advantages that save a lot of engineering time.

Automatic Scaling

Firebase is designed in a way that it automatically syncs all the data coming into the feed. This constant syncing helps calculate the minimum set of required updates. As a result, the application remains scalable and effective throughout the process.

Easy to Integrate With Firebase Auth

Firebase Authentication integrates tightly with other Firebase services, and it leverages industry standards like OAuth 2.0 and OpenID Connect.

Firebase’s Main Disadvantage: Cold Start Latency

Now for the downsides to Firebase. First of all, users complained that the app was slow in some places, for example, when creating an account after an email invitation, integrating Slack within apps, etc.

Sometimes they would see a spinner load that ranged from 4 to 8 seconds. But, in places where you can’t add a spinner to show that the request is pending, users would think the feature doesn’t work.

The Root of The Issue

The cause of this issue was linked to the “cold start” in cloud functions. We had few users using the app, so there weren’t enough requests to keep the functions hot during the day. However, even if we had a lot of users, the probability they would spread out on the app during the day and night was very low.

Other Issues

With Firebase, we also ran into a few other problems, such as:

  • We couldn’t run background tasks.
  • We often faced cold starts.
  • There was a time delay with the external service.
  • It had low parallelism power (running multiple async http requests in parallel ended with tens of seconds of wait time for them).
How We Fixed The Issues

So what solutions did we come up with to overcome it, and to what extent did those solutions work? Here’s what we tried:

  • Lazy load all libraries and exports (lazy loading — technique for loading web content when it’s needed rather than all at once)
  • Chain requests instead of parallel
  • Do a warmup call whenever we hit a page that could possibly call the function

This resulted in time being lowered significantly in most cases. However, it did not help for the Slack integration. The warmup was a hit and miss — sometimes, even if the function got warmed up, it would cool down fast, making the warmup useless.

In the end we migrated to Google App Engine. It was simple, mainly requiring a small change on registering the requests and calls, changing the environment variables handling and for the client side, switching some calls to the backend from httpsCallable (Firebase SDK) to fetches.

Projects You Should Enhance With Firebase

Overall, Firebase Functions is good for a quick MVP API. It works well for any lightweight backend — simple code with minimal libraries and a cold start as small as ~1s. And, it’s amazing for one-off jobs that must be run as effects, as long as they aren’t urgent or require many parallel requests.

Interested in Learning More?

Firebase functions are a good way to start in a fast MVP, to run non-urgent tasks or small amounts of code without a lot of imports. If you’re interested in a customized, cost-effective software solution, get in touch with Amplified Software. We’re expert startup builders specialized in software and design.