Firebase Hosting

Firebase Hosting provides fast and secure hosting for your web app, static and dynamic content, and microservices.

1. Key Features

  • SSD-backed CDN: Faster content delivery globally.
  • Free SSL: Protected by default without extra setup.
  • Custom Domains: Easy connection to your own domain.
  • Preview Channels: Deploy to a temporary URL to test changes.

2. Deployment Steps

  1. Initialize hosting: firebase init hosting
  2. Build your app: npm run build (for Next.js/React)
  3. Deploy: firebase deploy

3. Previewing Changes

Deploy to a temporary channel to share and test with others.

firebase hosting:channel:deploy my-feature

4. Priority of Hosting

If you have both static files and Cloud Functions, Firebase Hosting allows you to route specific paths to functions (for SSR or APIs).

"hosting": {
  "rewrites": [ {
    "source": "/api/**",
    "function": "apiHandler"
  } ]
}
Next.js Secret: Firebase Hosting now has native support for Next.js, allowing you to deploy SSR and ISR routes with almost zero configuration!