CRDT Text Buffer Demo

A bite-size simulation of real-time collaborative editing across four peers.

What is a CRDT?

A Conflict-free Replicated Data Type is a data structure that can be independently modified on multiple replicas and still converge to the same state when all updates are exchanged — without central coordination or operational transforms.

RGA (Replicated Growable Array)

For text editing we model the buffer as a sequence of characters. Each character is given a unique identifier (often a Lamport timestamp + node ID). Insertion inserts a new identifier between two existing ones; deletion marks an identifier as tomb-stoned. Because identifiers are totally ordered, merging two replicas' update logs deterministically reconstructs the same sequence.

Demo Mechanics

Why Local-First?

Unlike traditional client–server collaboration, CRDTs enable local-first apps: edits are instant (no round-trip), available offline, and merge automatically once connectivity returns.

Further Resources

← Back to gallery