@pgbo/core
v1.1.0
Published
Type-safe PostgreSQL Business Objects — tables, views, domains, auto-migration, native i18n
Maintainers
Readme
@pgbo/core
Type-safe PostgreSQL Business Objects — schema DSL, query builder, auto-migration, BO framework, metadata, validation, seeding, testing.
A TypeScript framework for PostgreSQL that enforces a clean three-layer architecture: Tables → Views → Business Objects. Application code never touches tables directly — all access flows through views.
Install
npm install @pgbo/coreOptional peer dependency for validation:
npm install zod@4Quick start
import { createDatabase } from '@pgbo/core'
import { table, view, text, integer } from '@pgbo/core/schema'
const warehouse = table('warehouse', {
columns: {
slug: text().notNull(),
name: text().notNull(),
capacity: integer().min(0),
},
primaryKey: ['slug'],
})
const warehouseView = view('warehouse_view').from(warehouse)
const db = createDatabase({ connectionString: 'postgresql://localhost/mydb' })
const rows = await db.from(warehouseView).execute()Documentation
Full documentation: https://tim-riep.github.io/pgbo/
Source and issues: https://github.com/tim-riep/pgbo
Packages
@pgbo/core— this package@pgbo/fastify— Fastify route factory for CRUD, metadata, value helps, pagination
License
MIT © Tim Riep
