npm i -g firebase-tools, or use npx without installing: npx -y firebase-tools@latest --versionnpx -y firebase-tools@latest login
npx -y firebase-tools@latest projects:listnpm install # or: bun install
npm run build # or: bun run buildnpx -y firebase-tools@latest init apphostingmain)./ if your app is at the repo root, or specify a subdirectory.NEXT_PUBLIC_FIREBASE_API_KEYNEXT_PUBLIC_FIREBASE_AUTH_DOMAINNEXT_PUBLIC_FIREBASE_PROJECT_IDNEXT_PUBLIC_FIREBASE_APP_IDNEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_IDNEXT_PUBLIC_FIREBASE_STORAGE_BUCKETapphosting.yaml config file. This approach lets you version-control your configuration alongside your code.firebase apphosting:secrets:set SECRET_NAMEfirebase apphosting:secrets:set firebase-api-keyapphosting.yaml with the secret reference. The file stores only references, not values — safe to commit.env:
- variable: NEXT_PUBLIC_FIREBASE_API_KEY
secret: firebase-api-key@1.firebasercfirebase.jsonapphosting.yamlmain). App Hosting will automatically build and deploy your app.backend-id--project-id.<region>.hosted.apppackage-lock.json or bun.lock to keep builds reproducible.firebase init apphosting first before running firebase use project-id in that folder..env.local file. Console values override apphosting.yaml values.firebase init apphosting then firebase deploy to push source directly from your machine — no GitHub required.apphosting.emulator.yaml for local overrides — auto-created by the CLI, dynamically loads secrets from Cloud Secret Manager.