The Single Hole

Everyone on the internet digs the same hole, live, from Brazil to Japan with a spoon. One shared counter for thousands of clients on a Cloudflare Durable Object, load tested at 6,000 players and 34 ms p95.

The hole on the lawn, every player a spoon tagged with their country and scoops
Overview

The Single Hole (Um Buraco Só) is a free, open source browser game played from a link with no login: everyone digs the same hole, from a backyard in Brazil to a rock garden in Kyoto, with a spoon. Each player is a spoon on the rim, tagged with their country and scoop count; a cross-section shows the eight layers down to the core, and a globe shows who is digging right now and the year we reach Japan at this week's pace. The interesting problem is the number: thousands of clients adding to one shared counter in real time. The room is a single authoritative class with no timers, sockets or storage: connections, raw messages and the clock go in, messages come out, so every rule is unit tested with a fake clock and hosting is a thin adapter, a Node WebSocket server for development and a Cloudflare Worker with one Durable Object in production. The client applies your scoops at once, batches them every 400 ms through a mirror of the server's token bucket, and eases the display toward the server's total plus your unconfirmed scoops without ever going backwards; batches in flight when the connection drops are discarded rather than risk counting twice. Every message is validated before the room sees it, with per-connection and per-IP scoop limits, connection caps, strikes for bad input and a first-come line once the room holds 10,000 players; the country comes from platform headers, never from the client. State is snapshotted every few seconds with a backup copy, and the room refuses to start rather than silently reset a live hole to zero. On Cloudflare it uses the WebSocket Hibernation API, so it costs almost nothing while idle. One room held 6,000 players digging at 34 ms p95 broadcast latency and reached its 10,000-player cap at 55 ms p95. Rendering is three.js with procedural textures and no image assets, with a lazy-loaded globe and ~175 KB of initial JS checked against a budget in CI. No accounts, names or cookies; IPs live only in memory for rate limits.

Highlights
One authoritative room as pure logic (no timers, sockets or storage), unit tested with a fake clock, behind Node and Cloudflare Durable Object adapters
Optimistic client: batches every 400 ms through a mirror of the server's token bucket, and a display that reconciles to the server total without going backwards
Load tested at 6,000 players digging with 34 ms p95 broadcast latency, and 55 ms p95 at the 10,000-player cap, with a waiting line past it
Abuse handling: validated protocol, per-connection and per-IP rate limits, strikes, and country from platform headers, covered by abuse tests
Snapshots with a backup copy, a room that refuses to start rather than reset to zero, and WebSocket Hibernation so it is cheap when idle
three.js with procedural textures and no image assets, a lazy-loaded globe and ~175 KB of initial JS under a CI budget
Technologies
TypeScriptthree.jsWebSocketsCloudflare WorkersDurable ObjectsViteVitestPlaywrightk6

Hiring a senior full-stack engineer? Let's talk.