Overview
Awesome CRDT provides a comprehensive collection of resources for understanding and implementing Conflict-free Replicated Data Types (CRDTs). CRDTs enable distributed systems to achieve strong eventual consistency without coordination, making them ideal for offline-first applications and real-time collaboration.
Features
- CRDT Implementations: Yjs, Automerge, RON, Diamond Types
- Research Papers: Academic foundations and latest research
- Tutorials and Guides: Learn CRDT theory and practice
- Type Variants: Counters, registers, sets, lists, trees, text
- Language Support: JavaScript, Rust, Go, Python implementations
- Use Cases: Collaborative editing, distributed databases, P2P apps
- Performance Analysis: Benchmarks and optimization techniques
CRDT Fundamentals
What are CRDTs?
Conflict-free Replicated Data Types are data structures that can be replicated across multiple computers in a network, where replicas can be updated independently and concurrently without coordination, and it is always mathematically possible to resolve inconsistencies that might result.
Types of CRDTs
Operation-based CRDTs (CmRDTs)
- Communicate operations between replicas
- Require reliable broadcast
- Generally more efficient
- Examples: Operation-based counters, sets
State-based CRDTs (CvRDTs)
- Communicate full state between replicas
- Work with unreliable networks
- Simpler to reason about
- Examples: G-Counter, PN-Counter, LWW-Register
CRDT Data Types
Basic Types
Counters
- G-Counter: Grow-only counter
- PN-Counter: Positive-negative counter
- Use cases: View counts, likes, distributed counting
Registers
- LWW-Register: Last-Write-Wins register
- MV-Register: Multi-value register
- Use cases: Configuration values, user profiles
Sets
- G-Set: Grow-only set
- 2P-Set: Two-phase set (add/remove)
- OR-Set: Observed-remove set
- Use cases: Tags, categories, memberships
Complex Types
Sequences and Lists
- RGA: Replicated Growable Array
- LSEQ: List CRDT for collaborative editing
- Use cases: Ordered lists, document structure
Text Editing
- WOOT: Without Operational Transform
- RGA for text
- Use cases: Collaborative text editors
Trees and Graphs
- Replicated trees
- JSON CRDTs
- Use cases: Hierarchical data, documents
Popular Implementations
Yjs
- Language: JavaScript/TypeScript
- Features: High performance, small update size
- Use Cases: Collaborative editors (ProseMirror, CodeMirror, Monaco)
- Network: Supports WebRTC, WebSocket, IPFS
- Bindings: React, Vue, Angular, Svelte
Automerge
- Language: Rust with JS bindings
- Features: JSON-like API, full history
- Use Cases: Document collaboration, local-first apps
- Storage: Efficient binary format
- Sync: Network-agnostic sync protocol
RON (Replicated Object Notation)
- Language: Multiple implementations
- Features: Causal consistency, time travel
- Use Cases: Distributed databases, games
- Protocol: Self-contained operations
Diamond Types
- Language: Rust
- Features: Extremely fast, minimal memory
- Benchmarks: Fastest text CRDT implementation
- Use Cases: Performance-critical applications
Loro
- Language: Rust with WASM
- Features: Next-generation performance
- Use Cases: Modern collaborative apps
- API: Developer-friendly interface
Use Cases
Collaborative Editing
- Google Docs-like functionality
- Code collaboration (VS Code Live Share)
- Rich text editors
- Whiteboarding applications
Offline-First Applications
- Mobile apps with sync
- Desktop applications
- Progressive web apps
- Field data collection
Distributed Systems
- Distributed databases (Riak, Cosmos DB)
- Edge computing
- P2P networks
- IoT device coordination
Real-Time Applications
- Chat applications
- Multiplayer games
- Collaborative design tools
- Shared dashboards
Research and Theory
Foundational Papers
- "Conflict-free Replicated Data Types" by Shapiro et al.
- "A Comprehensive Study of CRDTs" by Shapiro et al.
- "Delta State Replicated Data Types" by Almeida et al.
Recent Research
- List CRDT optimizations
- Tree CRDTs
- Rich text CRDTs
- CRDT composition
Implementation Considerations
- Operation complexity
- Memory overhead
- Network bandwidth
- Garbage collection
Correctness
- Strong eventual consistency
- Causality preservation
- Idempotence
- Commutativity
Practical Concerns
- Tombstone management
- History pruning
- Schema evolution
- Migration strategies
Testing and Visualization
- CRDT visualization tools
- Property-based testing
- Consistency checkers
- Benchmarking suites
Integration
- Database adapters
- Network protocols
- Persistence layers
- Monitoring tools
Resources
- CRDT.tech website
- Local-First Web development
- Martin Kleppmann's lectures
- Ink & Switch research
Pricing
Free and open-source resource.