# Notes taken while reading the Firebase Docs

The Firebase Realtime Database allows secure access to the database directly from client-side code. Data is persisted locally, and even while offline, realtime events continue to fire, giving the end user a responsive experience.

# API keys for Firebase

API keys for Firebase are different from typical API keys

Unlike how API keys are typically used, API keys for Firebase services are not used to control access to backend resources; that can only be done with

  1. Firebase Security Rules (to control which users can access resources) and
  2. App Check (to control which apps can access resources).

Usually, you need to fastidiously guard API keys (for example, by using a vault service or setting the keys as environment variables); however, API keys for Firebase services are ok to include in code or checked-in config files.

Although API keys for Firebase services are safe to include in code, there are a few specific cases when you should enforce limits for your API key; for example, if you're using

  • Firebase ML,
  • Firebase Authentication with the email/password sign-in method, or
  • a billable Google Cloud API.

If you want to learn how to secure all data access to your Firebase backend services is authorized, read up on the documentation on Firebase security rules (opens new window). These rules control access to file storage and database access, and are enforced on the Firebase servers. So no matter if it's your code, or somebody else's code that uses you configuration data, it can only do what the security rules allow it to do.

# Creating API keys for Firebase

See section Creating API keys (opens new window) of the firebase docs.

# First steps: Demo projects

Go to the Firebase demo chapter

# Understand Firebase projects

See Understand Firebase projects (opens new window)

A Firebase project is the top-level entity for Firebase. In a project, you can

  1. register your Apple, Android, or web apps.
  2. After you register your apps with Firebase, you can add the Firebase SDKs for any number of Firebase products to your apps.

# Hierarchy of Firebase projects

A Firebase project is like a container for all your apps and any resources and services provisioned for the project.

A Firebase project can have one or more Firebase Apps registered to it (for example, both the iOS and Android versions of an app, or both the free and paid versions of an app).

All Firebase Apps registered to the same Firebase project share and have access to all the same resources and services provisioned for the project. Here are some examples:

  • All the Firebase Apps registered to the same Firebase project share the same backends, like Firebase Hosting, Authentication, Realtime Database, Cloud Firestore, Cloud Storage, and Cloud Functions.
  • All Firebase Apps registered to the same Firebase project are associated with the same Google Analytics property, where each Firebase App is a separate data stream in that property.

/images/firebase-projects-hierarchy_projects-apps-resources.png

Google Cloud projects as virtual containers for data, code, configuration, and services

# Relationship between Firebase projects and Google Cloud

When you create a new Firebase project, you're actually creating a Google Cloud project (opens new window) behind the scenes.

You can even create a Google Cloud project first, then add Firebase to the project later. You can think of a Google Cloud project as a virtual container for data, code, configuration, and services.

A Firebase project is actually just a Google Cloud project that has additional Firebase-specific configurations and services enabled for it.

Since a Firebase project is a Google Cloud project, you can interact with it in the Firebase console as well as in the Google Cloud Console and the Google APIs console. You can use products and APIs from both. Billing and permissions and unique identifiers are shared across Firebase and Google Cloud. Deleting a project deletes it in both.

Deleting a project deletes it across Firebase and Google Cloud.

# Setting up a Firebase project and registering apps

You can set up a Firebase project and register apps in

  1. the Firebase console
  2. via the Firebase Management REST API (opens new window)[1] or
  3. the Firebase CLI (opens new window).

When you set up a project and register apps, you need to make some organizational decisions and add Firebase-specific configuration information to your local projects.

# First Steps

See section Add Firebase to your JavaScript project

# Get started with Firebase Hosting

See section Get started with Firebase Hosting

# Authentication

See section Authentication

# Cloud Functions

See section Cloud Functions

# References

# Footnotes


  1. The Firebase Management REST API (opens new window) enables programmatic setup and management of Firebase projects, including a project's Firebase resources and Firebase apps. ↩︎

Last Updated: a year ago