HeadlinesBriefing favicon HeadlinesBriefing.com

Type‑Safe Real‑Time Graph DB Built on Yjs CRDT

Hacker News •
×

codemix has released an alpha‑stage npm package that delivers a type‑safe, realtime graph database powered by a Yjs CRDT. The library, available as @codemix/graph, runs in any Node or bundler environment without native dependencies. Although marked alpha, the team uses it in production for internal knowledge‑graph workloads, offering a live demo that visualizes airline routes. Developers can also embed the demo in their own pages.

It lets developers declare vertices, edges and indexes in a plain object, wiring the schema to standard validators such as Zod, Valibot or ArkType. Every mutation validates against the schema at compile time and runtime, eliminating casts. A Gremlin‑style traversal API provides type‑checked steps, while built‑in hash, B‑tree and full‑text indexes support fast lookups and ordered queries. Edges may carry arbitrary payloads without extra boilerplate.

Switching the storage to @codemix/y-graph-storage wraps the graph in a Yjs document, granting synchronization across tabs or remote peers. Subscribers receive fine‑grained change events and live queries re‑run when results shift. The same data can be accessed via a Cypher‑compatible string language, making it suitable for LLM back‑ends. The MIT‑licensed project traces back to Charles Pick’s early ts‑sql demo. All operations remain fully type‑checked throughout.