CRDTs for Collaborative Edge Applications: Conflict-Free Replicated Data Types

Why Central Consensus Scales Poorly

Collaborative applications—shared documents, whiteboards, IoT device states, distributed task lists—require replicas to converge despite network partitions and concurrent edits. Traditional databases rely on centralized consensus (Paxos, Raft) or serializable transactions to order every write. That model works inside a datacenter but falters at the edge, where devices operate offline, latency is high, and writes arrive from disconnected peers.

Conflict-Free Replicated Data Types (CRDTs) offer an alternative: data structures designed so that concurrent updates from any replica can be merged deterministically without coordination.

How CRDTs Guarantee Convergence

CRDTs come in two flavors:

  • State-based (CvRDT): Replicas periodically exchange full state. A merge function combines states, and the structure guarantees convergence if merge is commutative, associative, and idempotent.
  • Operation-based (CmRDT): Replicas broadcast operations that are prepared to be applied in any order while preserving intent.

Common examples include grow-only sets, last-writer-wins registers, counters (PN-Counters), and sequence CRDTs for collaborative text.

Edge and Offline-First Patterns

In edge computing, devices may lose connectivity for extended periods. CRDTs let each device accept writes locally and merge changes when connectivity returns. This enables:

  1. Offline-first editing: Users collaborate without a live server.
  2. Eventual consistency: All replicas converge to the same state once messages are delivered.
  3. No lock contention: Writers never block on a central lock or consensus round.

Libraries such as Automerge bring JSON-like CRDT semantics to application developers, letting them model shared documents as nested maps, lists, and text with automatic conflict resolution.

Tradeoffs and Limitations

Dimension CRDT Approach Centralized Consensus
Write availability High (local writes) Bounded by leader/quorum
Conflict resolution Automatic, deterministic Application-defined or last-write-wins
State size Can grow with metadata/tombstones Bounded by log compaction
Semantic conflicts Not resolved automatically Not resolved automatically

CRDTs solve syntactic convergence, not semantic intent. Two users deleting the same item while another edits it still require application-level merge policies. Designers must choose data types whose merge behavior matches business semantics.

References