Yjs vs Loro: CRDT Comparison for the JSON Schema Editor
Detailed comparison of Yjs and Loro CRDT implementations for the JSON Schema ↔ GraphQL collaborative editor.
Executive Summary
Yjs is the recommended choice for production applications requiring stability, extensive integrations, and managed hosting.
Loro is recommended for innovative projects requiring local-first architecture, built-in version control, and cutting-edge performance.
1. Core Technology
| Attribute | Yjs | Loro |
|---|---|---|
| Language | JavaScript | Rust → WebAssembly |
| First Release | 2015 | 2023 |
| Architecture | Client-server (WebSocket/WebRTC) | Local-first, P2P capable |
| CRDT Type | Optimized CRDT with tombstone GC | Advanced CRDT with rich types |
| Bundle Size | ~60 KB gzipped | ~150 KB (WASM + JS bindings) |
2. Performance Benchmarks
| Operation | Yjs | Loro | Winner |
|---|---|---|---|
| Insert 1000 chars | ~10ms | ~5ms | Loro |
| Delete 1000 chars | ~8ms | ~4ms | Loro |
| Sync 10KB document | ~50ms | ~30ms | Loro |
| Initial load | ~100ms | ~200ms | Yjs |
| Memory per operation | ~80 bytes | ~50 bytes | Loro |
Yjs: Fast for typical editing, quick startup, but network-dependent and history grows over time.
Loro: Extremely fast operations, no network latency (local-first), efficient memory, but has WASM startup overhead (~100ms) and a larger initial download.
3. Feature Comparison
Core Features
| Feature | Yjs | Loro |
|---|---|---|
| Text editing | ✅ Excellent | ✅ Excellent |
| Rich text | ✅ Via Y.XmlFragment | ✅ Native support |
| Arrays/Lists | ✅ Y.Array | ✅ List + MovableList |
| Maps/Objects | ✅ Y.Map | ✅ Map |
| Trees | ❌ Via workarounds | ✅ Native Tree type |
| Undo/Redo | ✅ Via UndoManager | ✅ Built-in |
| Time travel | ⚠️ Via snapshots | ✅ First-class feature |
| Cursors/Awareness | ✅ Built-in | ⚠️ DIY |
| Transactions | ✅ Yes | ✅ Yes |
Collaboration Features
| Feature | Yjs | Loro |
|---|---|---|
| Real-time sync | ✅ Excellent | ✅ Excellent |
| Offline editing | ⚠️ Limited | ✅ Full support |
| Conflict resolution | ✅ Automatic | ✅ Automatic |
| User presence | ✅ Awareness API | ⚠️ DIY |
| Cursor tracking | ✅ Built-in | ⚠️ DIY |
| Network protocols | ✅ WebSocket, WebRTC | ⚠️ DIY |
4. Developer Experience
Setup Complexity
Yjs:
npm install yjs y-monaco y-websocket
npx y-websocket # Start serverDifficulty: Medium (requires server)
Loro:
npm install loro-crdt
# No server needed!Difficulty: Easy (optional server)
Code Complexity
Yjs — Monaco Binding:
import { MonacoBinding } from "y-monaco";
const binding = new MonacoBinding(
ytext,
editor.getModel(),
new Set([editor]),
awareness,
);
// ~5 linesLoro — Monaco Binding (manual):
loroDoc.subscribe((event) => {
const content = loroText.toString();
editor.setValue(content);
});
editor.onDidChangeModelContent((e) => {
for (const change of e.changes) {
loroText.delete(change.rangeOffset, change.rangeLength);
loroText.insert(change.rangeOffset, change.text);
}
});
// ~30–50 lines5. Ecosystem
Yjs
- Editor Bindings: Monaco, Quill, ProseMirror, CodeMirror (all official)
- Network Providers: y-websocket, y-webrtc, y-indexeddb
- Managed Hosting: Liveblocks, PartyKit, Hocuspocus
- Community: 13k+ GitHub stars, 100+ contributors, extensive docs
Loro
- Editor Bindings: DIY (Monaco planned)
- Network Providers: DIY
- Managed Hosting: None yet
- Community: 3k+ GitHub stars, 20+ contributors, growing docs
6. Network Architecture
| Aspect | Yjs (Server-Centric) | Loro (Local-First) |
|---|---|---|
| Pros | Central auth, simple discovery, ready servers | No server needed, zero latency, works offline |
| Cons | Server cost, single point of failure, latency | Must build sync layer, peer discovery |
7. Decision Matrix
| Priority | Weight | Yjs | Loro | Winner |
|---|---|---|---|---|
| Stability | 10 | 10 | 7 | Yjs |
| Performance | 8 | 8 | 10 | Loro |
| Ease of Setup | 7 | 6 | 9 | Loro |
| Ecosystem | 9 | 10 | 5 | Yjs |
| Offline Support | 7 | 4 | 10 | Loro |
| Time Travel | 6 | 5 | 10 | Loro |
| Weighted Total | — | 435 | 417 | Yjs |
8. Recommendations
Choose Yjs If:
- Building for production today
- Team collaboration is the primary use case
- You need managed hosting or ready-made editor bindings
- Stability > Innovation
Choose Loro If:
- Building a local-first application
- Offline capability or time travel are core features
- Performance is paramount and you’re comfortable with newer tech
- Zero server costs are important
Hybrid Approach
Start with Yjs for MVP/production launch, then evaluate Loro as it matures for offline mode or version history features.
Related
- Collaborative Editing internals — implementation details for the Loro-based demo
- Visual SDL Editor — graphql-editor integration