Skip to content

Schema Overview

The Booking Kit’s database schema consists of 23 tables managed by Drizzle ORM with full TypeScript type inference.

TableDescription
providersService providers (doctors, stylists, consultants). Includes metadata JSONB for settings.
event_typesBookable services. Duration, price, questions, limits, confirmation mode.
availability_rulesRecurring schedules using RRULE. Linked to providers.
availability_overridesDate-specific schedule modifications (block/extend hours).
bookingsCustomer appointments. starts_at/ends_at in UTC with EXCLUDE USING gist.
booking_eventsAppend-only audit trail for every booking status change.
out_of_officeExtended unavailability periods (vacations, leave).
TableDescription
teamsGroups of providers with assignment strategy.
team_membersProvider membership in teams with role.
team_event_typesEvent types associated with teams.
TableDescription
paymentsPayment records linked to bookings. Amount, status, Stripe IDs.
TableDescription
workflowsWorkflow definitions (trigger, conditions, actions).
workflow_logsExecution history for workflows.
webhook_subscriptionsRegistered webhook endpoints with triggers and secrets.
webhook_deliveriesDelivery attempts with response status and retry count.
TableDescription
recurring_seriesRecurring booking series metadata (frequency, count).
seat_attendeesIndividual attendees for group/seat bookings.
TableDescription
api_keysAPI keys with scopes, rate limits, and expiry.
TableDescription
organizationsTenant organizations with branding and settings.
organization_membersUser membership in organizations with roles.

All tables include:

ColumnTypeDescription
iduuidPrimary key (auto-generated)
created_attimestampRow creation time
updated_attimestampLast modification (auto-updated via trigger)

Most tables include an optional organization_id column for multi-tenancy scoping.

EXCLUDE USING gist (
provider_id WITH =,
tstzrange(starts_at, ends_at) WITH &&
) WHERE (status NOT IN ('cancelled', 'rejected'))

Requires the btree_gist extension.

EnumValues
booking_statuspending, confirmed, completed, cancelled, rescheduled, no_show, rejected
payment_statuspending, succeeded, failed, refunded, partially_refunded
payment_typebooking, cancellation_fee, no_show_fee, refund
assignment_strategyround_robin, collective, managed, fixed
recurring_frequencyweekly, biweekly, monthly
seat_statusconfirmed, cancelled, waitlisted
workflow_triggerbooking.created, booking.confirmed, booking.cancelled, etc.
packages/db/src/schema/
├── tables.ts # All 23 table definitions
└── enums.ts # All enum definitions