A type-safe, realtime collaborative graph database running inside a CRDT hit Hacker News front page today, April 21, 2026. @codemix/graph combines graph databases (for modeling relationships) with CRDTs (Conflict-free Replicated Data Types) to enable Google Docs-style collaboration on graph-structured data—no server coordination required. Multiple users can edit simultaneously, even offline, and changes merge automatically when reconnected. This is the “local-first” paradigm gaining momentum in 2026: data stays on your device, syncs peer-to-peer, and works without constant internet connectivity.
Every modern app wants multiplayer features—Figma for design, Notion for docs, collaborative whiteboards for teams. Traditional approaches require WebSockets, central servers, and complex conflict resolution logic. CRDT graph databases eliminate this complexity through automatic merging, offline support, and peer-to-peer sync built directly into the data structure.
CRDTs Enable Conflict-Free Collaboration
CRDTs (Conflict-free Replicated Data Types) are data structures that can be updated independently across multiple devices with changes merging automatically—no central coordinator needed. This enables offline-first apps where data stays on users’ devices and syncs peer-to-peer when connected. The mathematical guarantee: whether sync happens in one second or one hour, all replicas converge to identical state.
The ecosystem is maturing fast. Yjs is the fastest CRDT implementation (community consensus), Automerge v3 achieved 10x memory usage reduction in 2026, and Notion is working on switching to CRDTs for better offline and asynchronous collaboration support. FOSDEM 2026 even dedicated an entire track to “Local-First, sync engines, CRDTs.”
For developers building collaborative apps—team tools, multiplayer features, offline-capable mobile apps—CRDTs eliminate complex server-side merge logic. The trade-off is eventual consistency (not suitable for banking or inventory systems), but for knowledge management, project collaboration, and social platforms, automatic conflict resolution is transformative.
Why Combine CRDTs with Graph Databases
Graph databases model data as nodes (vertices) and relationships (edges), perfect for domains with complex interconnections: knowledge graphs linking concepts, social networks connecting users, org charts showing reporting structures, supply chains tracking vendor relationships. Combining graphs with CRDTs enables collaborative editing of these relationships—add employees to org charts, link notes in knowledge bases, update supply chain connections—all with automatic conflict resolution.
@codemix/graph is “the knowledge graph database for the codemix product intelligence platform,” targeting collaborative knowledge graphs (Roam Research, Obsidian), employee graphs revealing collaboration patterns, and fraud detection graphs exposing hidden connections. The key insight: when application state is represented as a single graph, features like moving content between pages, linking, and transclusions work without synchronization concerns because CRDTs guarantee convergence.
Relationships are first-class citizens in graphs (unlike relational databases with JOIN tables). For collaborative wikis, project management tools, or social platforms, graph plus CRDT equals natural data model plus automatic sync.
Implementation with @codemix/graph
@codemix/graph is a TypeScript-first, type-safe in-memory graph database with Cypher queries and Yjs CRDT integration. Setup requires defining a schema (with Zod or Valibot validation), initializing YGraphStorage, and connecting to a sync provider (WebSocket, WebRTC, or IndexedDB for offline).
import { Graph } from '@codemix/graph';
import { YGraphStorage } from '@codemix/y-graph-storage';
import * as Y from 'yjs';
import { WebsocketProvider } from 'y-websocket';
import { z } from 'zod';
// Define schema with type-safe validation
const schema = {
vertices: {
Person: {
properties: {
name: { type: z.string() },
age: { type: z.number() }
}
}
},
edges: {
knows: { properties: {} }
}
} as const satisfies GraphSchema;
// Initialize with CRDT storage
const doc = new Y.Doc();
const storage = new YGraphStorage(doc, schema);
const graph = new Graph({ schema, storage });
// Connect to sync server for real-time collaboration
const provider = new WebsocketProvider(
'wss://your-sync-server.com',
'room-name',
doc
);
// Add data (syncs automatically to connected peers)
const alice = graph.addVertex("Person", { name: "Alice", age: 30 });
const bob = graph.addVertex("Person", { name: "Bob", age: 25 });
graph.addEdge(alice, "knows", bob, {});
// Query with Cypher
const results = graph.query(`
MATCH (a:Person)-[:knows]->(b:Person)
RETURN a.name, b.name
`);
This example shows complete setup including schema, CRDT storage, sync provider, and querying. No complex server infrastructure—just define schema, add data, connect peers. Type safety catches errors at compile time. For programmatic traversals, @codemix/graph supports Gremlin-style API with type-safe chaining.
CRDT Library Ecosystem: Yjs, Automerge, Loro
Three major CRDT libraries dominate with different trade-offs. Yjs is the fastest implementation with a mature ecosystem including WebSocket and WebRTC providers—the safe default for most projects. Automerge focuses on JSON documents and achieved a 10x memory usage reduction with v3 in 2026, making it ideal for document-centric applications. Loro is a Rust-based bleeding-edge library with snapshot support for fast initial loading, but it’s explicitly not production-ready yet.
Performance matters: ParseTime is significantly higher for Automerge and Loro when the initial document isn’t empty, though Loro’s snapshot concept mitigates this. For new projects, choose Yjs for proven scale and ecosystem maturity, Automerge for JSON-heavy apps requiring memory efficiency, or Loro for experimental cutting-edge performance if you can tolerate the risk.
P2P Alternatives: GunDB and OrbitDB
For fully peer-to-peer graph databases without Yjs, GunDB and OrbitDB offer alternative architectures. GunDB was the first serverless P2P graph database running in browsers, using WebSocket-based real-time replication with its Gun Chainsaw query language and end-to-end encryption. However, the architecture shows its age—built with older JavaScript conventions that may require adaptation for modern developers.
OrbitDB takes a different approach with IPFS-based append-only log storage providing immutability guarantees and graph API with recursive traversals. The key difference: GunDB uses CRDT replication (simultaneous writes without conflicts), while OrbitDB’s append-only log can conflict if multiple clients write the same entry simultaneously. Choose GunDB for real-time sync requirements or OrbitDB when decentralized immutable storage via IPFS is essential.
When to Use CRDT Graph Databases
CRDT graph databases excel for collaborative editing (Figma-style real-time updates), offline-first mobile apps (works on planes and in tunnels), peer-to-peer systems (no central server requirements), and privacy-sensitive apps where data stays on users’ devices to reduce attack surface. Ideal scenarios include collaborative knowledge graphs (Roam, Obsidian with sync), team collaboration tools (org charts, project dependencies), and any application requiring Google Docs-style multiplayer features on graph-structured data.
Skip CRDT graph databases for banking or financial systems requiring strong consistency and ACID transactions, massive datasets measured in terabytes (in-memory constraints bite hard), heavy write contention where thousands of clients write identical data simultaneously, or simple CRUD applications where traditional backend architectures are simpler and more appropriate.
The decision framework is straightforward: need collaboration plus offline plus relationships? Choose CRDT graph databases. Need strong consistency for financial operations? Stick with traditional databases.
Key Takeaways
- CRDT graph databases combine automatic conflict resolution with relationship modeling for collaborative apps. @codemix/graph (trending on HN today) provides TypeScript-first implementation with Yjs integration.
- Yjs is the production-safe default CRDT library with fastest performance and mature ecosystem. Automerge suits JSON-heavy apps with v3’s 10x memory reduction. Loro offers cutting-edge performance but isn’t production-ready.
- Ideal for collaborative knowledge graphs, offline-first tools, and privacy-sensitive apps where data stays on users’ devices. Skip for banking, massive datasets, or simple CRUD apps.
- The local-first paradigm is gaining momentum in 2026 with Notion migrating to CRDTs, FOSDEM dedicated tracks, and growing ecosystem of peer-to-peer graph databases like GunDB and OrbitDB.
- Setup is simpler than traditional collaborative architectures—define schema, initialize CRDT storage, connect sync provider. No complex server-side merge logic required.
Check the @codemix/graph GitHub repository to try locally. For broader CRDT ecosystem overview, see CRDT.tech and the Best CRDT Libraries 2025 guide.








