Skip to main content

Firebase Hosting

Deploy the Vite production build to Firebase Hosting.

Prerequisites

npm install -g firebase-tools
firebase login
firebase use your-project-id

Configuration

firebase.json at repository root:

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

SPA routing requires the catch-all rewrite to index.html.

Deploy commands

# Build first
npm run build

# Deploy hosting only
firebase deploy --only hosting

# Deploy everything (hosting + rules + functions if configured)
firebase deploy

Custom domain

  1. Firebase Console → Hosting → Add custom domain
  2. Follow DNS verification steps
  3. Add domain to Authentication → Authorized domains

GitHub Pages (alternative)

npm run build
# Deploy dist/ folder to gh-pages branch

Update vite.config.ts base if using project pages URL:

export default defineConfig({
base: '/Asset-Management/',
// ...
});

Documentation site hosting

Build Docusaurus docs separately:

cd documentation
npm install
npm run build
# Output in documentation/build/

Deploy documentation/build/ to a separate hosting target or /docs path.

Rollback

Firebase Hosting keeps release history:

firebase hosting:releases:list
firebase hosting:rollback