An edge-native chess platform with no origin server. One ChessMatch Durable Object per game holds the authoritative board, clocks, chat, and presence over WebSocket Hibernation, while two global-singleton Durable Objects — Matchmaker and GameLobby — handle pairing and spectator-TV coordination. Player profiles and Elo history live in D1 for cross-player queries (leaderboards, per-time-control ratings), R2 stores immutable PGN/JSON game archives, a Queue drives async Workers AI post-game coaching (via AI Gateway), and Browser Run screenshots the final board for social-preview recap images. An opening explorer indexes every archived game's positions into D1 for move-frequency and win-rate lookups from any position.
Browser (WebSocket + HTTP)
▼
Cloudflare Worker (Astro SSR)
├── ChessMatch DO (one per game)
│ ├── SQLite: board, moves, clocks, chat
│ ├── WebSocket Hibernation (players + spectators)
│ └── Alarm: clock enforcement, archival retries
├── Matchmaker DO (global singleton) ── queue + pairings → D1 profiles/ratings
├── GameLobby DO (global singleton) ─── active games → spectator TV
├── R2 ── immutable PGN + JSON archives, AI coaching output
├── KV ── leaderboard cache
└── Queue → Workers AI (via AI Gateway) → D1 opening explorer
→ Browser Run (recap image)