Architecture
A single Rust binary (axum) serves the embedded web UI and the API. The canvas lives in Redis — shared across instances — and real-time updates are pushed to browsers over SSE, fanned out between instances with Redis pub/sub. Without Redis it falls back to an in-memory canvas.
flowchart LR
subgraph B["Browser"]
UI["Web UI<br/>canvas grid + palette"]
ES["EventSource<br/>SSE client"]
end
subgraph SRV["pixelflux (Rust / axum)"]
R["Routes<br/>/ · /admin · /health · /info<br/>/api/canvas · /api/pixel · /api/events"]
ST["AppState<br/>canvas access + broadcast channel"]
R --> ST
end
subgraph RDS["Redis"]
K["canvas (string)"]
PS["pub/sub channel"]
end
UI -->|GET / · GET /api/canvas| R
UI -->|POST /api/pixel| R
R -->|SSE stream| ES
ST <-->|GET / SETRANGE| K
ST <-->|PUBLISH / SUBSCRIBE| PS