Firebase Setup

Firebase integration in FlutterFlow provides an effortless way to enhance your apps with powerful features such as user authentication, cloud storage, real-time databases, and more. This setup guide will walk you through integrating Firebase with FlutterFlow, empowering you to easily create feature-rich, scalable applications.

Create a new project with a Firebase setup

If you plan to use Firebase from the beginning, you can create a new project and then follow the step-by-step instructions provided below:

  1. First, create a new project, and while doing so, keep the Setup Firebase option enabled and click Next Step.

  2. Click + Create Project. A popup will appear, allowing you to verify the Project Name and select the Firebase Project Region, typically based on where most of your users are located. Once you have confirmed these details, click Create or Sign in with Google to initiate the project creation on Firebase. Note that you can't change the project region after the project is created.

  3. If asked, you must grant the access requested from 'flutterflow.io' to be able to create and configure the Firebase project on your behalf. Here, you can Select all and click Continue.

  4. If you want to use the Firebase Authentication in your app or the Firebase Content Manager, you must enable the authentication in the Firebase console and enable the 'Email/Password' sign-in.

  1. If you plan to use Firebase storage in your app, click on the Enable Storage on Firebase and enable it on Firebase console.

  1. The configuration files are necessary when connecting to Firebase. It contains various settings and keys that enable your project to communicate with Firebase services. To generate those files, click on Auto Generate Config Files and then click Generate Files.

  1. Turn on the Enable Authentication to allow users to log into your app using various sign-in methods, including email and password, social media providers, and even phone number. Note this step only enables authentication. You will need to complete an additional setup to implement authentication logic using these instructions.

  1. Turn on Create User Collection to automatically add a users collection to Firestore Database. This collection will be used to store logged-in user's details, such as email and password.

  1. Select Initial Pages allows you to define the first page a user sees when they open the app (Entry Page) and the first page they see after logging in (Logged In Page). When you click Unset you will be able to choose from a list of templates. You can change these pages at any time inside the App Details page.

  1. Click Start Building.

  1. Once the project is created, you might want to start with adding authentication. To avoid any permission issue, you must deploy the Firestore rules. Select Firebase (from Navigation menu) > Firestore Settings > Firestore Rules > click Deploy.

  1. Optional: For certain functionalities, such as Braintree payments and Push Notifications, you will need to enable billing for your project. To do so:

    1. From the Firebase dashboard of your project, navigate to Build, select Functions, and then select Upgrade project.

    2. Select purchase. If this is your first time enabling billing, you will be taken to a new page to provide your payment information. Otherwise, you can set a project budget. Please see this link for additional information on Firebase pricing.

Add Firebase to an existing project

Connect "new" Firebase project to FlutterFlow project

To add a new Firebase project to an existing FlutterFlow project, select Settings & Integrations > Project Setup > Firebase and then continue with step number 2 from here.

Connect "existing" Firebase project to FlutterFlow project

1. Enable access to your project

  1. Select Add Member from the top right.

  2. Add firebase@flutterflow.io as an "Editor" for your project and select Done. Then press Add Member.

  3. On the same page (i.e., Users and Permissions), select Advanced Permission Settings (small blue text below the table). This will open the Google Cloud console in a new browser window.

  4. Select + Add Another Role.

  5. Under Select A Role, search for Service Account User (you may need to scroll to find this). Select Service Account User.

  6. Select + Add Another Role again. Under Select A Role, search for Cloud Functions Admin. Select Cloud Functions Admin.

Note: The option to add Cloud Functions Admin may only show up if you are on a Firebase Blaze plan. In addition, you may need to enable cloud functions first.

Cloud Functions Admin permissions are required for several FlutterFlow features (e.g., Push Notifications). Adding this Cloud Functions Admin is optional, but not doing so will prevent you from using any functions that require Cloud Functions.

  1. Select Save.

2. Configure your Firestore Database

Configuring the Firestore Database helps you create collections and add documents directly from FlutterFlow.

To configure Firestore Database:

  1. From the Firebase dashboard of your project, navigate to the far left menu. Under Build, select Firestore Database and then select Create Database (marked in yellow in the screenshot).

  2. Next, you will need to set your Firebase security rules. To get started quickly, you can select Start in test mode and select Next.

We recommend updating your Firebase security rules before deploying your app. Please see this link for additional information on Firestore security rules.

  1. Next, you will need to choose the location where your Firestore data will be stored. From the dropdown, select a location and then select Enable. Please see this link for additional information on Firebase locations.

    On completion, you land at the panel view of Cloud Firestore and can start creating collections and documents right away!

3. Enable billing (optional)

If you want to deploy functions (e.g., Braintree payments, Push Notifications), you will need to enable billing for your project. Please follow these steps to enable billing:

  1. From the Firebase dashboard of your project, navigate to the far left menu. Under Build, select Functions and then select Upgrade project.

  2. Select purchase. If this is your first time enabling billing, you will be taken to a new page to provide your payment information. Otherwise, you can set a project budget. Please see this link for additional information on Firebase pricing.

4. Connect and autogenerate files

To connect and autogenerate files:

  1. Under Your Project, look for Project ID. Right-click and copy the Project ID.

  2. Return to FlutterFlow. Add your Firebase Project ID and click Connect. A green check will appear once this is complete.

  3. Under Config Files, select Autogenerate Files and then select Generate Files.

Do not close or refresh the page while the files are being generated.

5. Finalize the setup

  1. Turn on the Enable Authentication to allow users to log into your app using various sign-in methods, including email and password, social media providers, and even phone number. Note this step only enables authentication. You will need to complete an additional setup to implement authentication logic using these instructions.

  2. Turn on Create User Collection to automatically add a users collection to Firestore Database. This collection will be used to store logged-in user's details, such as email and password.

  3. Select Initial Pages allows you to define the first page a user sees when they open the app (Entry Page) and the first page they see after logging in (Logged In Page). When you click Unset you will be able to choose from a list of templates. You can change these pages at any time inside the App Details page.

  4. Click Start Building.


Last Updated Date: November 10, 2023

Last updated