Realtime multiplayer documents. Stack is Next.js + Lexical for the editor, Yjs for CRDT sync over WebSockets, Zustand for UI state, and IndexedDB so you can keep typing offline.
npm install
npm run dev- Home page lists docs and creates new ones
/d/<id>is the editor- WebSocket endpoint:
ws://localhost:3000/ws/<docId>
npm test # unit tests (persistence + CRDT helpers)
npm run build # next build (use after deps install)Open the same doc in two browser windows (or an incognito window) to see presence, live cursors, and concurrent edits merge.
| Piece | How |
|---|---|
| Rich text | Lexical |
| Conflict-free sync | Yjs CRDT + custom WS server |
| Live cursors / presence | Yjs awareness |
| Comments & suggestions | Shared Y.Array on the same doc |
| Version history | Snapshots of encoded Yjs state on disk |
| Offline | y-indexeddb + reconnect when back online |
| UI state | Zustand |
server/ custom Node server (Next + WS + file API)
src/app/ Next.js pages
src/components/ editor UI, panels
src/lib/ collab session, zustand store
data/ persisted docs (created at runtime, gitignored)
tests/