Skip to content

Environment Variables

All variables are validated at startup via Zod in packages/config. The app refuses to boot if required variables are missing or invalid.

Required (all apps)

VariableDescription
DATABASE_URLPostgreSQL connection string
REDIS_URLRedis connection string (used by BullMQ)
JWT_SECRETSecret for signing JWTs — minimum 32 characters
NODE_ENVdevelopment, test, or production

media-api

VariableDescription
R2_ACCOUNT_IDCloudflare account ID
R2_ACCESS_KEY_IDR2 API token access key
R2_SECRET_ACCESS_KEYR2 API token secret key
R2_BUCKET_NAMER2 bucket name
R2_PUBLIC_URLR2 bucket endpoint URL
AWS_REKOGNITION_REGIONAWS region for Rekognition (e.g. us-east-1)
AWS_REKOGNITION_COLLECTION_PREFIXPrefix for Rekognition collection IDs (e.g. acme-photo)

All media-api variables are optional — workers skip gracefully when not configured. This allows the API to start in dev without cloud credentials.

main-api

VariableDescription
STRIPE_SECRET_KEYStripe secret key (sk_live_... or sk_test_...)
STRIPE_WEBHOOK_SECRETStripe webhook signing secret (whsec_...)
RESEND_API_KEYResend API key for transactional email

Docker Compose (backoffice-web)

VariableDescription
BACKOFFICE_API_URLInternal URL to backoffice-api (e.g. http://backoffice-api:3001)
MEDIA_API_URLInternal URL to media-api (e.g. http://media-api:3003)

Docker Compose (main-web)

VariableDescription
MAIN_API_URLInternal URL to main-api (e.g. http://main-api:3002)
MEDIA_API_URLInternal URL to media-api (e.g. http://media-api:3003)

Notes

  • Never read process.env directly in app code — always import env from @repo/config
  • Never commit .env files — only .env.example files belong in the repo
  • Empty string values are treated as undefined (handled by Zod preprocess)

Acme Photo Platform — Internal Documentation