Introduction to Firebase

Firebase is a Cloud-hosted, NoSQL database that uses a document-model. It can be horizontally scaled while letting you store and synchronize data in real-time among users. This is great for applications that are used across multiple devices such as mobile applications. Firebase is optimized for offline use with strong user-based security that allows for serverless based apps as well.

Firebase is built on the Google infrastructure and is built to scale automatically. In addition to standard NoSQL database functionality, Firebase includes analytics, authentication, performance monitoring, messaging, crash reporting and much more. Because it is a Google product, there is also integration into a lot of other products. This includes integration with Google Ads, AdMob, Google Marketing Platform, the Play Store, Data Studio, BigQuery, Slack, Jira, and more.

The Firebase APIs are packaged into a single SDK that can be expanded to multiple platforms and languages. This includes C++ and Unity, which are both popular for mobile development.

Working with Firebase

A Firebase project is a pool of resources that can include a database as well as items such as user accounts, analytics, and anything that can be shared between a number of client applications. A Firebase application is a single application that can be backed by the Firebase Project. A Firebase project can have multiple Firebase applications within it.

To create a Firebase project, go to the Firebase site at Firebase.Google.com. On the upper right corner (as shown in figure 1), click on the Go to Console button. This will take you to the console where you can build your project.

Firebase site

Figure 1: The Firebase site

The first step towards building a Firebase project is to enter a name for your project and accept the Firebase terms as shown in figure 2 where I’ve created a project called “Test Project – BLJ”.

Naming a Firebase Project

Figure 2: Naming your Firebase project.

After naming your project, you’ll step through two or three additional screens for setting up your project. The other setting you will be asked about is whether you want to enable analytics. Google Analytics is free and provides targeting and reporting in what you are doing. This will enable you to be able to more effectively do things such as A/B testing, user segmentation and targeting event-based Cloud Functions triggers, and user behavior predictions. The setup process will allow you to use an existing Google Analytics account or set up a new one. Once you’ve walked through the setup wizard, you’ll be told when your project has been created as shown in Figure 3.

Firebase Project Complete

Figure 3: Firebase Project Setup completed

With the project built, you can click the continue button, which will take you to your projects page that will be similar to what is shown in Figure 4.

Firebase Project List

Figure 4: Firebase Project

It’s important to note that the project has been created under a free Spark plan. This means there will be usage quotas for Database, Firestore, Storage, Functions, Phone Auth, Hosting, and Test lab usage. Overall, the free account will allow you to get up and running with many small projects.

In the area of usage of the real-time database using the free account (at the time this article was written), you can have 100 simultaneous connections, store up to 1 GB of data, and have 10GB of downloads each month. You only have one databases within a project. Having said that, if you want to use storage outside of the database, the free account provides up to 5GB of storage with downloads of up to 1GB per day. You can do 20,000 uploads and 50,000 downloads per day. You can, however, only have one storage bucket per project.

If you need to get around these usage restrictions, or if you want to extend your project with the Google Cloud Platform, then you will need to upgrade to a Blaze account. It expands the usage amounts.

Firebase Cloud Firestore Versus Firebase Realtime Database

Firebase has two different cloud-based solutions that support real-time data synchronization. These are Cloud Firestore and Firebase Realtime Database. The Realtime Database is the original Firebase database that works with synchronization across clients in real-time. It is an effective, low-latency solution great for mobile applications. Cloud Firestore is a newer offering that offers more scalability and faster access than the Realtime Databases. For example, one change it that when Realtime Database grabs a collection of items from a database, it also grabs all the sub-collections. With Cloud Firestore, queries are shallow in that they don’t grab sub-collections.

What’s Next?

This article was a quick introduction to Firebase. You can jump to firebase.google.com and create a project using a free account today. In the next article, you will see how to use a Firebase database from a simple web application.

# # #

Get the Free Newsletter!

Subscribe to Cloud Insider for top news, trends & analysis

Latest Articles