Skip to content

Repository files navigation

Docs (collaborative editor)

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.

Run

npm install
npm run dev

Open http://localhost:3000

  • 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.

What’s in here

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

Design notes: HLD.md, LLD.md

Layout

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/

About

Collaborative docs editor with Yjs CRDT, Lexical, WebSockets, offline sync

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages