Useful Firebase Tips and Tricks for Beginners

Daniele Orlando
Google for Developers Europe
3 min readApr 13, 2020

Firebase is Google’s application development platform that helps you to build, improve, and grow your app. Firebase covers good parts of the services that each developer would normally develop on their own.

Using Firebase, we can build better apps! We spend less time worrying about infrastructure and more time focusing on the app experience itself.

Here are my tips, based on my experience to avoid the most common mistakes and to build a better app.

  1. Separate Dev and Prod Environment
    Create two projects, one for development, one for production. With two different projects, you can keep safe your user data and, at the same time, testing and developing new functions.
  2. Upgrade to Blaze
    It’s pay as you go, but don’t worry. You’ll get all the free stuff on the Spark Plan.
  3. Budget alert
    Are you afraid of spending too much? Set a budget alert to keep track of your money. But stop worrying about it. Firebase is not expensive. It would be expensive only if you make some modeling mistakes or if your app we’ll be very very successful.
  4. Data modeling
    Firebase’s database (Realtime or Firestore) is a NoSql database. Like others non-relational DMS, does not require a fixed schema.
    My advice is to model your database according to your needs and structure your data as long as possible to fits the screen.
    If you are new to NoSql, don’t be afraid of data duplication. It is a common practice to avoid multiple readings from documents (and also a technique to save money)
  5. Security rules
    Don’t forget to apply security rules for your database. Using simulator you can test your rules. But if you are already on the production environment, it’s better to test your rules locally with the Firebase Emulators.
  6. Automatic backup your database
    Firebase doesn’t provide a tool for automatic backup. So, you can use Cloud Functions and Cloud Scheduler. But first, create a dedicated storage bucket for your backup!
  7. Crashlytics
    Track crashes and errors in your application! Think Crashlytics as a cloud-based console, where you can see all the generated logs on your users’ devices. You can read the exact line of the crash, model and os of the device.
  8. Cloud Functions
    Extend your app with custom backend code without needing to manage and scale your own server. This is what’s Cloud Function. You can write functions that can respond to events generated by Firebase. So, how you can extend your app? You can sync the Mailchimp audience every time you have a new user. You can send an email with Sendgrid when a user has hit a particular function in your app. You can also increase security or improve sql-like queries.
  9. Analytics
    Analytics are important for building a successful application. Analytics for Firebase it’s free and unlimited. Log and report everything for free without any quota. Easy to use in just one line of code.
  10. Remote config
    Customize the behavior and appearance on-the-fly of your app, without publishing an update, using Remote Config. You can also create A/B testing. The best way to implement a new feature optimizing the user experience.
  11. Dynamic links
    Dynamic links are the best experience for your users. With a simple link, you can send your users to an exact path in your app, whether or not it’s already installed.
  12. Search text in Firestore
    Firebase doesn’t support native indexing or search for text fields in documents. If you want to search for a certain word in a document, you should use a third-party search service like Algolia.
    But if you want to query all documents that start with a word, you can use the wildcard ~

In conclusion

As I said initially, Firebase has a solution for everything.
In this post, I didn’t mention important tools like Authentication, Cloud Messaging, Hosting, Test Lab or ML Kit.

I wrote these tips based on my experience of the past few years and I’d like to write more posts on Firebase in the future. So if you have any questions, want to send your advice or if you want to know more about a particular topic, write directly in the comments :)

--

--