Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not mentioned in the article but CodeMirror has a brilliant story for realtime collaborative editing. You have two options:

- An Operational Transform (OT) based system built by Marijn (the creator of CodeMirror)

- A Conflict Free Replicated Datatype (CRDT) based system using Yjs built by Kevin Jahns (the creator of Yjs) - https://github.com/yjs/y-codemirror

OT Demo: https://codemirror.net/6/examples/collab/

Yjs Demo: https://demos.yjs.dev/codemirror/codemirror.html

Both are brilliant, but I'm a huge fan of Yjs - the number of different bindings to different editors (and state systems) is incredible. It's a great platform to build collaborative tools on and the big plus is offline editing support, you can have a document diverge significantly while offline and still merge successfully. OTs are a little more difficult to make work well for a significant period offline.

I don't know which of the above Replit use, I would suspect the OT version as they mention building a OT system for Ace in the article.



We had to handroll our own OT implementation inhouse (based on https://github.com/ottypes/text-unicode) since we had built the system for it already. I suspect we would've used or forked CodeMirror's collab package if we were starting today.

Also huge fan of yjs, but the implementation is not compatible with codemirror 6, only version 5 (AFAIK)


There is Yjs bindings for CM6: https://github.com/yjs/y-codemirror.next


Amazing, thanks




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: