Operations
Env, readiness, and useful knobs
Production env
With NODE_ENV=production or CMS_STRICT_CONFIG=true, the server checks required config at startup and exits if something is missing:
| Variable | Notes |
|---|---|
BETTER_AUTH_SECRET | Random secret (≥32 chars) |
CMS_PUBLIC_BASE_URL | Public API origin (https://…) |
CORS_ORIGIN | Admin UI origin |
COOKIE_SECURE | true |
CMS_API_KEY_PEPPER | Required while API keys are required (default) |
Behind a proxy that sets X-Forwarded-*, set CMS_TRUST_PROXY=true so Express trusts one hop for client IP / scheme (the example Caddy overlay sets this).
AI stays off until you set CMS_AI_DRAFTS_ENABLED / CMS_AI_AGENT_ENABLED and OPENROUTER_API_KEY.
Defaults worth knowing
| Setting | Default |
|---|---|
Upload isPublic | false — mark public when you need a keyless URL |
CMS_REQUIRE_API_KEY | true |
CMS_AI_* | false |
Limits
| Scope | Env prefix |
|---|---|
| Login | CMS_RATE_LIMIT_LOGIN_* |
| AI | CMS_RATE_LIMIT_AI_* |
| Global | CMS_RATE_LIMIT_GLOBAL_* |
| Upload size | CMS_UPLOAD_MAX_BYTES |
| Image decode | CMS_IMAGE_MAX_BYTES, CMS_IMAGE_MAX_DIMENSION |
In-process rate limits suit a single API replica; put shared limits at the proxy if you run more than one.
Health
/ok— liveness/ready— includes DB (use for HEALTHCHECK / orchestration)
Apply migrations before relying on /ready (pnpm db:migrate or your image entrypoint).
API keys & drafts
Use read keys from your app’s server. Default list endpoints omit drafts; pass includeDrafts=true when you need them.