Hasty Briefsbeta

Bilingual

A type-safe, realtime collaborative Graph Database in a CRDT

5 hours ago
  • #graph database
  • #real-time collaboration
  • #TypeScript
  • Introduces a graph database demo featuring real airline routes, queryable with TypeScript, and synced via Yjs CRDT for real-time collaboration.
  • Provides installation instructions via npm/pnpm for the @codemix/graph package, noting it's alpha-quality but used in production at codemix.
  • Describes defining a schema using a plain object with vertices, edges, and indexes, validated with libraries like Zod, ensuring type safety in queries and mutations.
  • Shows how to add data (vertices and edges) through the graph instance with typed properties, and update them in place.
  • Explains writing type-safe queries using a Gremlin-style traversal API, with steps for filtering, traversing edges, labeling, and selecting vertices.
  • Details offline-first sync and real-time collaboration by swapping InMemoryGraphStorage for YGraph, enabling conflict-free sync across peers.
  • Covers subscribing to fine-grained changes and live queries that automatically update when the graph changes, even from remote peers.
  • Introduces collaborative property types (e.g., Y.Text, Y.Array) for real-time editing, allowing mutations in place without conflicts.
  • Describes Cypher queries for APIs and LLMs, including parsing and executing queries, parameterization, and mutations, with support for read-only enforcement.
  • Mentions licensing under MIT, historical context as a research project adapted for codemix, and promotes codemix as a tool for managing business domains and codebases.