A full-stack Google Docs–style editor with real-time collaboration powered by Yjs (CRDT) and WebSockets, built using modern web technologies and a scalable architecture.
Deployed App: https://dokupad.mohdriaz.com
- Authentication with Clerk
- Create, edit, and delete documents
- Rich text editing with Tiptap
- Real-time collaboration using Yjs (CRDT)
- WebSocket-based synchronization
- Persistent storage with Convex
- Conflict-free merging of concurrent edits
- Responsive UI with Tailwind CSS
graph TD
%% Node Definitions
Client["Client (Next.js + Tiptap + Yjs)"]
WSServer["Yjs WebSocket Server"]
Convex["Convex Backend (Persistence Layer)"]
%% Connections
Client <==>|"WebSocket (Yjs updates)"| WSServer
WSServer <==>|"Sync + Broadcast"| Convex
This project uses Yjs, a CRDT (Conflict-free Replicated Data Type), to enable seamless multi-user editing.
- Conflict-free updates (no overwrites)
- Efficient real-time synchronization
- Concurrent multi-user editing
- User edits content in Tiptap
- Changes are converted into Yjs updates
- Updates are sent over WebSockets
- Server relays updates to connected clients
- Clients merge updates automatically using CRDT
- Real-time collaboration is enabled only if the document was created while the user had an organization selected in the Clerk organization switcher.
- Documents created without an organization are treated as personal documents and do not support real-time syncing.
This ensures that only users within the same organization can collaborate on shared documents, while personal documents remain private.
- Next.js (App Router)
- React
- Tailwind CSS
- Convex (Database + serverless functions)
- Yjs (CRDT)
- Y-socket.io
- Clerk
Clone repository:
git clone https://github.com/mohd-riaz/DokuPad.git
cd DokuPadInstall client dependencies:
cd client
npm install --legacy-peer-depsSet Convex environment variable:
cd client
npx convex env set CLERK_JWT_ISSUER_DOMAIN "e.g. https://<slug>.clerk.accounts.dev from clerk dashboard."Install server dependencies:
cd server
npm install --legacy-peer-depsStart Next.js:
cd client
npm run devStart Convex backend:
cd client
npx convex devStart Y-socket.io server:
cd server
node server.js- Frontend: Vercel
- Backend: Convex
- Real-time server: Render
- Designing real-time collaborative systems
- Implementing CRDT-based synchronization (Yjs)
- Managing WebSocket communication
- Handling access control for collaborative environments
- Integrating frontend, backend, and real-time layers
MIT License