Configuration
Environment variables
Everything lives in apps/api/.env. Copy .env.example as a starting point.
Required
| Variable | Example | Purpose |
|---|---|---|
| MONGODB_URI | mongodb://127.0.0.1:27017/chatdock | MongoDB connection string |
| REDIS_HOST | 127.0.0.1 | Redis hostname |
| REDIS_PORT | 6379 | Redis port |
| JWT_SECRET | 64-char random hex | Signs access tokens |
| JWT_REFRESH_SECRET | 64-char random hex | Signs refresh tokens |
Generate the secrets with:
openssl rand -hex 48The 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
| Variable | Purpose |
|---|---|
| CLIENT_URL | Web app origin, used for emails |
| ADMIN_APP_URL | Admin console origin |
| API_URL | Public API base URL |
| ALLOWED_ORIGINS | Comma-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.