[null,null,["最后更新时间 (UTC):2025-09-09。"],[],[],null,["While you don't need a Firebase project to start working in Firebase Studio,\nconnecting one is essential for using Firebase products. At certain points in\nyour development process, Firebase Studio might automatically create a\nproject for you, or you can choose to connect one manually. This guide explains\nthe purpose a Firebase project serves and how to connect one to your\nworkspace in Firebase Studio.\n\nUnderstand Firebase projects\n\nThink of a Firebase project as a container for all of your app's backend\nservices, including user authentication, data storage, hosting, analytics, and\nmore. By connecting your Firebase Studio workspace to a Firebase project,\nyou can integrate a\n[suite of Firebase products](https://firebase.google.com/products) into your\napp.\n\nA Firebase project can have one or more Firebase Apps registered to it (for\nexample, both the free and paid versions of an app), but keep in mind the\nfollowing:\n\n- All Firebase Apps registered to the same Firebase project share and have access to all the same resources and services provisioned for that project.\n- If Firebase Studio [automatically creates a Firebase project for you](#connect-auto), it creates a new project and links it to your Firebase Studio workspace.\n- If you [duplicate a Firebase Studio workspace](/docs/studio/get-started-workspace#duplicate-workspace) that's linked to a Firebase project, the duplicated workspace is linked to the same project.\n\nConsider connecting different Firebase Studio workspaces to separate\nFirebase projects. This prevents multiple workspaces from sharing (and\npotentially overwriting) the same backend data and resources.\n\nAfter connecting your workspace to a Firebase project, visit the\n[Firebase console](https://console.firebase.google.com/) for\nadministrative and configuration tasks. This includes viewing security rules,\nmanaging user accounts, viewing detailed crash reports, editing stored data\ndirectly, and reviewing A/B test results.\n\nConnect a Firebase Studio app to a Firebase project\n\nIn order to use Firebase services in your app, you'll need to connect your app\nto a Firebase project. For example, if you want to use Firebase Authentication, you'll\nneed to connect to a Firebase project so that you can\ncreate and manage user accounts. At certain points during the development\nprocess, Firebase Studio creates a Firebase project for you, or you can\nchoose to do so manually.\n\nAutomatically connect to a Firebase project\n\nWhen using the App Prototyping agent, Firebase Studio provisions a\nFirebase project on your behalf when you:\n\n- Auto-generate a Gemini API key\n- Ask to connect your app to a Firebase project\n- Ask for help connecting your app to Firebase services, such as Cloud Firestore or Firebase Authentication\n- Click the **Publish** button and set up Firebase App Hosting\n\nWhen using interactive chat or Gemini CLI,\nGemini can use terminal commands or the\n[Firebase MCP server](/docs/cli/mcp-server) to connect to a Firebase project\nwhen you:\n\n- Ask to connect your app to a Firebase project\n- Ask for help connecting your app to Firebase services, such as Cloud Firestore or Firebase Authentication\n\nManually connect to a Firebase project\n\nTo manually connect your Firebase Studio app to a Firebase project:\n\n1. In the [Firebase console](https://console.firebase.google.com/)\n create a new project or open an existing project:\n\n - **Create a new project** : Click **Create a new Firebase project** and follow the instructions to create a new project.\n - **Open an existing project**: Click the project you want to use.\n2. **Note your project ID.** In the Firebase console, click\n settings \\\u003e [**Project\n settings**](//console.firebase.google.com/project/_/settings/general/). The\n project ID is displayed in the top pane.\n\n3. **Open your app in Firebase Studio.** If you're using\n the App Prototyping agent in Prototyper view, click **Switch to Code** to open Code view.\n\n4. **Connect your Firebase project.** In the terminal (`Shift+Ctrl+C`), run the\n following commands:\n\n 1. `touch firebase.json` This ensures a Firebase configuration file exists in your directory.\n 2. `firebase login --reauth` Follow the prompts to authorize your account.\n 3. `firebase use \u003cyour project ID\u003e` Replace `\u003cyour-project-ID\u003e` with the project ID you noted earlier.\n\nChange the Firebase project connected to your app\n\nTo change the Firebase project associated with your Firebase Studio\nworkspace, follow the instructions in\n[Manually connect to a Firebase project](#connect-manual) using the new project\nID.\n| **Important:** Any Firebase services you set up for the original project won't transfer over. You must set them up again in the new project.\n\nIdentify the Firebase project connected to your app\n\nTo confirm if a Firebase project is already connected, check the top of your\nFirebase Studio workspace. The connected project ID, if one exists, is shown\nnext to the name of your workspace. You can click the project ID to open that\nproject directly in the Firebase console.\n\nNext steps\n\n- [Understand Firebase projects](/docs/projects/learn-more)\n- [Integrate with Google and Firebase services](/docs/studio/google-integrations)\n- [Monitor and protect web apps](/docs/studio/monitor)"]]