Mermaid source for the C4 Container-level system diagram. Inlined into Dashboard §Architecture. Edit here, not there.

System C4 (Container Level)

Canonical mermaid source for the C4 Container-level system architecture. The Dashboard inlines the diagram block below.

Containers and ports are derived from:

  • docker-compose.yml (Postgres 5433, Redis 6379, Keycloak 8080)
  • src/api/index.ts (Bun.serve port 3000)
  • frontend/kundkort/ (kundkort SPA)
  • KB/ subproject (port 3001, see KB Overview)
  • ECOAPI/ (port 3100, archived per project memory; retained as legacy link from kundkort — see EcoAPI Integration)
  • src/workers/* (Scrape, Enrich, Update, Art14, Playwright)

External services come from project memory and source imports:

  • Bolagsverket VärdefullaDatamängder gateway (gw.api.bolagsverket.se)
  • SCB PxWebApi v2
  • Crawlee + Playwright (self-hosted)
  • Google Places API
  • Firecrawl (fallback scraper)
  • Anthropic SDK (used by KB chat)

Diagram

flowchart TB
    subgraph Browser["User Browser"]
        KK[kundkort SPA<br/>React + Tremor]
        KBUI[KB SPA<br/>:3001]
    end

    subgraph Backend["DBPOC Backend"]
        API["REST API<br/>Bun.serve :3000<br/>src/api/index.ts"]
        ECO["EcoAPI<br/>:3100 legacy"]
        SCRAPE["Scrape Worker<br/>src/queues/workers.ts"]
        ENR["Enrich Worker<br/>src/workers/enrichWorker.ts<br/>concurrency 20"]
        UPD["Update Worker<br/>src/workers/updateWorker.ts<br/>concurrency 50"]
        PW["Playwright Worker<br/>src/workers/playwrightWorker.ts"]
        A14["Art14 Worker<br/>src/workers/art14Worker.ts"]
        DISP["Enrich Dispatcher<br/>src/workers/enrichDispatcher.ts<br/>~160 / hr"]
    end

    subgraph Data["Stateful Containers"]
        PG[("Postgres :5433<br/>enrichnodedb<br/>+ pgvector")]
        REDIS[("Redis :6379<br/>BullMQ + cache")]
        KC[("Keycloak :8080<br/>auth")]
    end

    subgraph External["External services"]
        BV[Bolagsverket Gateway<br/>gw.api.bolagsverket.se]
        SCB[SCB PxWebApi v2]
        CRAWL[Crawlee + Playwright<br/>self-hosted]
        GP[Google Places]
        FC[Firecrawl]
        ANT[Anthropic SDK<br/>KB chat]
    end

     API -> data
    API --> PG
    API --> REDIS
    API --> KC

     Worker dependencies on external
    ENR --> BV
    ENR --> SCB
    ENR --> GP
    ENR --> FC
    PW --> CRAWL
    ENR -.delegates.-> PW

Notes

  • The diagram intentionally shows both the in-process pipeline (src/queues/workers.ts) and the Phase 3 isolated worker processes (src/workers/*Worker.ts). They share the same BullMQ queues, so only one of each pair runs at a time.
  • Playwright is shown as a separate worker because of the P1 concurrency issue documented in Known Issues — the planned decoupling target.
  • ECOAPI is marked legacy per project memory note feedback_obsidian_vault and the 2ce58c8 chore: archive obsolete root files and ECOAPI subproject commit on master.