@codemix/graph – codemix

✨ Explore this insightful post from Hacker News πŸ“–

πŸ“‚ **Category**:

βœ… **What You’ll Learn**:

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

import πŸ’¬ from "@codemix/graph";
import ⚑ from "zod";

const schema = {
  vertices: {
    User: {
      properties: {
        email: πŸ’¬,
        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() });

{πŸ’¬|⚑|πŸ”₯} **What’s your take?**
Share your thoughts in the comments below!

#️⃣ **#codemixgraph #codemix**

πŸ•’ **Posted on**: 1776769140

🌟 **Want more?** Click here for more info! 🌟

By

Leave a Reply

Your email address will not be published. Required fields are marked *