Real-Time Collaborative Code Editor Ships the Pipeline and Skips the Conflict Engine
WebSocket rooms, Redis Pub/Sub, a job queue, and a Docker worker cluster. A small Turborepo project shows the full shape of a browser IDE, minus the one problem that makes collaboration hard.
- The repo wires four services and a single Redis instance into a working cloud IDE shape you can read end to end.
- Collaboration and execution are separate planes: a Redis list queues untrusted jobs, and Docker workers pull them off.
- The one problem a collaborative editor exists to solve, two people editing the same line, has no documented operational transform or CRDT.
- What makes a cloud IDE hard is not the plumbing, and this project is the clearest proof of where the difficulty actually lives.
Four Services, One Room
Most collaborative editor repos are Monaco wrapped in a WebSocket. This one is a small distributed system, and you can read every wire. Four services run side by side, and one Redis 7 instance sits behind all of them, doing two jobs at once.
- Frontend: React 18, Vite, Recoil, Monaco, Tailwind, on port 5173.
- Room server:
wsplusnode-redis, holding rooms and presence in memory, on port 5000. - Submit endpoint: Express 4, a single
POST /submitthat enqueues work, on port 3000. - Worker cluster: three Node processes that pull jobs and run Docker containers.
- Redis 7: the pub/sub bus for collaboration and the job queue for execution, in one instance.
Rooms are simple by design. A user creates a six-digit code, others join with it, and the room server holds membership in its own memory. Presence, the shared language selection, and the shared stdin all live there. When someone types, the edit relays to everyone in the room.
The project is a solo portfolio build, published in October 2024 by KishanVyas308. Its purpose is to demonstrate an end-to-end architecture, not to ship a product, and that framing matters for everything that follows.
A real-time collaborative code editor that allows multiple users to edit and execute code simultaneously.
Where the Code Actually Runs
A Run click is the most interesting thing in the repo, because it leaves the browser entirely. The editor POSTs to the Express server with the source, the language, and the room id. Express does almost nothing with it: it pushes the job onto a Redis list and returns.
On the other side, three worker processes are blocked on BRPOP. When a job lands, one of them wakes up, reads the language, and spins a fresh Docker container for it. The container runs the code, the worker captures stdout and stderr, tears the container down, and publishes the result to a Redis Pub/Sub channel.
Every browser in the room is subscribed to that channel. The output lands on all of them at once, not just the person who clicked Run. That fanout is what makes shared execution feel shared.
The language support is a plain switch. Six branches, each one a different way to get code into a container.
switch (language) {
case "javascript":
cmd = ["node", "-e", code];
break;
case "python":
cmd = ["python3", "-c", code];
break;
case "cpp":
// write source, compile with g++, then run the binary
break;
case "rust":
// write source, compile with rustc, then run the binary
break;
case "java":
// write source, javac, then java
break;
case "go":
cmd = ["go", "run", "main.go"];
break;
}
The queue is doing real work here. Execution is slow and unbounded, so it does not belong in the request path. Pushing it onto a list and letting workers pull means the API stays fast and adding capacity is a matter of starting another worker. BRPOP is a pull, not a push, so no coordinator has to decide who gets the next job.
The Collaboration Plane
The room server is the part that looks like every other collaborative editor, and mostly is. It keeps a map of rooms to sockets in memory, relays edits, and tracks who is present. Redis Pub/Sub is what lets more than one server instance stay in sync: a message published by one instance reaches subscribers on all of them.
The honest limitation is durability. Room state lives in RAM. Restart the server and the room is gone. Run two instances and a user's socket is pinned to one of them. There is no persistence layer for documents, because there is no document model to persist.
That is fine for a demo and a real constraint for anything else.
The Sync Problem Nobody Solved
Here is the twist. Two people editing a document at the same time is not one problem. It is two, and they are very different sizes.
The first is transport: getting bytes from one browser to the others quickly. This repo solves that. The second is convergence: making sure that when two people type on the same line at the same moment, every browser ends up with the same text. That one is hard, and as far as the sources establish, this repo does not address it.
A naive shared document applies edits in the order they arrive. If two edits target the same position, the later one overwrites the earlier one. The first person's keystrokes vanish. This is a lost update, and it is the exact failure a collaborative editor exists to prevent.
The standard fixes are operational transformation, which rewrites concurrent edits so they commute, and CRDTs, which make edits merge automatically by construction. Neither is documented in this project. The editor relays text; it does not reconcile it.
Framed fairly, that is a scope choice. For a portfolio project whose point is the execution pipeline, skipping the conflict engine is defensible. It is also the most useful thing the repo teaches, because it shows where the difficulty actually lives. The plumbing is a weekend. The convergence is the product.
How It Compares
| Project | Sync model | Shared execution | Hosting | Best for |
|---|---|---|---|---|
| This repo | None documented (no OT or CRDT) | Yes, Docker workers | Self-hosted | Studying an end-to-end architecture |
| CodeSync | Server-authoritative state, versions, presence | Not claimed | Self-hosted | Sync correctness |
| Replit / CodeSandbox | Proprietary multiplayer | Yes, shared runtime | Hosted | Real work, fast |
| VS Code Live Share | Relay plus peer document deltas | No (the developer's own machine) | Hosted relay | Pairing in your real editor |
| CoderPad / HackerRank | Interview-oriented | Yes | Hosted | Hiring loops |
The target repo is the only row that exposes the full queue-and-worker execution architecture in open source. That is exactly why it is worth reading, and exactly why it is not production-ready.
What to Steal, What to Fix
The architecture is worth copying in three places.
- Separate the collaboration plane from the execution plane. They have different scaling needs and different failure modes.
- Never run untrusted code in the request path. Queue it, pull it, sandbox it.
- Publish results to a channel so the whole room sees output, not just the submitter.
A fork that wanted to become a product would need three things first.
- A conflict engine. CRDT or OT, but pick one.
- Durable room state, so a restart does not wipe the room.
- Hardened sandboxing with real resource limits. Docker is isolation, not a security guarantee.





