npm.io
0.3.1 • Published 2d ago

@thebookingkit/db

Licence
MIT
Version
0.3.1
Deps
2
Size
239 kB
Vulns
0
Weekly
0

@thebookingkit/db

Drizzle ORM schema and migrations for PostgreSQL-backed booking systems.

npm version License: MIT TypeScript

Part of The Booking Kit — The Headless Booking Primitive.

Install

npm install @thebookingkit/db

Quick Start

import { createDb } from "@thebookingkit/db";
import { bookings, eventTypes, providers } from "@thebookingkit/db/schema";

const db = createDb(process.env.DATABASE_URL!);
const upcoming = await db.select().from(bookings).where(/* ... */);

Key Features

  • 23 PostgreSQL tables — Organizations, providers, event types (with deposit configuration), availability rules, bookings, payments (prepayments, deposits, no-show holds, cancellation fees), webhooks, workflows, and more
  • Double-booking preventionEXCLUDE USING gist constraint with btree_gist extension
  • Full type exports — Inferred select and insert types for every table (Booking, NewBooking, etc.)
  • Booking audit trail — Append-only booking_events table tracks every status change
  • Multi-tenancy ready — Optional organization_id on all tables
  • Custom migrationsrunCustomMigrations for btree_gist, audit triggers, and GDPR compliance
  • Multiple entry points@thebookingkit/db, @thebookingkit/db/schema, @thebookingkit/db/client

Documentation

Full Documentation

License

MIT

Keywords