一种类型安全的、实时协作的图数据库,基于CRDT。
A type-safe, realtime collaborative Graph Database in a CRDT

原始链接: https://codemix.com/graph

用一个普通对象描述顶点、边和索引。属性类型贯穿每个查询、遍历和修改——无需类型转换,没有运行时意外。 ``` import { Graph, GraphSchema, InMemoryGraphStorage } from "@codemix/graph"; import { z } from "zod"; const schema = { vertices: { User: { properties: { email: { type: z.email(), index: { type: "hash", unique: true } }, name: { type: z.string() }, }, }, Repo: { properties: { name: { type: z.string() }, stars: { type: z.number() }, }, }, }, edges: { OWNS: { properties: {} }, FOLLOWS: { properties: {} }, }, } as const satisfies GraphSchema; const graph = new Graph({ schema, storage: new InMemoryGraphStorage() }); ```

最近在Hacker News(codemix.com)上分享了一个新的、类型安全、实时协作的图数据库,它基于CRDT技术。该帖子提交一小时内获得了16点赞和2条评论。 一位评论者推测该数据库对人工智能开发可能很有价值,特别是能够让智能体高效地管理和利用上下文来完成复杂的任务——他们将其比作蚂蚁寻找和适应不断变化的食物来源。他们建议展示一个比简单社交网络示例(如Twitter)更复杂的模式,以展示其人工智能潜力。 数据库的创建者回应说,愿意分享一个更复杂示例的模式:一个航空公司图。 该帖子还提醒大家,YC夏季2026批次的申请截止日期为5月4日。
相关文章

原文

Describe vertices, edges, and indexes in a plain object. Property types flow through every query, traversal, and mutation — no casts, no runtime surprises.

import { Graph, GraphSchema, InMemoryGraphStorage } from "@codemix/graph";
import { z } from "zod";

const schema = {
  vertices: {
    User: {
      properties: {
        email: { type: z.email(), index: { type: "hash", unique: true } },
        name:  { type: z.string() },
      },
    },
    Repo: {
      properties: {
        name:  { type: z.string() },
        stars: { type: z.number() },
      },
    },
  },
  edges: {
    OWNS:    { properties: {} },
    FOLLOWS: { properties: {} },
  },
} as const satisfies GraphSchema;

const graph = new Graph({ schema, storage: new InMemoryGraphStorage() });
联系我们 contact @ memedata.com