Deploy each app separately
Build, configure and run the API, worker, console, docs and landing on their own.
docker-compose.prod.yml runs everything together, but every app has its own Dockerfile and can
be deployed on its own: on different hosts, scaled independently, or only the ones you need. All
builds run from the repository root, because the Dockerfiles copy the shared workspace
(bun.lock, packages/).
| App | Dockerfile | Needs | Required? |
|---|---|---|---|
| API | apps/api/Dockerfile | Postgres, (Redis) | Yes |
| Worker | apps/api/Dockerfile | Postgres, (Redis) | Yes, unless the API runs it itself |
| Console | apps/web/Dockerfile | The API, reachable by URL | Yes, to use the UI |
| Docs | apps/docs/Dockerfile | Nothing | No |
| Landing | apps/landing/Dockerfile | Nothing | No |
API, worker and migrations
The API, the worker and the migration step are one image (apps/api/Dockerfile); the command
picks the process.
docker build -f apps/api/Dockerfile -t decision-control-api .| Process | Command | Port |
|---|---|---|
| API | bun src/index.ts (image default) | 3000 (PORT) |
| Worker | bun src/worker.ts | None (METRICS_PORT opt.) |
| Migrate | bunx --bun prisma migrate deploy | None |
All three read the same environment (see Configuration). The
required variables are DATABASE_URL, WEB_ORIGIN, API_KEY_PEPPER,
CREDENTIALS_ENCRYPTION_KEY and WEBHOOK_SIGNING_SECRET.
# 1. Migrate — before every release, and before the new API starts.
docker run --rm --env-file .env decision-control-api bunx --bun prisma migrate deploy
# 2. API — stateless, run as many as you need.
docker run -d --env-file .env -e WORKER_ENABLED=false -e TRUST_PROXY=true \
-e REDIS_URL=redis://redis:6379 -e RATE_LIMIT_STORE=redis \
-p 3000:3000 decision-control-api
# 3. Worker — outbox delivery and housekeeping. One or more.
docker run -d --env-file .env decision-control-api bun src/worker.ts- Set
WORKER_ENABLED=falseon the API when a separate worker runs; leave it on for a single-process deployment and skip step 3. - Set
REDIS_URLandRATE_LIMIT_STORE=redisas soon as you run more than one API replica, so rate limits are shared. Without Redis each replica counts on its own. - Set
TRUST_PROXY=true(andTRUST_PROXY_HOPS) only when a proxy you control sits in front, soX-Forwarded-Foris the real client address. - Probes:
GET /healthz(liveness) andGET /readyz(readiness). The worker serves no HTTP, so disable the image's HTTP healthcheck for it. - The worker needs
SIGTERMand about 40 s of grace to finish its batch.
Console
A static build served by nginx that also forwards /api to the API, so the browser stays on one
origin (first-party session cookie, no CORS).
docker build -f apps/web/Dockerfile \
--build-arg VITE_DOCS_URL=https://docs.example.com \
-t decision-control-web .
docker run -d -p 8080:80 -e API_UPSTREAM=http://api.internal:3000 decision-control-webVITE_DOCS_URLis a build argument (Vite inlines it). Changing it means rebuilding.API_UPSTREAMis a runtime variable: where/apiand/healthzare forwarded.- The console's public URL is the API's
WEB_ORIGIN. If you place the API on a different origin than the console, route/apito it at your load balancer instead; the console only works against the same origin. - nginx resolves
API_UPSTREAMthrough Docker's embedded DNS (127.0.0.11). Outside a Docker network (ECS, Kubernetes, VMs) use an IP, or skip the proxy and route/apiat the load balancer, as in AWS.
Docs
docker build -f apps/docs/Dockerfile -t decision-control-docs .
docker run -d -p 8081:80 decision-control-docsA static Fumadocs site. No variables, no API. Point VITE_DOCS_URL of the console at its public
URL.
Landing
docker build -f apps/landing/Dockerfile \
--build-arg SITE_URL=https://example.com \
--build-arg PUBLIC_APP_URL=https://decisions.example.com \
--build-arg PUBLIC_DOCS_URL=https://docs.example.com \
-t decision-control-landing .
docker run -d -p 8082:80 decision-control-landingA static Astro site. Every PUBLIC_* value (app, docs and GitHub URLs, the legal entity, address
and contact emails, governing law, status URL) is baked in at build time: change one, rebuild.
Without Docker
The static apps are plain files: bun run --filter @decision-control/web build writes
apps/web/dist, and the docs and landing builds write apps/docs/.output/public and
apps/landing/dist. Serve them from any static host or CDN. The console needs /api routed to
the API on the same origin, and SPA fallback to index.html.
Recommended order
- Postgres (and Redis, if you scale the API).
- Migrate.
- API, then worker.
- Console.
- Docs and landing, any time.