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
- Initialize hosting:
firebase init hosting - Build your app:
npm run build (for Next.js/React) - 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!