byfirebase· 35 skills
Deploys and configures classic Firebase Hosting for static websites, single-page apps (SPAs), and microservices. Use when deploying static sites/SPAs, setting up custom domains, configuring firebase.json hosting settings (redirects, rewrites, headers, multi-site), or managing preview channels. Don't use for Firebase App Hosting (Next.js/SSR), Auth, Firestore queries/rules, Data Connect, or Crashlytics.
$npx -y skills add firebase/agent-skills --skill firebase-hosting-basicsInstalls into the current project.
Run `npx skills use "https://github.com/firebase/agent-skills" --skill "firebase/agent-skills/firebase-hosting-basics"` and follow the generated skill instructions now. Read its complete output, redirecting it to a temporary file first if necessary. Resolve relative paths from the supporting-files directory it provides.
Use the skills in "https://github.com/firebase/agent-skills" that are relevant to the current task. Run `npx skills add "https://github.com/firebase/agent-skills"` and select the relevant skills, then follow their instructions.
| 1 | # hosting-basics |
| 2 | |
| 3 | This skill provides instructions and references for working with Firebase |
| 4 | Hosting, a fast and secure hosting service for your web app, static and dynamic |
| 5 | content, and microservices. |
| 6 | |
| 7 | ## Overview |
| 8 | |
| 9 | Firebase Hosting provides production-grade web content hosting for developers. |
| 10 | With a single command, you can deploy web apps and serve both static and dynamic |
| 11 | content to a global CDN (content delivery network). |
| 12 | |
| 13 | **Key Features:** |
| 14 | |
| 15 | - **Fast Content Delivery:** Files are cached on SSDs at CDN edges around the |
| 16 | world. |
| 17 | - **Secure by Default:** Zero-configuration SSL is built-in. |
| 18 | - **Preview Channels:** View and test changes on temporary preview URLs before |
| 19 | deploying live. |
| 20 | - **GitHub Integration:** Automate previews and deploys with GitHub Actions. |
| 21 | - **Dynamic Content:** Serve dynamic content and microservices using Cloud |
| 22 | Functions or Cloud Run. |
| 23 | |
| 24 | ## Hosting vs App Hosting |
| 25 | |
| 26 | **Choose Firebase Hosting if:** |
| 27 | |
| 28 | - You are deploying a static site (HTML/CSS/JS). |
| 29 | - You are deploying a simple SPA (React, Vue, etc. without SSR). |
| 30 | - You want full control over the build and deploy process via CLI. |
| 31 | |
| 32 | **Choose Firebase App Hosting if:** |
| 33 | |
| 34 | - You are using a supported full-stack framework like Next.js or Angular. |
| 35 | - You need Server-Side Rendering (SSR) or ISR. |
| 36 | - You want an automated "git push to deploy" workflow with zero configuration. |
| 37 | |
| 38 | ## Instructions |
| 39 | |
| 40 | ### 1. Configuration (`firebase.json`) |
| 41 | |
| 42 | For details on configuring Hosting behavior, including public directories, |
| 43 | redirects, rewrites, and headers, see |
| 44 | [configuration.md](references/configuration.md). |
| 45 | |
| 46 | ### 2. Deploying |
| 47 | |
| 48 | For instructions on deploying your site, using preview channels, and managing |
| 49 | releases, see [deploying.md](references/deploying.md). |
| 50 | |
| 51 | ### 3. Emulation |
| 52 | |
| 53 | To test your app locally: |
| 54 | |
| 55 | ```bash |
| 56 | npx -y firebase-tools@latest emulators:start --only hosting |
| 57 | ``` |
| 58 | |
| 59 | This serves your app at `http://localhost:5000` by default. |