| ▲ | Lies I was told about collaborative editing, Part 2: Why we don't use Yjs(moment.dev) | |||||||||||||||||||
| 36 points by antics 3 days ago | 15 comments | ||||||||||||||||||||
| ▲ | GermanJablo 21 hours ago | parent | next [-] | |||||||||||||||||||
I remember reading Part 1 back in the day, and this is also an excellent article. I’ve spent 3+ years fighting the same problems while building DocNode and DocSync, two libraries that do exactly what you describe. DocSync is a client-server library that synchronizes documents of any type (Yjs, Loro, Automerge, DocNode) while guaranteeing that all clients apply operations in the same order. It’s a lot more than 40 lines because it handles many things beyond what’s described here. For example: It’s local-first, which means you have to handle race conditions. Multi-tab synchronization works via BroadcastChannel even offline, which is another source of race conditions that needs to be controlled. DocNode is an alternative to Yjs, but with all the simplicity that comes from assuming a central server. No tombstones, no metadata, no vector clock diffing, supports move operations, etc. I think you might find them interesting. Take a look at https://docukit.dev and let me know what you think. | ||||||||||||||||||||
| ||||||||||||||||||||
| ▲ | samwillis 11 minutes ago | parent | prev | next [-] | |||||||||||||||||||
It's disingenuous to suggest that "Yjs deletes and recreates the whole document on each keypress" and that this is "by design" of Yjs. This is a design limitation of the official y-Prosemirror bindings that are integrating two distinct (and complex) projects. The post is implying that this is a flaw in the core Yjs library and an issue with CRDTs as a whole. This is not the case. It is very true that there are nuances you have to deal with when using CRDT toolkits like Yjs and Automerge - the merged state is "correct" as a structure, but may not match your scheme. You have to deal with that into your application (Prosemirror does this for you, if you want it, and can live with the invalid nodes being removed) You can't have your cake and eat it with CRDTs, just as you can't with OT. Both come with compromises and complexities. Your job as a developer is to weigh them for the use case you are designing for. One area in particular that I feel CRDTs may really shine is in agentic systems. The ability to fork+merge at will is incredibly important for async long running tasks. You can validate the state after an agent has worked, and then decide to merge to main or not. Long running forks are more complex to achieve with OT. There is some good content in this post, but it's leaning a little too far towards drama creation for my tast. | ||||||||||||||||||||
| ▲ | samlinnfer an hour ago | parent | prev | next [-] | |||||||||||||||||||
Just use OT like normal people, it’s been proven to work. No tombstones, no infinite storage requirements or forced “compaction”, fairly easy to debug, algorithm is moderate to complex but there are reference open source implementations to cross check against. You need a server for OT but you’re always going to have a server anyway, one extra websocket won’t hurt you. We regularly have 30-50k websockets connected at a time. CRDTs are a meme and are not for serious applications. | ||||||||||||||||||||
| ||||||||||||||||||||
| ▲ | kaiwenwang an hour ago | parent | prev | next [-] | |||||||||||||||||||
It appears Moment is producing "high-performance, collaborative, truly-offline-capable, fully-programmable document editor" - https://www.moment.dev/blog There seems to be a conflict of interest with describing Yjs's performance, which basically does the same thing along with Automerge. | ||||||||||||||||||||
| ||||||||||||||||||||
| ▲ | antics 37 minutes ago | parent | prev | next [-] | |||||||||||||||||||
Hi folks, author here. I thought this was dead! I'm here to answer questions if you have them. | ||||||||||||||||||||
| ||||||||||||||||||||
| ▲ | bawolff an hour ago | parent | prev | next [-] | |||||||||||||||||||
Reminds me a bit of google-mobwrite. I wonder why that fell out of favour. | ||||||||||||||||||||
| ▲ | presspot 3 days ago | parent | prev | next [-] | |||||||||||||||||||
Replacing CRDT with 40 lines of code. Amazing. | ||||||||||||||||||||
| ▲ | truetraveller an hour ago | parent | prev [-] | |||||||||||||||||||
Very likely AI slop, very hard to read. Too many indications. HN should have another rule: explicitly mention if article was written (primarily) by AI. | ||||||||||||||||||||
| ||||||||||||||||||||