$npx -y skills add firebase/agent-skills --skill firebase-app-hosting-basicsDeploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.
| 1 | # App Hosting Basics |
| 2 | |
| 3 | ## Description |
| 4 | |
| 5 | This skill enables the agent to deploy and manage modern, full-stack web |
| 6 | applications (Next.js, Angular, etc.) using Firebase App Hosting. |
| 7 | |
| 8 | **Important**: In order to use App Hosting, your Firebase project must be on the |
| 9 | Blaze pricing plan. Direct the user to |
| 10 | https://console.firebase.google.com/project/_/overview?purchaseBillingPlan=metered |
| 11 | to upgrade their plan. |
| 12 | |
| 13 | ## Hosting vs App Hosting |
| 14 | |
| 15 | **Choose Firebase Hosting if:** |
| 16 | |
| 17 | - You are deploying a static site (HTML/CSS/JS). |
| 18 | - You are deploying a simple SPA (React, Vue, etc. without SSR). |
| 19 | - You want full control over the build and deploy process via CLI. |
| 20 | |
| 21 | **Choose Firebase App Hosting if:** |
| 22 | |
| 23 | - You are using a supported full-stack framework like Next.js or Angular. |
| 24 | - You need Server-Side Rendering (SSR) or ISR. |
| 25 | - You want an automated "git push to deploy" workflow with zero configuration. |
| 26 | |
| 27 | ## Deploying to App Hosting |
| 28 | |
| 29 | ### Deploy from Source |
| 30 | |
| 31 | This is the recommended flow for most users. |
| 32 | |
| 33 | 1. Configure `firebase.json` with an `apphosting` block. |
| 34 | ```json |
| 35 | { |
| 36 | "apphosting": { |
| 37 | "backendId": "my-app-id", |
| 38 | "rootDir": "/", |
| 39 | "ignore": [ |
| 40 | "node_modules", |
| 41 | ".git", |
| 42 | "firebase-debug.log", |
| 43 | "firebase-debug.*.log", |
| 44 | "functions" |
| 45 | ] |
| 46 | } |
| 47 | } |
| 48 | ``` |
| 49 | 1. Create or edit `apphosting.yaml`- see |
| 50 | [Configuration](references/configuration.md) for more information on how to |
| 51 | do so. |
| 52 | 1. If the app needs safe access to sensitive keys, use |
| 53 | `npx -y firebase-tools@latest apphosting:secrets` commands to set and grant |
| 54 | access to secrets. |
| 55 | 1. Run `npx -y firebase-tools@latest deploy` when you are ready to deploy. |
| 56 | |
| 57 | ### Automated deployment via GitHub (CI/CD) |
| 58 | |
| 59 | Alternatively, set up a backend connected to a GitHub repository for automated |
| 60 | deployments "git push" deployments. This is only recommended for more advanced |
| 61 | users, and is not required to use App Hosting. See |
| 62 | [CLI Commands](references/cli_commands.md) for more information on how to set |
| 63 | this up using CLI commands. |
| 64 | |
| 65 | ## Emulation |
| 66 | |
| 67 | See [Emulation](references/emulation.md) for more information on how to test |
| 68 | your app locally using the Firebase Local Emulator Suite. |