# Mist — Architecture ## Purpose A private Steam-clone for ~5–10 friends. Distributes games and updates with bandwidth-efficient delta patching. Sized to the actual problem — the complexity is in the delta-patching system, not in the deployment. ## Topology Friends use a regular web/desktop client over the open internet. Public DNS resolves to a border server. Nginx Proxy Manager terminates TLS (Let's Encrypt) and reverse-proxies to the backend VM over Tailscale. The backend VM itself has no public exposure. ``` ┌──────────────────────────────┐ Friend │ Tauri client (Svelte UI │ (open │ inside Rust shell) │ internet) └──────────────┬───────────────┘ │ HTTPS, public domain │ store.mist.example │ admin.mist.example │ dl.mist.example ▼ ┌─────────────────────────────────┐ │ Border server (public IP) │ │ Nginx Proxy Manager + Let's │ │ Encrypt TLS termination │ └────────────────┬────────────────┘ │ Tailscale (private backhaul) ▼ ┌─────────────────────────────────────────────┐ │ Proxmox VM "mist" │ │ Docker Compose stack: │ │ │ │ ┌──────────────┐ ┌──────────────────┐ │ │ │ api │ │ admin-web │ │ │ │ FastAPI: │ │ static Svelte/ │ │ │ │ /auth │ │ TS served by │ │ │ │ /catalog │ │ tiny nginx │ │ │ │ /admin │ │ (calls api with │ │ │ │ /downloads │ │ admin JWT) │ │ │ │ /builds │ └──────────────────┘ │ │ └──────┬───────┘ │ │ │ │ │ ▼ │ │ ┌──────────────┐ │ │ │ worker │ │ │ │ Celery │ same image, │ │ │ delta-gen, │ different entrypoint │ │ │ archive prep,│ │ │ │ notifications│ │ │ └──────┬───────┘ │ │ │ │ │ ▼ │ │ ┌──────────┐ ┌────────┐ ┌─────────────┐ │ │ │ postgres │ │ redis │ │ rabbitmq │ │ │ └──────────┘ └────────┘ └─────────────┘ │ │ │ │ Volumes: │ │ - hot cache (.tar.zst archives) │ │ - postgres data │ │ - redis data │ │ - rabbitmq data │ │ - /mnt/nas → NFS to NAS (games) │ └────────────────────────────────────────────┘ ``` ## Containers | Container | Stack | Owns | |---|---|---| | **api** | FastAPI + SQLAlchemy + Postgres + Redis | Single web app with internally-modular code: `auth/`, `catalog/`, `admin/`, `downloads/`, `builds/`. Issues JWTs. Serves resumable downloads. Receives `mistpipe` uploads. Queues background work into RabbitMQ. | | **worker** | Celery (same image as `api`, different entrypoint) | Consumes RabbitMQ. Runs the heavy stuff: hdiff delta generation, librsync indirect-delta generation, `chain_replay` cold reconstruction, `.tar.zst` archive packing, Discord notifications. | | **admin-web** | SvelteKit, built static + tiny nginx | Admin UI. Calls `api/admin/*` with admin JWT. | | **postgres** | postgres:16 | Catalog, users, build job state. | | **redis** | redis:7 | Celery result backend, cache, ephemeral session data. | | **rabbitmq** | rabbitmq:3.13-management | Celery broker, event bus for `notification.*` events. | ## Non-container artifacts | Artifact | Stack | Notes | |---|---|---| | **client** | Tauri 2 (Rust shell + Svelte UI) | Friend-facing app. Distributed as a per-platform installer. Embeds (or spawns) the patch-application logic. | | **mistpipe** | Python + click | Admin CLI. `login`, `new-game`, `push`, `ls`, `rm`, `resync-steam`. JWT stored in OS keychain. | ## Storage **NAS** (mounted at `/mnt/nas` inside the VM via NFS) is the **source of truth** for game files: ``` /mnt/nas/mist/games/