Skip to main content

Firebase Setup

Asset Information Centre uses Firebase as its backend. This guide walks through creating and connecting a Firebase project.

Create a Firebase project

  1. Visit Firebase Console
  2. Click Add project
  3. Enter project name (e.g. asset-management-prod)
  4. Enable or disable Google Analytics (optional)
  5. Click Create project

Enable Authentication

  1. Build → Authentication → Get started
  2. Sign-in method tab:
    • Enable Email/Password (required)
    • Optionally enable Google, Microsoft, or OpenID Connect for SSO
  3. Settings → Authorized domains — add your production domain when deploying

Create Firestore database

  1. Build → Firestore Database → Create database
  2. Choose region closest to your users (e.g. asia-south1 for India)
  3. Start in test mode for development, then deploy rules before production

Register web application

  1. Project Settings → General → Your apps → Web (</>)
  2. Register app nickname: Asset Information Centre
  3. Copy the firebaseConfig object values into .env:
Firebase config keyEnvironment variable
apiKeyVITE_FIREBASE_API_KEY
authDomainVITE_FIREBASE_AUTH_DOMAIN
projectIdVITE_FIREBASE_PROJECT_ID
storageBucketVITE_FIREBASE_STORAGE_BUCKET
messagingSenderIdVITE_FIREBASE_MESSAGING_SENDER_ID
appIdVITE_FIREBASE_APP_ID
measurementIdVITE_FIREBASE_MEASUREMENT_ID (optional)

In-app configuration

Super Admin can update Firebase config without editing files:

  1. Log in as Super Admin
  2. Settings → Platform → Firebase Backend Setup
  3. Enter config values → Save & Reload

The dev server writes values to .env automatically.

Initialize Firebase CLI

npm install -g firebase-tools
firebase login
firebase use --add
# Select your project ID

Link local project to Firebase:

firebase init

Select:

  • Firestore (use existing firestore.rules)
  • Hosting (public directory: dist)

Deploy rules

firebase deploy --only firestore:rules

Critical for:

  • Role permission matrix saves
  • Site map designer settings
  • User management restrictions

Security checklist

  • Firestore rules deployed (not test mode in production)
  • Only Super Admin has settings.manage by default
  • Authorized domains configured for production URL
  • API keys restricted in Google Cloud Console (optional but recommended)

Firestore Rules
Authentication & SSO