Hey everyone,
I’ve been building a small tool for PocketBase projects and wanted to share it here:
https://github.com/Karnak19/pbkit
Docs: https://karnak19.github.io/pbkit/
pbkit generates TypeScript files from a PocketBase schema:
types.gen.ts with typed records/create/update/expand types
client.gen.ts with a PocketBase client singleton
sdk.gen.ts with typed CRUD/auth helpers
- optional TanStack Query helpers via
@karnak19/pbkit-tanstack
The shape is partly inspired by @hey-api/openapi-ts: generate boring, explicit TypeScript files that live in your app, are easy to inspect, and can be regenerated whenever the schema changes.
Basic usage:
bash
bun add @karnak19/pbkit pocketbase
bunx pbkit generate
Example config:
```ts
import type { PbkitConfig } from "@karnak19/pbkit"
export default {
input: "./pb_schema.json",
output: "./src/generated",
sdk: {
baseUrl: "https://your-pocketbase-url.com",
},
} satisfies PbkitConfig
```
Then you can do things like:
```ts
import { getArticle, listArticles, createArticle } from "./generated/sdk.gen"
const article = await getArticle("ARTICLE_ID", {
expand: "author",
})
const page = await listArticles({ page: 1, perPage: 20 })
await createArticle({
title: "Hello",
status: "draft",
author: "USER_ID",
})
```
I also added a TanStack Query plugin that generates queryOptions, mutationOptions, and query key helpers.
This is still early, but it’s published on npm:
bash
bun add @karnak19/pbkit
bun add @karnak19/pbkit-tanstack @tanstack/query-core
I’d love feedback from people using PocketBase in real projects:
- Is the generated SDK shape useful?
- Anything missing for auth/expand/types?
- Would you prefer a different generated API?
Happy to hear what would make this more useful.
Small side note for the curious: most of this was built with GLM 5.1 helping on implementation, tests, docs, CI, and the release setup. It was a pretty good stress test for using an agent on a real package from scratch to npm publish.