DEV Community

Cover image for A quick dive into Firebase: jumpstart your full-stack journey
Amanda Fawcett for Educative

Posted on • Updated on • Originally published at educative.io

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

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:

  • What is Firebase?
  • Why should I use Firebase?
  • Who uses Firebase?
  • How do I get started with Firebase?

Want to get started making-world Firebase applications? Take a look at Educative’s course, Full-Stack Web Applications with Firebase to jump right into hands-on learning with this tool!


What is Firebase?

Alt Text

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: the client SDKs offered by Firebase communicate with these Google backend services. You no longer have to write both the front and backend software; you get to bypass the traditional backend operations.

A simplified database query.

Data retrieval is made easy with Firebase through its queries, which you can make by chaining filter methods together. Firebase 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.

Alt Text


Why should I use Firebase?

Alt Text

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.

Alt Text

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.

Alt Text

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 simpler 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.

Alt Text

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. Some argue that AdMob makes it easier to monetize from ads. Others say that Firebase makes it easier to track purchases and target user demographics. Firebase Analytics makes it easier to observe and understand trends with your app. Others, however, have reported the 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?

Alt Text

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:


How do I get started with Firebase?

Alt Text

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: Firebase comes with the basics of authentication pre-configured, but you need to enable access and tinker with restrictions.

  • Realtime Database/Cloud Firestore: you can set up either the Firestore or Realtime database capabilities to serve a variety of needs, sharing capacities, and customization.

  • Firebase Hosting: here is where you set up your API. This service makes writing HTTP functions much easier.

  • Cloud Storage: you can write and run code using Cloud Functions to serve tons of different needs. This is where a lot of your backend skills come in handy. Take a look at some of the things you can do with Cloud Functions.

  • ML Kit: you can use Google’s ML Kit to implement ML features into your app. These aren’t required by any means, and you can tinker with these tools to make really interesting add-ons.

  • Analytics: when you set up your app, you will be prompted to select how you want Google Analytics to integrate with your data.

  • Cloud Messaging: there’s a lot of customization for the kind of messaging system you implement and code. There are a variety of settings for notifications and security in particular.

  • Test Lab: Google provides you with different kinds of iOS and Android devices to test out your app how you want to. You can customize the selection that will install your app and requires no extra coding.

Now that you know the basics of what you need to prepare for as you develop, let’s walk through the very first stage of starting a new Firebase project. We will then offer some resources for moving forward with your Firebase future!

Requirements for Firebase

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

Alt Text

Step 2: Create a Firebase app from the dashboard

Alt Text

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

Alt Text

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!

Alt Text

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 on 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!

Extra Resources

Top comments (0)