Skip to content

gitflarePublicPartly agent-ready50

cf-durable-whiteboard

Realtime collaborative whiteboard on Cloudflare Durable Objects: presence cursors, WebSocket hibernation, SQLite storage, undo, PNG export.

Keep board zoom and pan stable across reloads6eb4fbd
Markdown65 lines2.6 KB

cf-durable-whiteboard

Realtime collaborative whiteboard on Cloudflare. It shows one Durable Object per board, the SQLite storage API, WebSocket Hibernation and presence.

Deploy to Cloudflare

What it shows

  • One Board Durable Object per board id, with SQLite tables shapes and ops.
  • WebSocket Hibernation (ctx.acceptWebSocket, serializeAttachment).
  • Presence and live cursors (relayed, never stored).
  • Per-user undo/redo applied on the server as inverse ops.
  • Tools: pen (3 sizes, 8 colours), rectangle, ellipse, arrow, sticky note, eraser, select/move, pan, zoom 10-400 %. PNG export is rendered client-side.
flowchart LR
  B[Browser] -->|static| A[Assets]
  B -->|GET /ws/:id upgrade| W[Worker]
  B -->|GET /api/boards/:id| W
  W --> D[(Board Durable Object<br/>SQLite + hibernating WebSockets)]
  D -->|op, cursor, peer events| B

Local dev

npm install
npm run dev

Health check: GET /health. Board page: /b/<id>. Open it in two browsers to see shapes and cursors sync.

Tests

npm test
npm run typecheck

Pure logic lives in src/lib/ and is tested in Node with Vitest; the Durable Object is tested through hand-written fakes.

Configuration

wrangler.jsonc defines the assets binding, the Board Durable Object binding with a new_sqlite_classes migration, and staging / production environments that repeat every binding. A previews block serves Worker Previews. Placeholder resource ids, if any, must be replaced with your own before deploying.

Limits: messages over 32 KB are rejected; each socket has a token bucket (60 msgs/s, burst 120) and is closed with 1008 after repeated abuse; the last 500 ops per board are kept.

Deploy

npm run deploy            # top-level
npm run deploy:staging
npx wrangler deploy --env production

Costs

Workers and Durable Objects with SQLite are available on the Workers Free plan within limits; beyond that, usage is billed per request, duration and storage. Hibernation means idle boards do not accrue duration charges. See Cloudflare pricing for current numbers.

Docs

Screenshots

Screenshots will be added under docs/ once the UI is final.

Built with Gitflare

This project was built by coordinated agents on Gitflare, each owning one part (server, UI, docs) and merged after tests passed.

License

Apache-2.0