kindstore is a registry-driven document store for Bun and SQLite. You define document kinds with Zod, declare which top-level fields are queryable, and keep payload and structural migrations explicit.
Requires Bun at runtime because kindstore uses bun:sqlite.
bun add kindstore zod
import { z } from "zod";
import { kind, kindstore } from "kindstore";
const Post = z.object({
authorId: z.string(),
title: z.string(),
status: z.enum(["draft", "published"]),
});
const db = kindstore({
filename: ":memory:",
schema: {
posts: kind("pst", Post)
.updatedAt()
.index("authorId")
.index("status")
.index("updatedAt"),
},
});
const created = db.posts.create({
authorId: "usr_1",
title: "Hello, kindstore",
status: "published",
});
const published = db.posts.findMany({
where: { status: "published" },
orderBy: { updatedAt: "desc" },
limit: 20,
});
console.log({ created, published });
db.close();
npx skills add alloc/kindstore, or inspect
skills/kindstore/SKILL.md directly.pnpm docs:check to re-emit declarations and execute the examples.120 commits
2 commits
Hacker News (1)
TypeScript
100.0%
kindstore is a registry-driven document store for Bun and SQLite. You define document kinds with Zod, declare which top-level fields are queryable, and keep payload and structural migrations explicit.
Requires Bun at runtime because kindstore uses bun:sqlite.
bun add kindstore zod
import { z } from "zod";
import { kind, kindstore } from "kindstore";
const Post = z.object({
authorId: z.string(),
title: z.string(),
status: z.enum(["draft", "published"]),
});
const db = kindstore({
filename: ":memory:",
schema: {
posts: kind("pst", Post)
.updatedAt()
.index("authorId")
.index("status")
.index("updatedAt"),
},
});
const created = db.posts.create({
authorId: "usr_1",
title: "Hello, kindstore",
status: "published",
});
const published = db.posts.findMany({
where: { status: "published" },
orderBy: { updatedAt: "desc" },
limit: 20,
});
console.log({ created, published });
db.close();
npx skills add alloc/kindstore, or inspect
skills/kindstore/SKILL.md directly.pnpm docs:check to re-emit declarations and execute the examples.Hacker News (1)
120 commits
2 commits
TypeScript
100.0%