What a CRDT is
A conflict free replicated data type is a data structure whose merge operation is automatically consistent. Any two replicas that have seen the same set of edits end up identical, regardless of the order those edits arrived, with no transform step and often no central server.
How text CRDTs work
Each character gets a globally unique identifier that never changes once assigned. Instead of integer positions, the document is an ordered set of these identifiers. Two concurrent inserts at the same spot are ordered deterministically by comparing their ids, so every replica picks the same winner.
The tradeoffs
- Strength is that merging is associative and commutative, so any order works.
- Cost is metadata overhead, since each character carries an id and deleted characters often linger as tombstones.
Modern libraries shrink the overhead with block compression that stores runs of consecutive characters under one id range.
Key idea
A text CRDT gives each character a stable unique id so concurrent inserts merge deterministically without any transform.