57 lines
1.8 KiB
Text
57 lines
1.8 KiB
Text
Cola - Text CRDT for Real-Time Collaborative Editing
|
|
=====================================================
|
|
|
|
https://github.com/nomad/cola
|
|
|
|
What is it?
|
|
A Rust library implementing a Conflict-free Replicated Data Type (CRDT)
|
|
specifically designed for collaborative text editing. Allows multiple peers
|
|
to edit the same document concurrently without a central server.
|
|
|
|
|
|
Why it's interesting
|
|
--------------------
|
|
- Peer-to-peer: no server needed, peers sync directly
|
|
- Convergence guaranteed: all replicas eventually reach same state
|
|
- Designed for text: not a generic CRDT, optimized for editing operations
|
|
- Rust: fast, safe, could compile to WASM for browser or FFI for other langs
|
|
|
|
|
|
How CRDTs work (simplified)
|
|
---------------------------
|
|
Instead of "insert char at position 5", operations are like "insert char
|
|
after unique-id-xyz". Each character gets a unique ID based on who inserted
|
|
it and when. This means concurrent edits never conflict - they just get
|
|
ordered deterministically.
|
|
|
|
|
|
Potential uses
|
|
--------------
|
|
- Build an editor-agnostic collab layer
|
|
- Terminal multiplexer with shared buffers
|
|
- Plugin backend for vim/emacs/helix
|
|
- Pair with a simple transport (WebRTC, TCP, WebSocket)
|
|
|
|
|
|
To explore
|
|
----------
|
|
1. Clone the repo, run the examples
|
|
2. Look at the Replica and Insertion types
|
|
3. See how edits are encoded and merged
|
|
4. Think about what transport layer you'd use
|
|
5. Consider: could this power a "collab daemon" that editors connect to?
|
|
|
|
|
|
Related projects
|
|
----------------
|
|
- Automerge: more general CRDT, bigger community
|
|
- Yjs: JavaScript CRDT, powers many web editors
|
|
- diamond-types: another Rust text CRDT, by the Automerge folks
|
|
|
|
|
|
Links
|
|
-----
|
|
Repo: https://github.com/nomad/cola
|
|
CRDTs: https://crdt.tech
|
|
Automerge: https://automerge.org
|
|
Yjs: https://yjs.dev
|