Appearance
Level 2: Containers
The processes and data stores inside Hevkar, as deployed by infra/docker-compose.yml. The three browser apps are shown as containers only; they are not detailed further.
Containers
| Container | Technology | Responsibility |
|---|---|---|
| Caddy | Caddy 2 | The only container with public ports. TLS, CSP / HSTS / frame-ancestors headers, one host each for api, console, ops, docs and the S3 endpoint (signed downloads). Sends the realtime WebSocket path to api-realtime. |
| console | React, Vite, TanStack Router/Query, shadcn/ui | Customer console. Frontend, not detailed here. |
| ops | same stack | Super-admin console on its own host. Frontend, not detailed here. |
| docs | VitePress | This site. Frontend, not detailed here. |
| api | Node.js, NestJS 12, Drizzle, Vercel AI SDK | node dist/main.js. Console API (/console, session + org guards), public API (/v1, API-key guard, rate limits), super-admin API (/ops). Runs sync and streaming (SSE) agent runs in process, enqueues async runs, workflow steps, ingestion and webhook deliveries. Mounts better-auth. |
| api-realtime | same image as api | Same command as api; Caddy sends only WS /v1/realtime here, so long-lived voice sockets scale and restart separately from request traffic. Bridges client audio to the realtime provider and meters it. |
| worker | same image, node dist/main.js worker | Boots the same module graph without HTTP (QUEUE_ROLE=worker), so feature modules register their BullMQ processors. Queues: runs, workflows, ingestion, webhooks, files. Repeating jobs: scheduled data source syncs, workflow recovery, hourly file expiry. Scales independently of api. |
| migrate | same image, node dist/db/migrate.js | One-shot: applies pending Drizzle migrations (tables, RLS policies, grants) as the owner role; api and worker start after it succeeds. |
| doc-worker | Python, FastAPI, Docling, Tesseract, pdfium | Internal only (bearer token required in production). /parse, /chunk, /parse-and-chunk, /render-pages, /extract-url. Layout-aware parsing of PDF, DOCX, PPTX, HTML; OCR for scans; page rendering for vision models. Holds no tenant data. Only container besides api/worker with outbound web access. |
| Postgres | Postgres 17 + pgvector | System of record. Tenant tables carry org_id with row-level security on app.org_id (the app role cannot bypass it). Chunks with HNSW vector indexes plus full-text search for hybrid retrieval. better-auth tables in the same schema. |
| Redis | Redis | BullMQ queues and job schedulers, sliding-window /v1 rate limits (fail open, logged), run cancellation flags polled by running runs. |
| SeaweedFS | SeaweedFS (S3 API) | Object storage for uploaded run inputs and data source documents. Clients download through short-lived signed URLs served via Caddy. storage-init creates the bucket at start. |
Networks
Compose splits traffic into networks: backend (api, worker, migrate, doc-worker and the data stores), frontend (Caddy, the browser apps and api / api-realtime / worker, which also gives api and worker their outbound access), files (Caddy to SeaweedFS for signed downloads) and doc-worker-egress (doc-worker's outbound access for /extract-url).
Observability (optional overlay)
infra/docker-compose.observability.yml adds an OpenTelemetry collector, Prometheus, Loki, Tempo and Grafana. api, api-realtime and worker export traces and metrics to the collector; logs are pino JSON.
Previous: Level 1: System context. Next: Level 3: Components.