{"path":"README.md","content":"# Sketch Rush\n\nDraw-and-guess party game (3–12 players) on one Cloudflare Worker + Durable Objects.\n\n## How to play\nQuick play or create a private room and share the invite link. Each turn the drawer picks one of 3 words and draws it (80 s); others guess in chat. Faster guesses score more; the drawer earns points per correct guess. 3 rounds, then a podium and an automatic new game.\n\n## Run\n`npm install`, `npm run dev`, `npm test`, `npm run bots -- http://localhost:8787 --bots 4`.\n\n## Architecture\n- `src/index.ts` routes (`/health`, `/api/rooms`, `/api/quickplay`, `/api/leaderboard`, `/ws/<CODE>`); `src/room.ts` Room DO (30 Hz alarm tick, hibernating WebSockets); `src/lobby.ts` room directory; `src/leaderboard.ts` D1 (optional).\n- `public/shared/sim.js` deterministic rules; `protocol.js` codecs.\n- Client: `app.js` UI, `net.js`, `render.js`, `input.js`, `tools.js`, `audio.js`, `fx.js`, `ui-helpers.js` (pure helpers).\n\n## Protocol\nClient: `[\"j\",name,token,tick]`, `[\"d\",seq,strokeId,color,size,...xy]`, `[\"u\",seq]`, `[\"c\",seq]`, `[\"g\",seq,text]`, `[\"w\",seq,idx]`, `[\"a\",tick]`, `[\"p\",ms]`.\nServer: `[\"w\",...]` welcome, `[\"s\",...]` delta snapshot, `[\"k\",epoch,fromOp,...ops]` shared stroke ops, `[\"v\",tick,...events]` batched events, `[\"o\",...]` pong, `[\"e\",code,msg]`.\nRate limit: token bucket 60/s, burst 90; 3 strikes close with 1008.\n\n## Security\nCSP in `public/_headers`; all user text is rendered with `textContent`.\n\n## Local D1\n\n`src/leaderboard.ts` creates the `scores` table on first use, so `wrangler dev` works as is. To apply migrations explicitly: `wrangler d1 migrations apply DB --local`.\n","commitSha":"dbe1e99e50bd4e0c491f6804ae316b33e8a24ce4"}