All selected work

01 / Real-time applications

Settle It

Keeping the room on the same page.

The original Bun/Socket.IO version was deployed. The current rebuild separates a SvelteKit interface, a pure TypeScript rules engine, durable room state, and shared reporting.

TypeScriptSvelteKitCloudflareSQLite

Cloudflare rebuild. Rebuild implemented; hosted and phone playtesting remain to be verified.

The problem

A voting game needs one coherent view of the round even when people reconnect, commands arrive twice, or the results database becomes unavailable. The interesting engineering work is maintaining that shared state without making reporting failures interrupt play.

How it fits together

Each room has a SQLite-backed Cloudflare Durable Object. A pure TypeScript package handles round rules. Room events enter a durable outbox before being exported to D1, which holds shared results. The SvelteKit frontend communicates through a same-origin API path.

Phones / SvelteKitWorker APIRoom + SQLiteOutbox → D1

Decisions & tradeoffs

01Give each room a durable home

Room-local state and round deadlines live together in a Durable Object. This makes the room lifecycle easier to reason about, with the tradeoff of depending on Cloudflare-specific infrastructure.

02Treat retries as normal behavior

Commands carry operation IDs and stored receipts. A repeat can return the prior outcome; reusing an ID with a different payload is rejected. Transactional writes connect the command result to its receipt.

03Keep reporting outside the critical path

The room writes export events to its durable outbox and retries delivery. Reporting can catch up after an outage while room play continues.

Validation & evidence

Evidence from the project’s implementation, test harnesses, and recorded status.

  • Room tests exercise duplicate votes and operation-ID reuse with conflicting content.
  • Deadline tests cover round transitions and duplicate or late alarms.
  • The repository includes outage/export tests and local workerd validation notes.

Current scope

The Cloudflare rebuild is distinct from the original deployed version. Its status document still calls for hosted deployment checks, phone playtesting, and cost measurement. A public demo of the rebuild is not claimed here.

The next engineering step

Validate a complete session on multiple phones, check the hosted WebSocket path, and measure update latency and recovery behavior under a documented setup.