Connect to a Firebase project

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

Understand Firebase projects

Think of a Firebase project as a container for all of your app's backendservices, including user authentication, data storage, hosting, analytics, andmore. By connecting yourFirebase Studio workspace to a Firebase project,you can integrate asuite of Firebase products into yourapp.

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

Consider connecting differentFirebase Studio workspaces to separateFirebase projects. This prevents multiple workspaces from sharing (andpotentially overwriting) the same backend data and resources.

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

Connect aFirebase Studio app to a Firebase project

In order to use Firebase services in your app, you'll need to connect your appto a Firebase project. For example, if you want to useFirebase Authentication, you'llneed to connect to a Firebase project so that you cancreate and manage user accounts. At certain points during the developmentprocess,Firebase Studio creates a Firebase project for you, or you canchoose to do so manually.

Automatically connect to a Firebase project

When using theApp Prototyping agent,Firebase Studio provisions aFirebase 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 asCloud FirestoreorFirebase Authentication
  • Click thePublish button and set upFirebase App Hosting

When using interactive chat orGemini CLI,Gemini can use terminal commands or theFirebase MCP server to connect to a Firebase projectwhen you:

  • Ask to connect your app to a Firebase project
  • Ask for help connecting your app to Firebase services, such asCloud FirestoreorFirebase Authentication

Manually connect to a Firebase project

To manually connect yourFirebase Studio app to a Firebase project:

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

    • Create a new project: ClickCreate a new Firebase project andfollow 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 >Projectsettings. Theproject ID is displayed in the top pane.

  3. Open your app inFirebase Studio. If you're usingtheApp Prototyping agent inPrototyper view, clickCode switch iconSwitch to Code to openCode view.

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

    1. touch firebase.jsonThis ensures a Firebase configuration file exists in your directory.
    2. firebase login --reauthFollow the prompts to authorize your account.
    3. firebase use <your project ID>Replace<your-project-ID> with the project ID you noted earlier.
Note: To change the Firebase project connected to your workspace, prompt theApp Prototyping agent with the project ID you want to use instead. For example, "Switch to Firebase project with ID<your-project-id>."

Change the Firebase project connected to your app

To change the Firebase project associated with yourFirebase Studioworkspace, follow the instructions inManually connect to a Firebase project using the new projectID.

Important: Any Firebase services you set up for the original project won'ttransfer over. You must set them up again in the new project.

Identify the Firebase project connected to your app

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

Next steps

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-09-24 UTC.