Operational Transformation Algorithms
EngineeringA shared data layer built on Yjs CRDTs (Conflict-free Replicated Data Types) that powers both a collaborative text editor and a mind-map visualization interface from the same underlying document state. The project required designing reversible projection algorithms that maintain real-time bidirectional synchronization between linear text (Y.Text) and hierarchical graph (Y.Map/Y.Array) representations.
The system supports fully offline-first operation with seamless merges when clients reconnect, ensuring consistency, intent preservation, and low-latency synchronization across all connected clients. When a user edits text in the document view, the changes are immediately and correctly reflected in the mind-map visualization, and vice versa — a node rearrangement in the mind-map correctly restructures the text document.
The architecture addresses one of the hardest problems in collaborative software: maintaining semantic consistency between two fundamentally different data representations that are being concurrently edited by multiple users. Our solution introduces a novel 'dual projection' CRDT model where changes to either representation generate transformation operations that preserve the user's intent in both views. The implementation includes stable ID anchoring for reliable cross-reference between representations, real-time conflict resolution with visual indicators for concurrent edits, and a comprehensive undo/redo system that works correctly across both views and multiple users.