Get started

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

VariableDefaultDescription
DATABASE_URLrequiredPostgreSQL URL of the application role (not a superuser)
NODE_ENVdevelopmentproduction on servers
PORT4000API port
TENANCY_MODEsinglesingle (one organization) or multi
SETUP_TOKENunsetIf set, first-run setup requires the x-setup-token header (16+ characters)
CORS_ORIGINSemptyComma-separated browser origins allowed to call the API directly with cookies
TRUST_PROXYfalseSet true behind a reverse proxy so client IPs are correct

Sessions and security

VariableDefaultDescription
SESSION_TTL_HOURS168 (7 days)Session lifetime
SESSION_COOKIE_NAMEbcms_sessionCookie name
COOKIE_SECUREtrue in productionSend cookies only over HTTPS
RATE_LIMIT_PER_MINUTE600Requests per minute per API key or IP
AUTH_RATE_LIMIT_PER_MINUTE10Login and setup attempts per minute per IP
MAX_JSON_BODY1mbMaximum JSON request body (kb/mb)

Media storage

VariableDefaultDescription
STORAGE_DRIVERlocallocal or s3
STORAGE_LOCAL_DIR./storageFolder for local uploads
MEDIA_MAX_BYTES10 MBMaximum upload size in bytes
S3_BUCKETRequired for s3
S3_REGIONautoBucket region
S3_ENDPOINTCustom endpoint (R2, MinIO, …)
S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEYCredentials (or use the environment's IAM role)
S3_FORCE_PATH_STYLEfalsetrue for MinIO

Quotas and retention

VariableDefaultDescription
TENANT_MAX_RECORDS0 (unlimited)Live records per workspace
TENANT_MAX_MEDIA_BYTES0 (unlimited)Media storage per workspace
AUDIT_RETENTION_DAYS365Audit events older than this are pruned by maintenance
TRASH_RETENTION_DAYS30Trashed records and media older than this are purged

Extensions and logging

VariableDefaultDescription
TEMPLATES_DIR<repo>/templatesFolder with template manifests
PLUGINS_DIR<repo>/pluginsFolder with trusted plugins
PLUGIN_HOOK_TIMEOUT_MS2000Maximum time per plugin hook
LOG_LEVELinfofatal, error, warn, info, debug, trace, silent
LOG_FORMATjsonjson for log collectors, pretty for development

Admin Studio

VariableDefaultDescription
API_URLhttp://localhost:4000Where the Admin Studio forwards /api requests. Read at runtime
PORT3000Admin Studio port

Docker Compose settings

docker-compose.prod.yml reads .env.production:

VariableDescription
DOMAINPublic host name. Caddy gets a certificate for it
POSTGRES_PASSWORDDatabase superuser (setup, backups, restores)
APP_DB_PASSWORDApplication role password
SETUP_TOKENProtects first-run setup
TENANCY_MODE, COOKIE_SECURE, LOG_LEVEL, STORAGE_DRIVER, S3_*, TENANT_MAX_*Passed through to the API

ByteContent by ByteRings is open source under the MIT License. Edit on GitHub