Skip to main content

Build & Deploy

Guide to building a production bundle and deploying Asset Information Centre.

Production build

# 1. Ensure .env has production Firebase config
npm run build

This runs:

  1. tsc — TypeScript type checking
  2. vite build — optimized bundle to dist/

Output:

dist/
├── index.html
├── assets/
│ ├── index-[hash].js
│ └── index-[hash].css
└── favicon.png

Preview locally

npm run preview

Serves dist/ at http://localhost:4173 (default).

Environment for production

Set VITE_* variables before npm run build. They are embedded at compile time.

CI/CD example (GitHub Actions):

- name: Build
env:
VITE_FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.FIREBASE_AUTH_DOMAIN }}
VITE_FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.FIREBASE_STORAGE_BUCKET }}
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.FIREBASE_MESSAGING_SENDER_ID }}
VITE_FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}
run: npm run build

Deploy checklist

  • Production Firebase project configured
  • Firestore rules deployed
  • Firestore indexes deployed
  • Auth authorized domains updated
  • Super Admin user created
  • .env / CI secrets set correctly
  • npm run build succeeds
  • HTTPS enabled on hosting domain

Post-deploy

  1. Log in as Super Admin
  2. Verify Settings → Firebase connection
  3. Deploy rules if not done: firebase deploy --only firestore:rules
  4. Test SSO redirect URIs on production domain

Firebase Hosting