Skip to content

Architecture

The web app never runs model logic directly. All compute happens in the backend worker.

flowchart LR
U[Browser] -->|HTTPS| W[apps/web<br/>Next.js dashboard]
W -->|Authorization: Bearer ...| API[scenario_engine v2 API<br/>FastAPI]
API --> DB[(Postgres)]
API --> FS[(Filesystem storage)]
API --> Q[(Redis queue)]
Q --> WK[scenario_engine worker]
WK -->|executes| AMMM[AMMM library]
WK --> FS
WK --> DB
  1. Inputs are uploaded and stored on disk under STORAGE_ROOT and recorded in Postgres.
  2. A run is created via /v2/runs (API enqueues a job to Redis).
  3. The worker executes AMMM in a subprocess and writes results under STORAGE_ROOT/runs/{run_id}/....
  4. The UI lists artefacts/logs via /v2/runs/{run_id}/artifacts and related endpoints.