Skip to main content

Documentation Index

Fetch the complete documentation index at: https://grantmaster.dev/llms.txt

Use this file to discover all available pages before exploring further.

Environment & Local Setup

This guide details how to get GrantMaster running locally and how the various environments (Local, Staging, Production) are configured.

1. Prerequisites

  • Node.js: v20 or later (enforced via engines in package.json).
  • Firebase CLI: npm install -g firebase-tools.
  • Java: Required for Firebase Emulators (JRE 11+).
  • npm workspaces: The repo uses npm workspaces (packages/*, functions).

2. Environment Variables

The application uses Vite’s environment handling. Create a .env.local file based on .env.example.
VariableRequirementPurpose
VITE_FIREBASE_API_KEYRequiredWeb SDK browser key.
VITE_GEMINI_API_KEYOptionalBrowser-side Gemini key used only as a legacy/local fallback for some AI flows. Missing it should not block app startup.
VITE_SENTRY_DSNOptionalClient-side error tracking.
VITE_STRIPE_PUBLISHABLE_KEYOptionalClient-side payment integration.
VITE_USE_EMULATORSOptionalSet to true to connect to local Firebase.
VITE_TYPESENSE_HOSTOptionalTypesense Cloud host (required for direct client search mode).
VITE_TYPESENSE_SEARCH_API_KEYOptionalTypesense read-only key (required for direct client search mode).
VITE_TYPESENSE_USE_CLOUD_FUNCTIONSOptionalSet to true to route command palette search through callable searchTypesenseSecure.
Note: Secret keys (like STRIPE_SECRET_KEY) are stored in Firebase Secret Manager and are only accessible to Cloud Functions.

3. Local Development

GrantMaster is designed to be developed entirely offline using the Firebase Local Emulator Suite.
# Start everything — emulators + seed data + Vite dev server
npm run dev:all

# Same but clears emulator data first
npm run dev:all:fresh

Alternative (Two Terminals)

# Terminal 1: Firebase emulators + seed data
npm run dev:start

# Terminal 2: Vite dev server
npm run dev

Other Dev Commands

CommandPurpose
npm run dev:freshEmulators with fresh data (clears existing)
npm run dev:seedSeed emulators only (no dev server)
npm run emulatorsEmulators with persistence (import/export)
npm run emulators:no-persistEmulators without persistence
npm run seed:emulatorsRun seeding script against emulators

Ports

ServicePort
Vite Dev Server3000
Firebase Emulator UI4000
Firestore Emulator8080
Auth Emulator9099
Storage Emulator9199
Functions Emulator5001
Note: Never override the Vite port (3000) — it is hardcoded for Firebase integration.

4. Troubleshooting

  • Port Conflicts: Ensure ports 3000, 4000, 5001, 8080, 9099, and 9199 are not in use by other processes.
  • CORS Issues: When running locally, ensure your Vite dev server is running on the authorized domain configured in Firebase (usually localhost:3000).
  • Function Errors: Check functions/firebase-debug.log for execution errors in background tasks.
  • Emulator Health: Run npm run health:emulators to check emulator status.

Maintenance

Update this document when:
  • Adding a new emulator (e.g., Pub/Sub).
  • Reconfiguring the standard developer ports.
  • Adding mandatory environment variables.