/work/live-sync.md
live-sync
Collaborative code editor
- status
- prototype
- language
- JavaScript
- year
- 2025
- stack
- Electron · Monaco · Yjs
- note
- forked repository
An Electron + Monaco desktop editor that two people can type in at the same time.
what it is
The repo is the prototype — main process, preload, renderer, Monaco bundled through webpack, save dialog wired up. About 150 lines of glue.
the interesting part is the gap
Two people typing at the same offset is where the naive version dies. A inserts at offset 10, B inserts at offset 10, and from that moment the two clients disagree about what offset 11 means — every operation after that is computed against a different document.
The fix isn't locking the document. It's giving every character a unique ordered ID so insertions commute, which is what a CRDT buys you.
I wrote up the full distance between the prototype and a system that could actually hold a shared buffer across time zones — CRDT vs OT, snapshot drift, runaway op logs — in Lessons Building a Real-Time Collaborative Editor.