Google Firebase

Google Firebase Hosting

Google Firebase Hosting is a production-grade content hosting service for developers. It's fast, secure, and provides a powerful set of tools for deploying both static and dynamic content.

Key Features

  • Global CDN: Firebase Hosting serves your content via a global CDN (Content Delivery Network), ensuring fast load times for users everywhere.
  • SSL by Default: Every site hosted on Firebase gets a free SSL certificate, ensuring all traffic is encrypted and secure.
  • Atomic Deploys: Deployments in Firebase are atomic. This means your site is updated all at once, preventing any "broken" states during the rollout.
  • One-Click Rollbacks: If a deployment goes wrong, you can instantly roll back to a previous version through the Firebase console.
  • Custom Domains: Easily connect your own domain to your Firebase Hosting site.
  • Integration with Firebase Functions: Seamlessly add backend logic and dynamic content using Cloud Functions for Firebase.

Getting Started

  1. Install Firebase CLI: Use npm to install the Firebase command-line tools.
    npm install -g firebase-tools
    
  2. Initialize Project: Run the init command in your project directory.
    firebase init hosting
    
  3. Deploy: Push your site to the web with a single command.
    firebase deploy
    

Configuration (firebase.json)

The firebase.json file allows you to configure hosting behavior, such as rewrites, redirects, and headers.

{
  "hosting": {
    "public": "dist",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

For more advanced features like A/B testing or Preview Channels, refer to the official Firebase Documentation.