Hacker News new | ask | show | jobs
by eatonphil 1766 days ago
I haven't yet done this but based on some research it seems to me like the core of any collaborative app today (that wants to avoid Firebase and the other hosted platforms like Replicache seems to be) is easiest served by picking some CRDT library.

There are a couple of open-source CRDT libraries that provide both clients and servers (yjs [0] and automerge [1] are two big ones for JavaScript I'm aware of).

My basic assumption is that as long as you put all your relevant data into one of these data structures and have the CRDT library hook into a server for storing the data, you're basically done.

This may be a simplistic view of the problem though. For example I've heard people mention that CRDTs can be space inefficient so you may want/have to do periodic compaction.

[0] https://github.com/yjs/yjs

[1] https://github.com/automerge/automerge

4 comments

You probably don't want to use Automerge. See https://josephg.com/blog/crdts-go-brrr/ for a nice CRDT optimization story.
Interesting! I know there was a large performance refactor that was merged in May [0]. This post you link was written in June of this year. Unclear if the performance fix is related to the reported issues and unsure if it still exists or not.

At the very least, the automerge maintainers seem to be very actively tackling performance problems.

[0] https://github.com/automerge/automerge/pull/253

Yep, the version of automerge I benchmarked for that blog post includes automerge’s performance branch changes.

They’re working on it, but it’ll be awhile before automerge gets close to Yjs in terms of performance.

> is easiest served by picking some CRDT library.

RDBMS A.C.I.D. and transactions are also capable of much of the same.

Replicache is not hosted - it's client-side only. You bring your own backend.
Would Chronofold works for this too?
If this [0] is what you're talking about, at the moment yjs and automerge are significantly more full-featured and used by many major companies.

[0] https://github.com/dkellner/chronofold

Thanks!