
Collaborative Document Editor
Local-first collaborative editor with a hand-rolled Yjs CRDT sync engine.
A local-first collaborative editor built with Next.js, Yjs CRDT, and PostgreSQL, with a hand-rolled push/pull sync engine achieving deterministic conflict resolution, offline editing, version restore-as-diff, and Owner/Editor/Viewer RBAC.
Case Study
Challenge
Real-time collaborative editors typically lean on a hosted CRDT backend. I wanted to understand and own the sync engine itself — offline editing, conflict resolution, and version history — rather than treat it as a black box.
Approach
Built a local-first editor on Next.js and Yjs CRDTs with a hand-rolled push/pull sync engine, deterministic conflict resolution, offline editing that reconciles on reconnect, version restore presented as a diff, and Owner/Editor/Viewer RBAC.
Impact
- Deterministic conflict resolution and offline editing via a hand-rolled Yjs push/pull sync engine.
- Version restore presented as a diff rather than a blind overwrite.
- Deployed on Vercel with CI/CD and a Vitest suite covering sync correctness.
Learnings
- Building the sync engine by hand instead of using a hosted CRDT service made the offline/conflict edge cases concrete instead of theoretical.
- Presenting version restore as a diff, not a silent overwrite, matters as much as the CRDT merge logic itself for user trust.
