Skip to content

Environment Variables Setup

This document describes how to set up and manage environment variables for local development.

Important: No Fallbacks

Never use fallback values for environment variables. If a required env var is missing, the app must fail loudly at startup. This prevents silent misconfiguration across environments (dev/prod).

typescript
// WRONG - never do this
const API_URL = import.meta.env.VITE_API_URL || 'https://some-default-url.com';

// CORRECT
if (!import.meta.env.VITE_API_URL) {
  throw new Error('VITE_API_URL environment variable is required');
}
const API_URL = import.meta.env.VITE_API_URL;

Required Variables

Web App (web/)

VariableDescription
VITE_FIREBASE_API_KEYFirebase API key
VITE_FIREBASE_AUTH_DOMAINFirebase auth domain
VITE_FIREBASE_PROJECT_IDFirebase project ID
VITE_FIREBASE_STORAGE_BUCKETFirebase storage bucket
VITE_FIREBASE_MESSAGING_SENDER_IDFirebase messaging sender ID
VITE_FIREBASE_APP_IDFirebase app ID
VITE_FIREBASE_MEASUREMENT_IDFirebase measurement ID
VITE_FIREBASE_VAPID_KEYFirebase VAPID key for push notifications
VITE_API_URLCloud Run API URL (e.g., https://api-xwzj77tlfa-uc.a.run.app)

Setting Environment Variables

  1. All variables are set in .env at the project root.
  2. Use .env.local for local overrides.
  3. Never commit .env files to version control.

Best Practices

  • No fallbacks. Ever.
  • No hardcoded environment-specific URLs in source code.
  • Store secrets securely (never in the repo).
  • Document any new variables in this file.

For information about deployment environments (dev/prod), see ENVIRONMENTS.md. For deployment instructions, see DEPLOYMENT.md.

Internal docs — access restricted via Cloudflare Zero Trust.