A quick dive into Firebase: jumpstart your full-stack journey

Jan 28, 2019 - 9 min read
Amanda Fawcett
editor-page-cover

If you work in the world of app or software development, you’ve probably heard about Firebase. You probably know that it was made by Google. Maybe you’ve heard that it’s an app development platform. But what really is Firebase? What does it do? And what role might it play in your life? Today, we will do a quick, but deep dive into everything you need to know about Firebase!

Here is what we’ll cover today:



Learn how to make Firebase applications.

Build four applications using Firebase. Each app is strategically designed to teach you a different Firebase service.

Full-Stack Web Applications with Firebase



What is Firebase?

In a nutshell, Firebase is an ecosystem of Google tools that can be used to make scalable applications in the Google Cloud (called Cloud Firestore) or Realtime Database. It’s categorized as a backend-as-a-service (or BaaS) which gives developers the opportunity to create applications without the hassle of setting up the backend from scratch. The core of Firebase is its realtime database. Sounds great! But let’s define Firebase more thoroughly. Firebase is…


A NoSQL, cloud, realtime database.

Firebase offers two databases: Cloud Firestone and Firebase Realtime Database. These databases use data synchronization to overcome the limitations of HTTP requests. The realtime database uses JSON storage, while Cloud Firestore is document-based.

You can store data in documents that contain fields mapping to values. They are both realtime syncing data across connected clients. This means that every time your client connects to a device, their data is updated immediately. Data and collaboration are reimagined through this simple system that allows you to bypass networking code.

All of the data, products, and services on Firebase are backed by Google components. This means that there is no need for any middleware.


A simplified database query.

Data retrieval is made easy with Firebase through its queries, which you can make by chaining filter methods together. Firestore provides 3 ordering functions:

  • orderBy( )
  • limit( )
  • where( )

There are also more advanced query functions that can restrict data, such as startAt(‘value’), limitToLast(10), and more. Querying in Firebase involves two steps: creating a reference to a parent key, and then using an ordering function.


An improved data structure system.

Firestone organizes data in maps: documents that consist of key-value pairs. These pairs can contain a variety of data types that are grouped into collections. They can then be divided into sub-collections, eventually generating a hierarchy of data to make data retrieval much easier. This system means that you can access data without fetching any of the data in a sub-collection.


A cloud messaging system.

The Firebase Cloud Messaging (FCM) offers a reliable connection between your devices and server, making it easy to receive messages on the web, iOS, and Android. Messages can easily be sent to targeted groups based on particular demographics and be scheduled out for specified time zones. This process takes very little coding to get set up since it’s integrated with Firebase Analytics.


Easy and reliable authentication.

Firebase has built-in backend services, UI libraries, and SDK’s to form its reliable authentication system. Custom authentication can take months for a developer, but Firebase speeds up that process, requiring only 10 lines of code to get your authentication system up and running. On top of that, it integrates directly into the Firebase Database, making data control and access way easier for you. There are several ways you can authenticate your users with Firebase:

  • Email & password
  • Google
  • Facebook
  • Twitter
  • Phone number

An offline service.

Firebase apps are responsive even when they’re not connected to the Internet. Data can synchronize with the current server state.


A modification for dynamic links.

Firebase can convert deep links into dynamic links so that your users can interact more efficiently with your app. This functionality serves three main purposes: to increase user-to-user sharing, to convert mobile users to native app users, and to improve target audiences using installs from third parties.


A hassle-free hosting platform.

Firebase hosting requires almost no learning curve. With Firebase, you can host all your static files, serving them from a global CDN with HTTP/2.


Scalable across multiple databases.

Cloud Firestore is modeled after the Google Cloud infrastructure, so scaling is easier and effective. You can support your data needs depending on the scale of your app, and you can even split data across multiple databases to streamline your project. Your data is automatically copied to different regions, making your data far safer and consistent.


A fully-featured application platform.

Tons of Google products and tools are integrated with Firebase, making your app development a breeze. Take a look below to learn more.

widget

Why should I use Firebase?

If you’re thinking about getting started with Firebase, you probably have some questions about what it can (and cannot) do for you. So, let’s discuss the ins and outs of why and when a developer should use the Firebase ecosystem.

Benefits of Firebase

  • Save time writing code for authentication
  • Create application without abackend server
  • NoSQL database is very fast
  • Test Lab speeds up development
  • Reliable Cloud storage
  • Realtime data and notifications built-in
  • Remote config
  • Ready-made API
  • Built-in security at data node level
  • File storage with a robust backing cloud system
  • Static file hosting
  • Highly scalable applications
  • Simple, hassle free control dashboard
  • Intuitive and user friendly
  • Integrates with Google Cloud Platform and other Google services

Limitations of Firebase

  • Loss of some control/customization
  • Limited query abilities (not good for deep querying, no relational queries)
  • SQL chops cannot transfer
  • No on-premise installation
  • Pricey cost depending on company needs

Keep the learning going.

Learn Firebase without scrubbing through videos or documentation. Educative’s text-based courses are easy to skim and feature live coding environments, making learning quick and efficient.

Full-Stack Web Applications with Firebase



Supported Platforms

Firebase supports Android, iOS, Web (JavaScript, React, Backbone, Polymer, and Ember are supported frameworks), C++, Flutter, and Unity. There is also an Admin SDK available for many different languages. Take a look at the other apps and tools supported by Firebase.

widget

Common use cases

According to Google, the most common use cases of Firebase are to:

  • Add chat capabilities to your app
  • Optimize ads based on customer behavior
  • Enable customers to share photos
  • Roll out new features easily and progressively
  • Customize your ‘welcome back’ screen
  • Create a simple onboarding process and flow
  • Track customer journey across multiple devices

Main Outcomes of Firebase

Firebase was optimized to help your business with three overarching goals: build, improve, and grow your business.

widget

Build

With tools like the Realtime Database, authentication, storage, and cloud messaging, Firebase saves you time on length development process so you can focus your attention on developing the best app for your business. It handles many of the core operations, so you can devote your time to fine-tuning an app that is perfect for your goals.

Improve

Firebase makes it easy to engage with your users through tools like AdWords, Invites, Dynamic Links, and App Indexing. It’s easy to improve your app when you understand your users and their needs. The central purpose of Firebase is to take care of the basics so you can focus on growth and improving user experience.

Grow

There has been some debate as to whether or not Firebase necessarily helps with revenue. Firebase Analytics makes it easier to observe and understand trends with your app. Some say that Firebase may lead to a loss of revenue due to its price, though it may have been from poor usage of the tool. It seems that right usage leads to the best utility and ROI output.


Who uses Firebase?

The sky is the limit with Firebase, so there is really no right or wrong way to use the ecosystem. It can support a wide variety of projects and apps, everything from building mobile games to a chatting app.

In fact, many start-ups, big companies, and independent programmers are using Firebase. Here’s a list of a few notable names:


Get started with Firebase

Getting started with Firebase is easier than you’d think. To build an app with Firebase, you have to start from the ground up using the base code provided by Google. These are different categories and components you have to develop, with different degrees of customization for each. Here’s what you’ll need to set up and customize:

  • Authentication
  • Realtime Database/Cloud Firestore
  • Firebase Hosting
  • Cloud Storage
  • ML Kit
  • Analytics
  • Cloud Messaging
  • Test Lab

You should have prerequisite knowledge of JavaScript and an understanding of programming basics. It will be beneficial to have some knowledge of backend platforms, but it’s not required. The NodeJS platform is required for development.


Step 1: Create a Firebase account

widget

Step 2: Create a Firebase app from the dashboard

widget

Step 3: Name your project, and configure Google analytics based on your needs

widget

Step 4: Choose the type of app, name it, and supply the provided JavaScript code.

If you see the screen below, it means you are ready to go!

widget

Step 5: Select your features and connect to the Cloud Firestore database

Now that you have your app set up, you can start initializing different features to build it. After you initialize Cloud Firestone Database, you can build/personalize a chat message, deploy Firebase hosting, initialize storage, and set up security through Firebase Authentication.


Wrapping up

It’s really that easy to build apps and games with Firebase. If you want to keep going with this mini tutorial, check out Educative’s course Full-Stack Web Applications with Firebase for a complete guide into creating your full-stack web application.

During the course, you will build four applications using Firebase. Each app is designed to teach you a different Firebase service including

  • Firebase Authentication
  • Cloud Firestore
  • Firebase Storage
  • Firebase Hosting

Throughout the course are step-by-step instructions, including pre-written code for things like page style, resetting passwords, and more. It’s never been easier to get started with Firebase!


Continue reading about app development


WRITTEN BYAmanda Fawcett

Join a community of 270,000 monthly readers. A free, bi-monthly email with a roundup of Educative's top articles and coding tips.