I abused JS to abuse Yjs
Because I just wanted to keep my TypeScript classes. I was not trying to build a CRDT framework. Honestly, I really, really wanted to avoid building one, and I guess you can see that in the API. I ended up creating Plexus ( https://plexus.here.build/ , https://github.com/here-build/plexus ). I had a fairly large TypeScript object model. It originally grew out of the open-source model by third party, and it already had a mental model I liked: classes, inheritance, object references, Maps, Sets, arrays, and MobX for reactivity. Then I needed it to become collaborative and local-first. The obvious answer was Yjs. The less obvious problem was that I really, really didn't want to rewrite the application around Yjs data model; I wanted to keep using the same classes.
Disclaimer on AI usage inside Plexus: Package core was fully written manually; tests and small amount of latter additions like extra methods on data structures were AI-assisted, but the core was 100% hand-crafted. Examples and some auxiliary packages like y-messageport were mostly AI-written and reviewed thoroughly afterwards. Documentation was originally handwritten; AI only participated in structuring it and proofreading.
The Problem with Yjs
Yjs is a CRDT engine. CRDT, explained very roughly: instead of keeping one authoritative copy of your state, it gives you shared data structures whose changes can be made independently on different peers and later merged without everybody having to serialize their writes through one server. Alice sets foo.bar = 1, Bob sets foo.baz = 2, both get `{bar: 1
Comments
No comments yet. Start the discussion.