A real-time collaborative text editor where multiple users can edit the same document simultaneously, inspired by Google Docs.
- Frontend (Vercel): https://collaborative-editor-orcin.vercel.app/
- Backend API + WebSocket (Render): https://collaborative-editor-q37t.onrender.com
Build a real-time collaborative text editor where multiple users can edit the same document simultaneously. Changes should sync instantly across all connected users with robust conflict resolution, while preserving document state and revision history.
- Real-time synchronisation of text changes across multiple users
- User presence indicators showing who is online and currently editing
- Cursor position tracking per user with coloured cursors
- Conflict resolution when multiple users edit the same section
- Basic text formatting: bold, italic, underline
- Document persistence and revision history with restore support
- WebSocket-based real-time communication
- CRDT-based collaboration model for conflict-free merging
- Backend: Node.js + Express + WebSocket support
- Frontend: React + Quill + collaborative editing libraries
- Database: MongoDB Atlas for document and version storage
- Frontend: React, Quill, Yjs, y-quill, y-websocket, quill-cursors, Tailwind CSS
- Backend: Node.js, Express, ws, y-websocket, Mongoose
- Database: MongoDB Atlas
- Deployment: Vercel (frontend), Render (backend)
- Client editors bind Quill to a shared Yjs text type.
- WebSocket provider broadcasts CRDT updates between connected users.
- Yjs handles concurrent edits with conflict-free merge semantics.
- Backend persists periodic snapshots and version entries in MongoDB.
- Revision history is grouped into activity sessions and can be restored.
client/: React applicationserver/: Express API + y-websocket server
- Open
server/ - Create
.envfrom.env.example - Set
MONGO_URIandCLIENT_URL - Install and start:
npm install
npm start- Open
client/ - Create
.envfrom.env.example - Install and start:
npm install
npm startMONGO_URI: MongoDB Atlas connection URIPORT: optional local port (default5000)CLIENT_URL: allowed frontend origin(s), comma-separated
REACT_APP_API_URL: backend HTTP base URLREACT_APP_WS_URL: backend WebSocket URL
- Root directory:
server - Build command:
npm install - Start command:
npm start - Required env vars:
MONGO_URI,CLIENT_URL,NODE_ENV=production
- Root directory:
client - Required env vars:
REACT_APP_API_URL=https://collaborative-editor-q37t.onrender.comREACT_APP_WS_URL=wss://collaborative-editor-q37t.onrender.com
POST /save: persist latest document snapshot and append version entryGET /load/:id: load latest document stateGET /history/:id: fetch saved version history
- Deployment dependency mismatch: Render deployment failed with
Cannot find module 'dotenv'becausedotenvwas used in the server but missing in backend dependencies. - MongoDB connection failures in production: Persistence returned
MongoDB is unavailabledue to URI/password encoding and Atlas network access configuration. - CORS mismatch with Vercel: Backend APIs returned data but browser blocked calls because
CLIENT_URLorigin matching was strict (trailing slash/origin mismatch). - Revision history UX confusion: Version history initially looked noisy and unclear because checkpoint frequency and session grouping were not tuned for user expectations.
- Editor click/cursor placement issues: Quill cursor overlays and editor layout caused unreliable click-to-cursor behavior in production UI.
- Per-document rooms via URL routing: Replace hardcoded
doc1/room-1with route-based IDs (e.g.,/doc/:id) to support multiple independent documents. - Auth and access control: Add user authentication and sharing permissions (owner/editor/viewer).
- Named versions and restore previews: Allow users to label checkpoints and preview diffs before restoring.
- Presence enhancements: Add avatars, user colors in history, and richer status states (idle/typing/away).
- Offline support: Cache local edits and reconcile changes after reconnect.