Configuration reference
The API is configured with environment variables, validated at startup. An invalid or missing value stops the process with a message that names it.
#Core
| Variable | Default | Description |
DATABASE_URL | required | PostgreSQL URL of the application role (not a superuser) |
NODE_ENV | development | production on servers |
PORT | 4000 | API port |
TENANCY_MODE | single | single (one organization) or multi |
SETUP_TOKEN | unset | If set, first-run setup requires the x-setup-token header (16+ characters) |
CORS_ORIGINS | empty | Comma-separated browser origins allowed to call the API directly with cookies |
TRUST_PROXY | false | Set true behind a reverse proxy so client IPs are correct |
#Sessions and security
| Variable | Default | Description |
SESSION_TTL_HOURS | 168 (7 days) | Session lifetime |
SESSION_COOKIE_NAME | bcms_session | Cookie name |
COOKIE_SECURE | true in production | Send cookies only over HTTPS |
RATE_LIMIT_PER_MINUTE | 600 | Requests per minute per API key or IP |
AUTH_RATE_LIMIT_PER_MINUTE | 10 | Login and setup attempts per minute per IP |
MAX_JSON_BODY | 1mb | Maximum JSON request body (kb/mb) |
| Variable | Default | Description |
STORAGE_DRIVER | local | local or s3 |
STORAGE_LOCAL_DIR | ./storage | Folder for local uploads |
MEDIA_MAX_BYTES | 10 MB | Maximum upload size in bytes |
S3_BUCKET | | Required for s3 |
S3_REGION | auto | Bucket region |
S3_ENDPOINT | | Custom endpoint (R2, MinIO, …) |
S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY | | Credentials (or use the environment's IAM role) |
S3_FORCE_PATH_STYLE | false | true for MinIO |
#Quotas and retention
| Variable | Default | Description |
TENANT_MAX_RECORDS | 0 (unlimited) | Live records per workspace |
TENANT_MAX_MEDIA_BYTES | 0 (unlimited) | Media storage per workspace |
AUDIT_RETENTION_DAYS | 365 | Audit events older than this are pruned by maintenance |
TRASH_RETENTION_DAYS | 30 | Trashed records and media older than this are purged |
#Extensions and logging
| Variable | Default | Description |
TEMPLATES_DIR | <repo>/templates | Folder with template manifests |
PLUGINS_DIR | <repo>/plugins | Folder with trusted plugins |
PLUGIN_HOOK_TIMEOUT_MS | 2000 | Maximum time per plugin hook |
LOG_LEVEL | info | fatal, error, warn, info, debug, trace, silent |
LOG_FORMAT | json | json for log collectors, pretty for development |
#Admin Studio
| Variable | Default | Description |
API_URL | http://localhost:4000 | Where the Admin Studio forwards /api requests. Read at runtime |
PORT | 3000 | Admin Studio port |
#Docker Compose settings
docker-compose.prod.yml reads .env.production:
| Variable | Description |
DOMAIN | Public host name. Caddy gets a certificate for it |
POSTGRES_PASSWORD | Database superuser (setup, backups, restores) |
APP_DB_PASSWORD | Application role password |
SETUP_TOKEN | Protects first-run setup |
TENANCY_MODE, COOKIE_SECURE, LOG_LEVEL, STORAGE_DRIVER, S3_*, TENANT_MAX_* | Passed through to the API |