Skip to content

Environments

Environment loading is implemented in backend/src/environments.ts.

  • development: loads dotenv files in a strict order.
  • production: does not load dotenv files; expects platform-managed env vars.

This project does not use a single local file. Local development can resolve from four files, in precedence order: .env, .env.development, .env.local, .env.development.local.

When NODE_ENV resolves to development, files are read in this order:

  1. .env
  2. .env.development
  3. .env.local
  4. .env.development.local

Existing process variables are not overwritten.

  • PORT
  • DATABASE_URL
  • JWT_SECRET
  • JWT_EXPIRES_IN
  • BCRYPT_SALT_ROUNDS
  • GOOGLE_CLIENT_ID
  • OPENAI_API_KEY (or compatibility alias OPEN_AI_API_KEY)
  • RATE_LIMIT_WINDOW_MS, RATE_LIMIT_MAX_GLOBAL, RATE_LIMIT_MAX_AUTH, RATE_LIMIT_MAX_API

backend/src/setup-env.ts sets safe defaults for tests, including local test DB URL and fallback JWT secret.