Real-time Collaboration
Chronicle uses CRDTs (Conflict-free Replicated Data Types) via the fork-node engine to enable seamless real-time collaboration without a central authority.How It Works
Every edit is transformed into a CRDT operation, sent to the relay, merged by fork-node, and broadcast to all connected clients. Because CRDTs are mathematically conflict-free, no operational transformation is needed.Setting Up Collaboration
1. Start the Relay Service
ws://localhost:4000 by default.
2. Configure the Editor
3. Presence Awareness
Connected users appear with colored cursors and selection highlights:Conflict Resolution
fork-node uses Yjs-compatible CRDTs under the hood:- Text operations — character-level insertions and deletions merge automatically
- Structural changes — heading levels, list nesting, and block moves use LWW (Last Writer Wins) with vector clocks
- Concurrent edits — two users typing in the same paragraph see each other’s changes interleave naturally
Edge Cases
| Scenario | Resolution |
|---|---|
| Same character deleted by two users | Idempotent — delete applies once |
| Simultaneous heading change | LWW by vector clock timestamp |
| Offline edits synced later | CRDT merge on reconnection |
| Network partition | Each partition continues independently; merge on heal |
Performance Considerations
- Document size — CRDTs maintain a full operation log. For documents over 100K operations, enable compaction via
compactionThresholdin relay config. - Concurrent users — relay supports up to 50 concurrent editors per document. Beyond that, consider sharding.
- Bandwidth — operations are protobuf-encoded for minimal wire size (~40 bytes per character insert).
Security
All collaboration traffic is authenticated:- Users connect with a JWT issued by aegis-node
- The relay validates the token and checks document-level permissions
- Every operation is signed and recorded in vest-node for audit