firebase-app-hosting-basics
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseApp Hosting Basics
App Hosting 基础
Description
说明
This skill enables the agent to deploy and manage modern, full-stack web
applications (Next.js, Angular, etc.) using Firebase App Hosting.
Important: In order to use App Hosting, your Firebase project must be on the
Blaze pricing plan. Direct the user to
https://console.firebase.google.com/project/_/overview?purchaseBillingPlan=metered
to upgrade their plan.
该技能支持Agent使用Firebase App Hosting部署和管理现代全栈Web应用(Next.js、Angular等)。
重要提示:要使用App Hosting,您的Firebase项目必须采用Blaze计费方案。请引导用户访问https://console.firebase.google.com/project/_/overview?purchaseBillingPlan=metered升级方案。
Hosting vs App Hosting
Hosting 与 App Hosting 的区别
Choose Firebase Hosting if:
- You are deploying a static site (HTML/CSS/JS).
- You are deploying a simple SPA (React, Vue, etc. without SSR).
- You want full control over the build and deploy process via CLI.
Choose Firebase App Hosting if:
- You are using a supported full-stack framework like Next.js or Angular.
- You need Server-Side Rendering (SSR) or ISR.
- You want an automated "git push to deploy" workflow with zero configuration.
选择Firebase Hosting的场景:
- 部署静态网站(HTML/CSS/JS)。
- 部署简单单页应用(React、Vue等无SSR的应用)。
- 希望通过CLI完全控制构建和部署流程。
选择Firebase App Hosting的场景:
- 使用Next.js或Angular等受支持的全栈框架。
- 需要Server-Side Rendering (SSR)或ISR功能。
- 希望实现无需配置的自动化“git push 即部署”工作流。
Deploying to App Hosting
部署到App Hosting
Deploy from Source
从源代码部署
This is the recommended flow for most users.
-
Configurewith an
firebase.jsonblock.apphostingjson{ "apphosting": { "backendId": "my-app-id", "rootDir": "/", "ignore": [ "node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log", "functions" ] } } -
Create or edit- see Configuration for more information on how to do so.
apphosting.yaml -
If the app needs safe access to sensitive keys, usecommands to set and grant access to secrets.
npx -y firebase-tools@latest apphosting:secrets -
Runwhen you are ready to deploy.
npx -y firebase-tools@latest deploy
这是针对大多数用户推荐的流程。
-
在中配置
firebase.json块。apphostingjson{ "apphosting": { "backendId": "my-app-id", "rootDir": "/", "ignore": [ "node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log", "functions" ] } } -
创建或编辑——如需了解具体操作,请查看配置说明。
apphosting.yaml -
如果应用需要安全访问敏感密钥,请使用命令设置并授予密钥访问权限。
npx -y firebase-tools@latest apphosting:secrets -
准备就绪后,运行命令进行部署。
npx -y firebase-tools@latest deploy
Automated deployment via GitHub (CI/CD)
通过GitHub实现自动化部署(CI/CD)
Alternatively, set up a backend connected to a GitHub repository for automated
deployments "git push" deployments. This is only recommended for more advanced
users, and is not required to use App Hosting. See
CLI Commands for more information on how to set
this up using CLI commands.
或者,您可以设置一个连接到GitHub仓库的后端,实现“git push 即部署”的自动化部署。此方式仅推荐给进阶用户,并非使用App Hosting的必需操作。如需了解如何通过CLI命令进行设置,请查看CLI命令说明。
Emulation
本地模拟
See Emulation for more information on how to test
your app locally using the Firebase Local Emulator Suite.
如需了解如何使用Firebase Local Emulator Suite在本地测试应用,请查看本地模拟说明。