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

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/>/ &middot; /admin &middot; /health &middot; /info<br/>/api/canvas &middot; /api/pixel &middot; /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 / &middot; GET /api/canvas| R
    UI -->|POST /api/pixel| R
    R -->|SSE stream| ES
    ST <-->|GET / SETRANGE| K
    ST <-->|PUBLISH / SUBSCRIBE| PS