Skip to content

Welcome to pbkit

Generate fully typed TypeScript SDKs from your PocketBase schema.
  • TypeScript types — Auto-generated XxxRecord, XxxCreate, XxxUpdate, and XxxExpand types for every collection.
  • Typed SDK — CRUD functions wrapping the PocketBase JS SDK with full type safety and autocomplete.
  • Plugin system — Extend output with plugins — TanStack Query options, Zod schemas, or write your own.
pbkit.config.ts
export default {
input: "https://my-pb.example.com",
output: "./src/generated",
sdk: {
baseUrl: "https://my-pb.example.com",
},
}
Terminal window
bunx pbkit generate
import { getArticle, createArticle } from "./generated/sdk.gen"
import type { ArticlesRecord } from "./generated/types.gen"
const article: ArticlesRecord = await getArticle("RECORD_ID", {
expand: "author",
})
const created = await createArticle({
title: "Hello",
status: "draft",
author: "USER_ID",
})