firebase-hosting-basics
將靜態網站、單頁應用程式及微服務部署至全球CDN,並提供零配置SSL支援。支援靜態網站、單頁應用程式(React、Vue等),以及透過Cloud Functions或Cloud Run整合的動態內容。包含預覽頻道功能,可在正式部署前於臨時URL測試變更,並搭配GitHub Actions自動化流程。透過firebase.json設定路由、重新導向、重寫規則及標頭;部署前可於http://localhost:5000進行本地模擬。不適用於全端框架...
npx skills add https://github.com/firebase/agent-skills --skill firebase-hosting-basicshosting-basics
This skill provides instructions and references for working with Firebase Hosting, a fast and secure hosting service for your web app, static and dynamic content, and microservices.
Overview
Firebase Hosting provides production-grade web content hosting for developers. With a single command, you can deploy web apps and serve both static and dynamic content to a global CDN (content delivery network).
Key Features:
- Fast Content Delivery: Files are cached on SSDs at CDN edges around the world.
- Secure by Default: Zero-configuration SSL is built-in.
- Preview Channels: View and test changes on temporary preview URLs before deploying live.
- GitHub Integration: Automate previews and deploys with GitHub Actions.
- Dynamic Content: Serve dynamic content and microservices using Cloud Functions or Cloud Run.
Hosting vs 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.
Instructions
1. Configuration (firebase.json)
For details on configuring Hosting behavior, including public directories, redirects, rewrites, and headers, see configuration.md.
2. Deploying
For instructions on deploying your site, using preview channels, and managing releases, see deploying.md.
3. Emulation
To test your app locally:
npx -y firebase-tools@latest emulators:start --only hosting
This serves your app at http://localhost:5000 by default.