Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ADR 0012: Web frontend: Leptos SPA with the core compiled to wasm

  • Status: Accepted (2026-11-10)
  • Date: 2026-11-10
  • Deciders: Vincent Mader
  • Related: 07-visualization.md; global ui-design rule

Context

Goal G5 asks for an interactive tool in which every model component can be toggled and visualized. The default web stack is a Leptos SPA. The physics and kernel code should be identical to the CLI to avoid divergent results.

Decision

The web app in web/ is a Leptos SPA that links the core crates compiled to wasm32 and runs heavier work in a Web Worker. Precomputed experiment outputs are loaded as static files (ADR 0011). Hosting: a public static site at https://coag.mader.xyz on mk11 (shared Caddy), deployed by GitHub Actions; English only. No frontend code is written before a design is approved (M10a); the design sprint runs in parallel with M1 and M2, and views then ship with their milestones. The plotting library is chosen in M10a per the data-visualization skill.

Alternatives considered

  • Python dashboard (Dash, Panel, Streamlit): fast to build, but needs a server, duplicates computation in Python, and diverges from the Rust core.
  • Plain TypeScript app with a wasm module: possible, but against the default stack and splits the codebase.
  • Desktop app (Tauri): no advantage for sharing with the group.

Consequences

  • Same numbers in browser and CLI for the same config and seed.
  • Core crates must stay wasm-compatible (no threads required, no file system in core, feature-gated Rayon).