bunderstack
v0.24.0
Published
Batteries-included backend framework for Bun: type-safe oRPC APIs, auth, storage, realtime, jobs, messaging, and validated env from one declaration.
Maintainers
Readme
bunderstack
The complete backend & full-stack framework for Bun: type-safe oRPC APIs, auth, storage, realtime, jobs, messaging, live views, and client bindings from one single file declaration.
bun add bunderstack better-auth drizzle-orm valibot @libsql/clientimport { bunderstack, defineApi } from 'bunderstack'
import { libsql } from 'bunderstack/libsql'
import * as v from 'valibot'
import * as schema from './schema'
export const backend = bunderstack({
schema,
database: { adapter: libsql() },
access: { posts: { crud: true } },
realtime: true,
api: {
ping: defineApi({ schema })
.public.route({ method: 'GET', path: '/api/ping' })
.input(v.optional(v.object({})))
.handler(() => ({ ok: true })),
},
})
export const app = await backend.start()
Bun.serve({ fetch: app.handler })
export type App = typeof appCRUD, custom procedures, webhooks, file buckets, health, and the Publisher
event iterator form one router. Validation accepts Standard Schema; internal
generated schemas use Valibot. OpenAPI is opt-in with openapi: true.
Generated CRUD writes publish automatically. After a custom write commits, publish its complete returned row with:
await context.realtime.publish(schema.posts, 'update', post)Use the in-memory Publisher for one process or configure
realtime: (env) => ({ redis: env.REDIS_URL }) for multi-process delivery and
replay. Deployment metadata is generated with bunx bunderstack blueprint.
Package Subpaths (0.21+)
bunderstack— Declarative backend and runtime (bunderstack,defineApi,buildApiRegistry)bunderstack/testing— Isolated lexical fixtures and reusable test factories (backend.test()/backend.test.configure())bunderstack/provision— Explicit production schema provisioningbunderstack/client— Framework-neutral RPC & LiveView client (createClient,createLiveView)bunderstack/client-rest— Type-safe REST clientbunderstack/client-react,bunderstack/client-solid,bunderstack/client-vue,bunderstack/client-svelte— LiveView UI bindingsbunderstack/query&bunderstack/query-react— TanStack Query client (createClient,syncRealtime)bunderstack/sync— TanStack DB collections (createSyncClient)bunderstack/start&bunderstack/start-auth— TanStack Start full-stack integrationbunderstack/libsql,bunderstack/postgres-js,bunderstack/bun-sql,bunderstack/bun-sqlite,bunderstack/pglite— Database adaptersbunderstack/storage/*— Storage adapters (s3,disk)bunderstack/messaging— Messaging channel descriptors (resend,customEmail,telegram)bunderstack/email-smtp— SMTP email channelbunderstack/jobs/*— Job queue adapters (memory,redis)
See the workspace documentation for webhooks, clients, storage, collections, lifecycle, and complete examples.
Upgrading
Every change is listed with before/after code in the migration guides, which live in full at:
License
MIT
