A scalable, conflict-free real-time collaborative editing backend — inspired by Google Docs — built with Node.js, Socket.IO, Redis Pub/Sub, and MongoDB. Supports multiple concurrent users editing the same document with Operational Transform (OT) conflict resolution and multi-instance horizontal scaling.
- Real-Time Text Editing
- Operational Transform (OT) conflict resolution
- Redis Pub/Sub cross-server sync
- MongoDB persistence with versioning
- Supports multi-character insert/delete/paste
- Ready for horizontal scaling and deployment
Layer | Tech |
---|---|
Server | Node.js + Express |
WebSocket Engine | Socket.IO |
State Sync Engine | Operational Transform (Custom) |
Pub/Sub Broker | Redis |
Database | MongoDB + Mongoose |
Frontend (Basic) | HTML, CSS, JS |
git clone https://github.com/yourusername/collab-editor-backend.git
cd collab-editor-backend
npm install
Using Docker:
# Redis
docker run --name redis -p 6379:6379 redis
# MongoDB
docker run --name mongo -p 27017:27017 mongo
Or install them locally if Docker is not preferred.
# Terminal 1
npx cross-env PORT=3000 node server.js
# Terminal 2
npx cross-env PORT=3001 node server.js
Open http://localhost:3000
and http://localhost:3001
in browser tabs to test real-time sync across servers.
- Users joining the same
docId
will see each other’s edits in real time. - Edits propagate across servers via Redis.
- Operational Transform ensures conflict-free syncing.
- User Authentication & Role-based Access
- Live Cursors & User Presence
- Docker + Docker Compose Setup
- Cloud Deployment on Render / Railway / EC2
- Load Testing with 1000+ simulated users
Tanishq Parihar B.Tech CSE (Data Science), IIIT Nagpur LinkedIn | GitHub
This project is licensed under the MIT License.