Shared data types for building collaborative software
It's interesting to me that people still doubt that CRDTs can be used in practice. The fact is that they are already being used in practice by many companies with millions of users for applications like rich-text editing to state management in 3d applications. See https://github.com/yjs/yjs#who-is-using-yjs
In fact, Yjs - a CRDT implementation- is the most downloaded solution for collaborative applications. Even more than ShareDB (the most popular OT-based solution).
Yjs ~90k/week - https://www.npmjs.com/package/yjs
ShareDB ~13k/week - https://www.npmjs.com/package/yjs
The world's fastest CRDT. WIP.
Yep. I've done something very similar on top of Diamond Types for a little personal wiki. This page is synced between all users who have the page open. Its a remarkably small piece of code, outside of the CRDT library itself (which is in rust via wasm). The way it works is:
- On page load, the server sends the whole CRDT document to the browser, and the server streams changes from that point onwards.
- When a change happens in the browser, it makes that change locally then and sends anything the server doesn't know about upstream.
- Whenever the server finds out about a new change, it re-broadcasts that change to any subscribed browser streams.
I'm using the braid HTTP protocol for changes - but we could easily switch to a SSE or websocket solution. It doesn't really matter.
At the moment I'm just using flat files for storage, but there's nothing stopping you using a database instead, except that its a bit awkward to use efficient CRDT packing techniques in a database.
Code is here, if anyone is interested. The whole thing is a few hundred lines all up: https://github.com/josephg/diamond-types/tree/0cb5d7ecf49364...
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.
Show HN: Collaborate on your YC Application with CRDT-powered forms
1 project | news.ycombinator.com | 21 Feb 2024
Wormholers, what can CCP and wormholers do to improve J-Space?
1 project | /r/Eve | 7 Jul 2023
How does Google docs send the changes done by other users in real-time?
1 project | /r/computerscience | 19 Apr 2023
Show HN: Nostr-CRDT – real-time collaborative apps over Nostr
2 projects | news.ycombinator.com | 8 Feb 2023
Yjs: Shared data types for building collaborative software
1 project | news.ycombinator.com | 3 Dec 2022