Connect to a Firebase project

While you don't need a Firebase project to start working in Firebase Studio, connecting one is essential for using Firebase products. At certain points in your development process, Firebase Studio might automatically create a project for you, or you can choose to connect one manually. This guide explains the purpose a Firebase project serves and how to connect one to your workspace in Firebase Studio.

Understand Firebase projects

Think of a Firebase project as a container for all of your app's backend services, including user authentication, data storage, hosting, analytics, and more. By connecting your Firebase Studio workspace to a Firebase project, you can integrate a suite of Firebase products into your app.

A Firebase project can have one or more Firebase Apps registered to it (for example, both the free and paid versions of an app), but keep in mind the following:

  • All Firebase Apps registered to the same Firebase project share and have access to all the same resources and services provisioned for that project.
  • If Firebase Studio automatically creates a Firebase project for you, it creates a new project and links it to your Firebase Studio workspace.
  • If you duplicate a Firebase Studio workspace that's linked to a Firebase project, the duplicated workspace is linked to the same project.

Consider connecting different Firebase Studio workspaces to separate Firebase projects. This prevents multiple workspaces from sharing (and potentially overwriting) the same backend data and resources.

After connecting your workspace to a Firebase project, visit the Firebase console for administrative and configuration tasks. This includes viewing security rules, managing user accounts, viewing detailed crash reports, editing stored data directly, and reviewing A/B test results.

Connect a Firebase Studio app to a Firebase project

In order to use Firebase services in your app, you'll need to connect your app to a Firebase project. For example, if you want to use Firebase Authentication, you'll need to connect to a Firebase project so that you can create and manage user accounts. At certain points during the development process, Firebase Studio creates a Firebase project for you, or you can choose to do so manually.

Automatically connect to a Firebase project

When using the App Prototyping agent, Firebase Studio provisions a Firebase project on your behalf when you:

  • Auto-generate a Gemini API key
  • Ask to connect your app to a Firebase project
  • Ask for help connecting your app to Firebase services, such as Cloud Firestore or Firebase Authentication
  • Click the Publish button and set up Firebase App Hosting

When using interactive chat or Gemini CLI, Gemini can use terminal commands or the Firebase MCP server to connect to a Firebase project when you:

  • Ask to connect your app to a Firebase project
  • Ask for help connecting your app to Firebase services, such as Cloud Firestore or Firebase Authentication

Manually connect to a Firebase project

To manually connect your Firebase Studio app to a Firebase project:

  1. In the Firebase console create a new project or open an existing project:

    • Create a new project: Click Create a new Firebase project and follow the instructions to create a new project.
    • Open an existing project: Click the project you want to use.
  2. Note your project ID. In the Firebase console, click > Project settings. The project ID is displayed in the top pane.

  3. Open your app in Firebase Studio. If you're using the App Prototyping agent in Prototyper view, click Code switch icon Switch to Code to open Code view.

  4. Connect your Firebase project. In the terminal (Shift+Ctrl+C), run the following commands:

    1. touch firebase.json This ensures a Firebase configuration file exists in your directory.
    2. firebase login --reauth Follow the prompts to authorize your account.
    3. firebase use <your project ID> Replace <your-project-ID> with the project ID you noted earlier.

Change the Firebase project connected to your app

To change the Firebase project associated with your Firebase Studio workspace, follow the instructions in Manually connect to a Firebase project using the new project ID.

Identify the Firebase project connected to your app

To confirm if a Firebase project is already connected, check the top of your Firebase Studio workspace. The connected project ID, if one exists, is shown next to the name of your workspace. You can click the project ID to open that project directly in the Firebase console.

Next steps