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 --> DBData flow (high level)
Section titled “Data flow (high level)”- Inputs are uploaded and stored on disk under
STORAGE_ROOTand recorded in Postgres. - A run is created via
/v2/runs(API enqueues a job to Redis). - The worker executes AMMM in a subprocess and writes results under
STORAGE_ROOT/runs/{run_id}/.... - The UI lists artefacts/logs via
/v2/runs/{run_id}/artifactsand related endpoints.