profile
viewpoint

Ask questionsLooking for a minimal implementation of Automerge/CRDTs

Hello!

Sorry for the essay - TL;DR: Do you know of any small CRDTs like the Micromerge you wrote?

Thanks for all your work on Automerge. I've been researching CRDTs as a way of building git-like local-first software and feel like I've come to the right place. It's been very interesting to learn from watching conference talks (including yours!) and reading papers that are referenced in CRDT codebases.

Along with the local-first mindset, I also like to build apps/libraries that are small and more easily understandable, hackable, and interoperable. There's some overlap with those who care about bundle size too; devs who choose lighter libraries options like Preact/NanoID/Svelte/Sinuous may be doing so not only because it helps push against web bloat, but also that there's a better chance they (and future devs to come) will be able to wrap their head around the codebase.

I've been trying to find a small basic CRDT implementation but haven't had much luck. I know CRDTs have a certain level of essential-complexity (especially when focused on efficient text editing), but I know many projects would be happy to have basic list syncing (i.e todo lists, tictactoe, or pixelpusher-like apps that don't focus on text). Similarly, I've been surprised to not yet stumble on something that vibes well with vanilla JS either.

Projects like Automerge, Y.js, and Logux all have a lot of features. That's great for devs who want them, but adds a lot of complexity to apps that are trying to be small. For instance, if I have a 3kb (min+gzip) app that is an orderable todo list with websockets, then Automerge is ~20x larger than the entire app...

I know this isn't true for a lot of React+Redux apps that are already very large and buying into concepts like immutable data. I think it's fair to assume developers might choose those technologies; even Logux is built around assumption that you'll use Redux to implement undo/redo.

Still, I think having small CRDTs will help a lot with their adoption! If I can tell other devs "Paste these 300 lines of code and you'll have basic collaborative syncing" that's huge. Especially if there's a chance they can understand and hack on it. I have actually found this! In an article, https://josephg.com/blog/crdts-are-the-future/

Martin managed to make a tiny, slow implementation of automerge in only about 100 lines of code.

Leading me to your Micromerge CRDT https://github.com/automerge/automerge/blob/performance/test/fuzz_test.js. It looks great. I'm going to move forward with this and try writing some code to help in the manual construction of changes; https://github.com/heyheyhello/etch/blob/work/packages/shared/crdt.ts

I'm writing to you to ask if you've considered more formally publishing something like Micromerge, since there are developers (and article writers) who are looking for examples of small CRDTs. If not, are there small CRDTs you have in mind that you could link to which are more suitable for micro-frameworks?

Thanks!

automerge/automerge

Answer questions HerbCaudill

@heyheyhello @echarles That project (https://github.com/HerbCaudill/todomvc/ ) was kind of a throwaway proof of concept - not totally sure what state it's in.

If you're looking for a basic working example, todo demo in Cevitxe is a better place to start: clone http://github.com/DevResults/cevitxe , then yarn dev:todo:start.

useful!

Related questions

No questions were found.
source:https://uonfu.com/
answerer
Herb Caudill HerbCaudill DevResults Barcelona devresults.com Software for human beings. Global development. Cities. Tools for thinking. RPCV. CEO & founder, @DevResults.
Github User Rank List