Configuration

Environment variables

Everything lives in apps/api/.env. Copy .env.example as a starting point.

Required

VariableExamplePurpose
MONGODB_URImongodb://127.0.0.1:27017/chatdockMongoDB connection string
REDIS_HOST127.0.0.1Redis hostname
REDIS_PORT6379Redis port
JWT_SECRET64-char random hexSigns access tokens
JWT_REFRESH_SECRET64-char random hexSigns refresh tokens

Generate the secrets with:

openssl rand -hex 48

The API refuses to start without both JWT secrets, on purpose — so it can never fall back to a default that anyone reading the source could forge.

Application URLs

VariablePurpose
CLIENT_URLWeb app origin, used for emails
ADMIN_APP_URLAdmin console origin
API_URLPublic API base URL
ALLOWED_ORIGINSComma-separated list of browser origins allowed to call the API

ALLOWED_ORIGINS must list every origin the browser will load the app from — your domain, the www variant, and the admin console. Requests from an origin not on the list are refused by CORS.