# Configuration (/docs/self-host/configuration)



The whole platform reads its configuration from environment variables. This is the canonical
reference; the docker-compose file ships sensible defaults for development.

## API and worker [#api-and-worker]

| Variable                                | Default                                        | What it does                                                                                                                                                                                                            |
| --------------------------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DATABASE_URL`                          | required                                       | Postgres connection (Prisma). Alternatively set `DB_HOST`, `DB_USER`, `DB_PASSWORD` and `DB_NAME`.                                                                                                                      |
| `WEB_ORIGIN`                            | `http://localhost:5173`                        | The public URL of the console. Used as the OAuth redirect origin and for verification. Set it in production.                                                                                                            |
| `PUBLIC_URL`                            | `WEB_ORIGIN`                                   | Origin for redirect and ACS URLs in SSO when separate.                                                                                                                                                                  |
| `RESPONSE_COMPRESSION`                  | `true`                                         | gzip for the console's larger JSON responses (not executions or MCP). Set `false` if a proxy in front already compresses.                                                                                               |
| `CORS_EXTRA_ORIGINS`                    | —                                              | More browser origins allowed to call the API with the session cookie, comma separated. `WEB_ORIGIN` and `PUBLIC_URL` are always allowed; state-changing cookie requests from any other origin get 403.                  |
| `HTTP_IDLE_TIMEOUT_S`                   | `60`                                           | Seconds a connection may sit with no bytes moving before the server closes it (0 disables, max 255). The proxy in front should enforce the real deadline; this only reaps idle connections.                             |
| `API_KEY_PEPPER`                        | required                                       | Salt for hashing API keys. At least 32 characters in production.                                                                                                                                                        |
| `SESSION_TTL_DAYS`                      | `30`                                           | How long a console session lasts at most.                                                                                                                                                                               |
| `SESSION_IDLE_TIMEOUT_DAYS`             | `7`                                            | A session unused for this long ends, whatever its TTL. `0` turns the idle limit off.                                                                                                                                    |
| `DB_POOL_MAX`                           | `10`                                           | Postgres connections this process holds. Keep replicas x `DB_POOL_MAX` + worker under `max_connections`.                                                                                                                |
| `DB_POOL_IDLE_MS`                       | `30000`                                        | How long an idle connection is kept.                                                                                                                                                                                    |
| `DB_CONNECT_TIMEOUT_MS`                 | `5000`                                         | How long a request waits for a free connection before failing.                                                                                                                                                          |
| `DB_STATEMENT_TIMEOUT_MS`               | `60000`                                        | Ends any API statement running longer than this (60 s). The background loops are exempt: they run on their own client with no limit (`DB_JOB_POOL_MAX`). `0` turns the limit off.                                       |
| `DB_JOB_POOL_MAX`                       | `5`                                            | Pool for the background loops (retention, rollups), used only while `DB_STATEMENT_TIMEOUT_MS` is on.                                                                                                                    |
| `DB_UNAVAILABLE_COOLDOWN_MS`            | `3000`                                         | After a request fails to reach Postgres, new requests are refused at once with 503 `UNAVAILABLE` (and `Retry-After`) for this long, then one probes the database. `0` turns the gate off.                               |
| `DATABASE_READ_REPLICA_URL`             | —                                              | Optional read replica. Dashboards, audit exports, backtests and monitoring read from it and fall back to the primary when unset.                                                                                        |
| `CREDENTIALS_ENCRYPTION_KEY`            | required (32 bytes, b64)                       | AES-256-GCM key for credentials, connections, webhook secrets and 2FA secrets.                                                                                                                                          |
| `CREDENTIALS_ENCRYPTION_KEYS_PREVIOUS`  | —                                              | Previous key(s), comma-separated; decryption accepts either.                                                                                                                                                            |
| `WEBHOOK_SIGNING_SECRET`                | `dev-webhook-signing-secret`                   | Shared secret the worker uses to compute webhook signatures. The built-in default is refused in production.                                                                                                             |
| `EMAIL_PROVIDER`                        | —                                              | Transport for transactional email: `resend` or `sendgrid`. Left unset, the provider whose key is set is used (Resend first); with neither, it logs to stdout.                                                           |
| `RESEND_API_KEY`                        | —                                              | Resend API key (`resend.com`). Set it, or `EMAIL_PROVIDER=resend`, to send through Resend.                                                                                                                              |
| `SENDGRID_API_KEY`                      | —                                              | SendGrid API key (`sendgrid.com`). Set it, or `EMAIL_PROVIDER=sendgrid`, to send through SendGrid.                                                                                                                      |
| `EMAIL_FROM`                            | `Decision Control <onboarding@resend.dev>`     | `From` header for outbound email. For SendGrid it must be a verified sender in the account.                                                                                                                             |
| `OUTBOUND_ALLOWED_HOSTS`                | —                                              | Comma-separated allowlist for outbound calls (hostnames; `*.corp.example` works).                                                                                                                                       |
| `EXECUTION_RETENTION_DAYS`              | `90`                                           | Delete executions older than N days; `0` keeps them forever. A project can set its own period (Settings → Data protection), which overrides this.                                                                       |
| `EXECUTION_PAYLOAD_LIMIT_BYTES`         | `262144`                                       | Anything larger is trimmed before being written to the audit record.                                                                                                                                                    |
| `EXECUTION_WRITE_MODE`                  | `sync`                                         | `batched` writes successful runs with no actions behind the response (write-behind); failed runs and runs with actions stay synchronous.                                                                                |
| `EXECUTION_WRITE_FLUSH_MS`              | `50`                                           | How often the write-behind buffer is flushed in `batched` mode.                                                                                                                                                         |
| `EXECUTION_WRITE_BATCH_SIZE`            | `200`                                          | Rows per `createMany` in `batched` mode.                                                                                                                                                                                |
| `EXECUTION_WRITE_BUFFER_MAX`            | `5000`                                         | Buffer ceiling; once it is full, the caller writes synchronously instead.                                                                                                                                               |
| `EXECUTION_TIMEOUT_MS`                  | `30000`                                        | Wall-clock limit for one execution, nested decisions and outbound calls included. Keep it below the timeout of anything in front of the API.                                                                            |
| `EXECUTION_MAX_TOTAL_STEPS`             | `5000`                                         | Steps across a whole execution, nested decisions included (each flow is also limited to 500 on its own).                                                                                                                |
| `EXECUTION_MAX_COMPOSITE_BYTES`         | `4194304`                                      | What `forEach` and `parallel` may hold in memory (outputs and sub-traces) in one execution.                                                                                                                             |
| `NOTIFICATION_RETENTION_DAYS`           | `90`                                           | Delete notifications older than N days; `0` keeps them forever.                                                                                                                                                         |
| `SCHEDULER_ENABLED`                     | `true`                                         | Run the scheduler and the scheduled-record workers in this process. Set `false` on replicas that should not.                                                                                                            |
| `SCHEDULER_POLL_INTERVAL_MS`            | `2000`                                         | How often due jobs are started and queued records are claimed.                                                                                                                                                          |
| `SCHEDULED_MAX_RECORDS`                 | `10000`                                        | The most records one run may queue, whatever the job asks for.                                                                                                                                                          |
| `SCHEDULED_WORKER_BATCH`                | `20`                                           | Records a worker claims per batch, across jobs.                                                                                                                                                                         |
| `SCHEDULED_ITEM_LEASE_MS`               | `300000`                                       | How long a claimed record is reserved before another worker may take it over.                                                                                                                                           |
| `SCHEDULED_RETENTION_DAYS`              | `30`                                           | Delete finished runs and their records older than N days; `0` keeps them forever.                                                                                                                                       |
| `PORT`                                  | `3000`                                         | HTTP port.                                                                                                                                                                                                              |
| `NODE_ENV`                              | `development`                                  | Standard Node.js semantics.                                                                                                                                                                                             |
| `LOG_LEVEL`                             | `info`                                         | Pino log level.                                                                                                                                                                                                         |
| `TRUST_PROXY`                           | `false`                                        | When `true`, `X-Forwarded-For` from nginx is trusted as the client address.                                                                                                                                             |
| `TRUST_PROXY_HOPS`                      | `1`                                            | With `TRUST_PROXY`, how many proxies are in front of the API. The address used is that many entries from the right of `X-Forwarded-For`.                                                                                |
| `WORKER_ENABLED`                        | `true`                                         | Set `false` on the API process when a dedicated worker runs.                                                                                                                                                            |
| `SHUTDOWN_DRAIN_MS`                     | `0`                                            | On SIGTERM, /readyz says `draining` for this long.                                                                                                                                                                      |
| `SHUTDOWN_TIMEOUT_MS`                   | `25000`                                        | Hard cap on graceful shutdown.                                                                                                                                                                                          |
| `MAINTENANCE_INTERVAL_MS`               | `900000`                                       | Housekeeping cadence: expired sessions, rate-limit windows, invitations and retention.                                                                                                                                  |
| `OTEL_EXPORTER_OTLP_ENDPOINT`           | —                                              | OTLP/HTTP endpoint for traces.                                                                                                                                                                                          |
| `OTEL_SERVICE_NAME`                     | `decision-control-api`                         | OTLP service name.                                                                                                                                                                                                      |
| `OTEL_EXPORTER_OTLP_HEADERS`            | —                                              | Extra OTLP headers.                                                                                                                                                                                                     |
| `METRICS_TOKEN`                         | —                                              | Bearer token required on `GET /metrics`; empty disables the check.                                                                                                                                                      |
| `METRICS_PORT`                          | —                                              | Worker's Prometheus port (separate from the API).                                                                                                                                                                       |
| `SEED_ADMIN_EMAIL`                      | `admin@decision-control.local`                 | Email of the admin created by `bun run db:seed`.                                                                                                                                                                        |
| `SEED_ADMIN_PASSWORD`                   | `decision-control`                             | Password of the seeded admin (development only).                                                                                                                                                                        |
| `PLATFORM_ADMIN_DOMAIN`                 | `decisioncontrol.io`                           | An email at this domain always holds the platform `ADMIN` role — how a fresh install gets its first operator without a seed. Empty disables the rule.                                                                   |
| `PLATFORM_ADMIN_EMAILS`                 | —                                              | Extra addresses that always hold the platform `ADMIN` role, comma separated.                                                                                                                                            |
| `BACKTEST_MAX_RECORDS`                  | `1000`                                         | Maximum records one backtest can replay.                                                                                                                                                                                |
| `ALERT_MIN_EXECUTIONS`                  | `20`                                           | Drift / error-rate windows are evaluated only above this floor.                                                                                                                                                         |
| `ALERT_WINDOW_MINUTES`                  | `5`                                            | Window for `execution.error_rate_high`.                                                                                                                                                                                 |
| `ALERT_ERROR_RATE`                      | `0.2`                                          | Error-rate above which `execution.error_rate_high` fires.                                                                                                                                                               |
| `DRIFT_WINDOW_HOURS`                    | `24`                                           | Recent window for drift detection.                                                                                                                                                                                      |
| `DRIFT_BASELINE_DAYS`                   | `7`                                            | Baseline window for drift detection.                                                                                                                                                                                    |
| `DRIFT_THRESHOLD`                       | `0.4`                                          | Relative share change that counts as drift.                                                                                                                                                                             |
| `DRIFT_MIN_POINTS`                      | `0.02`                                         | Absolute share change that counts as drift.                                                                                                                                                                             |
| `DRIFT_MIN_EXECUTIONS`                  | `50`                                           | Minimum executions in each window for drift to be evaluated.                                                                                                                                                            |
| `EXECUTION_BATCH_MAX_ITEMS`             | `100`                                          | Maximum items in one batch execute call.                                                                                                                                                                                |
| `EXECUTION_BATCH_CONCURRENCY`           | `8`                                            | Concurrency recorded per batch execute call.                                                                                                                                                                            |
| `OUTBOX_MAX_ATTEMPTS`                   | `5`                                            | Maximum outbox delivery attempts before a dead letter.                                                                                                                                                                  |
| `CACHE_TTL_MS`                          | `60000`                                        | TTL for entries that should expire even when invalidation was lost.                                                                                                                                                     |
| `VERSION_CACHE_SIZE`                    | `1000`                                         | In-memory cap for published versions.                                                                                                                                                                                   |
| `AUTH_RATE_LIMIT_MAX_PER_IP`            | `30`                                           | Sign-in, sign-up and reset budget per client address, over `AUTH_RATE_LIMIT_WINDOW_MS`.                                                                                                                                 |
| `AUDIT_EXPORT_MAX_ROWS`                 | `100000`                                       | Cap on audit-log export rows (max 1,000,000).                                                                                                                                                                           |
| `AUDIT_SIGNING_KEY`                     | —                                              | Ed25519 PKCS#8 PEM used to sign export manifests.                                                                                                                                                                       |
| `RATE_LIMIT_STORE`                      | `redis` if `REDIS_URL` is set, else `postgres` | `redis`, `postgres` or `memory` (per process, only honest with one instance); if Redis cannot answer, falls back automatically.                                                                                         |
| `MANAGEMENT_RATE_LIMIT_MAX_REQUESTS`    | `1200`                                         | Console and authoring API budget per person or key, over `RATE_LIMIT_WINDOW_MS`. Imports, exports and backtests spend 10-20 units per call.                                                                             |
| `REDIS_URL`                             | —                                              | Redis URL for rate limits and caches.                                                                                                                                                                                   |
| `DB_REPLICA_POOL_MAX`                   | `10`                                           | Connections held to the read replica.                                                                                                                                                                                   |
| `SESSION_COOKIE_SECURE`                 | follows `NODE_ENV`                             | Whether the session cookie carries `Secure` (on in production). Set `false` only to run the console over plain http.                                                                                                    |
| `REQUIRE_EMAIL_VERIFICATION`            | follows `NODE_ENV`                             | Confirm an email before the account can sign in: on in production, off in development.                                                                                                                                  |
| `REGISTRATION_MODE`                     | `open`                                         | Who may create an account: `open`, `invite` (only emails with a pending invitation) or `closed`. SSO sign-in is unaffected.                                                                                             |
| `REGISTRATION_ALLOWED_DOMAINS`          | —                                              | Comma-separated email domains allowed to register in `open` mode; empty allows any.                                                                                                                                     |
| `CAPTCHA_PROVIDER`                      | `none`                                         | CAPTCHA on registration: `none`, `turnstile` or `hcaptcha`. Needs `CAPTCHA_SECRET` and `CAPTCHA_SITE_KEY`.                                                                                                              |
| `CAPTCHA_SECRET`                        | —                                              | Server-side secret that verifies the CAPTCHA token.                                                                                                                                                                     |
| `CAPTCHA_SITE_KEY`                      | —                                              | Public site key the console uses to render the CAPTCHA widget.                                                                                                                                                          |
| `SEED_ADMIN_NAME`                       | `Admin`                                        | Name of the seeded admin.                                                                                                                                                                                               |
| `RATE_LIMIT_WINDOW_MS`                  | `60000`                                        | Window for the execution and management rate limits.                                                                                                                                                                    |
| `RATE_LIMIT_MAX_REQUESTS`               | `600`                                          | Execution API budget per key over `RATE_LIMIT_WINDOW_MS`.                                                                                                                                                               |
| `API_KEY_RATE_LIMIT_OVERRIDE_MAX`       | `100000`                                       | Highest per-key allowance (`rate_limit_override`) an API key may be given.                                                                                                                                              |
| `AUTH_RATE_LIMIT_WINDOW_MS`             | `900000`                                       | Window for the sign-in budgets and failed-login counters.                                                                                                                                                               |
| `AUTH_RATE_LIMIT_MAX_PER_EMAIL`         | `10`                                           | Sign-in, sign-up and reset budget per email address.                                                                                                                                                                    |
| `AUTH_LOGIN_MAX_FAILURES_PER_PAIR`      | `8`                                            | Failed sign-ins from one address against one account before that pair is locked out.                                                                                                                                    |
| `AUTH_LOGIN_MAX_FAILURES_PER_ACCOUNT`   | `40`                                           | Failed sign-ins against one account, from any address, before it is locked out.                                                                                                                                         |
| `AUTH_LOGIN_ALERT_AFTER`                | `5`                                            | Failures after which the account owner is emailed once.                                                                                                                                                                 |
| `REDIS_COMMAND_TIMEOUT_MS`              | `250`                                          | A Redis command slower than this counts as a failure and the database is used.                                                                                                                                          |
| `PUBLIC_FORM_READS_PER_MINUTE`          | `60`                                           | Public form page reads per address per minute.                                                                                                                                                                          |
| `PUBLIC_FORM_UNLOCKS_PER_MINUTE`        | `5`                                            | Public form password attempts per address per minute.                                                                                                                                                                   |
| `PUBLIC_FORM_SUBMISSIONS_PER_IP_MINUTE` | `10`                                           | Public form submissions per address per minute.                                                                                                                                                                         |
| `PUBLIC_FORM_SUBMISSIONS_PER_MINUTE`    | `100`                                          | Public form submissions per minute, per form.                                                                                                                                                                           |
| `INBOUND_WEBHOOK_REQUESTS_PER_MINUTE`   | `1200`                                         | Inbound webhook requests per client address per minute.                                                                                                                                                                 |
| `INBOUND_WEBHOOK_MAX_BODY_BYTES`        | `1048576`                                      | Largest inbound webhook body accepted.                                                                                                                                                                                  |
| `OUTBOX_POLL_INTERVAL_MS`               | `1000`                                         | How often the worker polls the outbox.                                                                                                                                                                                  |
| `OUTBOX_BACKOFF_BASE_MS`                | `1000`                                         | Base of the retry backoff for outbox deliveries.                                                                                                                                                                        |
| `HEARTBEAT_INTERVAL_MS`                 | `15000`                                        | How often each API replica or worker refreshes its heartbeat row; one older than three intervals reads as stale in the admin board.                                                                                     |
| `SCHEDULED_FETCH_SLICE_MS`              | `30000`                                        | How long one pass reads pages for a scheduled run before handing the rest to the next pass.                                                                                                                             |
| `SCHEDULED_MAX_QUEUE_DEPTH`             | `5000`                                         | Reading pauses while a run has this many records waiting.                                                                                                                                                               |
| `HTTP_LOG_MAX_HOT_DAYS`                 | `14`                                           | Ceiling (1-90) on how long HTTP request logs stay in Postgres; older ones go to the archive.                                                                                                                            |
| `HTTP_LOG_MAX_BODY_BYTES`               | `65536`                                        | Per-body cap for captured HTTP logs; larger bodies are cut and flagged.                                                                                                                                                 |
| `HTTP_LOG_BUFFER_MAX`                   | `5000`                                         | Log entries held in memory before new ones are dropped (and counted).                                                                                                                                                   |
| `HTTP_LOG_FLUSH_MS`                     | `1000`                                         | How often the HTTP log buffer is flushed.                                                                                                                                                                               |
| `HTTP_LOG_BATCH_SIZE`                   | `500`                                          | HTTP log rows per insert.                                                                                                                                                                                               |
| `HTTP_LOG_ARCHIVE_INTERVAL_MS`          | `600000`                                       | How often the HTTP log archive job runs.                                                                                                                                                                                |
| `HTTP_LOG_S3_BUCKET`                    | —                                              | Platform S3 bucket for `PLATFORM` log archives; unset disables that target. Also `HTTP_LOG_S3_REGION` (`us-east-1`), `_ENDPOINT`, `_PREFIX` (`http-logs`), `_ACCESS_KEY_ID`, `_SECRET_ACCESS_KEY`, `_FORCE_PATH_STYLE`. |
| `STATS_ROLLUP_RETENTION_DAYS`           | `400`                                          | How long hourly dashboard rollups are kept; `0` keeps them forever.                                                                                                                                                     |
| `STATS_CACHE_MS`                        | `30000`                                        | How long dashboard aggregates are reused; `0` disables.                                                                                                                                                                 |
| `OUTCOME_ROLLUP_BACKFILL_DAYS`          | `35`                                           | How far back the first run of the outcome rollups (monitoring, drift) goes.                                                                                                                                             |
| `OUTBOUND_BREAKER_FAILURES`             | `5`                                            | Consecutive failures to one host before it is not called for the cooldown; `0` turns it off.                                                                                                                            |
| `OUTBOUND_BREAKER_COOLDOWN_MS`          | `30000`                                        | How long a tripped host is not called before a trial call.                                                                                                                                                              |
| `OUTBOUND_MAX_CONCURRENT_PER_HOST`      | `50`                                           | Calls in flight to one host per process; `0` turns it off.                                                                                                                                                              |
| `MAX_CONCURRENT_EXECUTIONS`             | `512`                                          | Executions in flight per process; above it new ones get 503 `OVERLOADED` with `Retry-After`. `0` turns it off.                                                                                                          |
| `TYPESAFE_API_KEY`                      | —                                              | Key for the TypeSafe provider of `ai` nodes (`TYPESAFE_URL`, `AI_MODEL` `jev-latest`, `AI_MAX_QUESTIONS` 20, `AI_TIMEOUT_MS` 30000). Empty disables it: `ai` nodes fail with `AI_DISABLED`.                             |
| `OPENAI_API_KEY`                        | —                                              | Key for the OpenAI provider of `ai` nodes (`OPENAI_URL`); `ANTHROPIC_API_KEY` and `ANTHROPIC_URL` likewise. Empty turns that provider off.                                                                              |
| `ASSISTANT_MODEL`                       | —                                              | Model of the authoring assistant as `provider/model`; empty disables it (`AI_DISABLED`). Also `ASSISTANT_API_KEY`, `ASSISTANT_MAX_DESCRIPTION` (4000) and `ASSISTANT_RATE_LIMIT_PER_MINUTE` (10).                       |

## Database [#database]

The bundled compose file provisions a single Postgres instance; the API image runs migrations on
boot via the `migrate` one-shot service.
