Production-grade scheduling infrastructure for developers. Drop-in slot engine, Drizzle ORM schema, and copy-paste React components. Ship a full booking system in hours, not weeks.
npm install @thebookingkit/core// Server action — zero config required import { getAvailableSlots } from "@thebookingkit/core" const slots = getAvailableSlots( // RRULE-based availability windows rules, // AvailabilityRuleInput[] overrides, // date-specific changes bookings, // existing confirmed bookings range, // { start: Date, end: Date } "America/New_York", { duration: 30, // minutes bufferBefore: 5, bufferAfter: 5, } ) // slots → Slot[] with localStart, // startTime, endTime — ready to render slots.length // → 22 available
A real barber shop booking system — Fade & Shave Barbershop — powered entirely by @thebookingkit/core. All slot computation runs server-side using pure functions.
Precision cut with clippers and scissors, includes hot towel finish.
Professional beard sculpting with straight razor edge-up.
Full haircut with beard trim and shape. Our most popular service.
Custom questionsTraditional straight razor shave with hot towel treatment and aftershave.
Patient and fun haircuts for the little ones.
Custom questionsHaircut, beard trim, hot towel shave, and scalp massage. The full experience.
Custom questionsInteractive demonstrations of the scheduling engine. Every computation runs server-side using the same pure functions you would use in your app.
Computing slots...
getTeamSlots() and assignHost() compute availability across multiple providers with intelligent assignment.
Union of all member slots. assignHost() picks the next barber based on booking count and priority.
Six advanced scheduling primitives, each with interactive demos backed by live server action calls to @thebookingkit/core.
Each package has a single responsibility and clear boundaries. Use only what you need.
The scheduling math engine. Framework-agnostic pure functions for slot computation, team scheduling, recurring bookings, routing forms, payments, kiosk, and walk-in.
import { getAvailableSlots } from "@thebookingkit/core";
const slots = getAvailableSlots(
rules, overrides, bookings,
{ start, end }, timezone,
{ duration: 30, bufferBefore: 5 }
);Backend infrastructure: auth adapters, webhook signing, API key management, email templates, background job adapters, booking tokens, and multi-tenancy utilities.
import { withSerializableRetry } from "@thebookingkit/server";
// Automatically retries on SQLSTATE 40001
const booking = await withSerializableRetry(
() => db.transaction(createBooking)
);Drizzle ORM schema and migrations for PostgreSQL 15+. Includes btree_gist extension for EXCLUDE constraints, audit triggers, and GDPR helpers.
import { db } from "@thebookingkit/db";
import { bookings } from "@thebookingkit/db/schema";
// Drizzle ORM — type-safe queries
const upcoming = await db
.select()
.from(bookings)
.where(eq(bookings.status, "confirmed"));Cloudflare D1 (SQLite) adapter with UTC date codec, advisory locking for double-booking prevention, and weekly schedule conversion utilities.
import { D1BookingLock } from "@thebookingkit/d1";
// Advisory lock prevents double-bookings
// on Cloudflare D1 (no SKIP LOCKED)
const lock = new D1BookingLock(db);
await lock.withLock(slotKey, createBooking);Scaffolding CLI for adding components, running database migrations, and initializing new projects. Uses the registry.json component manifest.
# Scaffold a new project npx thebookingkit init my-booking-app # Add a UI component from the registry npx thebookingkit add booking-calendar # Run database migrations npx thebookingkit migrate
React components built on shadcn/ui conventions. Add them to your project with the CLI. You own the source — customize freely.
npx thebookingkit add booking-calendarnpx thebookingkit add slot-pickernpx thebookingkit add booking-formnpx thebookingkit add booking-confirmnpx thebookingkit add booking-successnpx thebookingkit add service-cardnpx thebookingkit add service-gridnpx thebookingkit add service-badgenpx thebookingkit add provider-cardnpx thebookingkit add provider-selectornpx thebookingkit add team-availability-gridnpx thebookingkit add bookings-tablenpx thebookingkit add booking-statsnpx thebookingkit add schedule-editornpx thebookingkit add override-calendarnpx thebookingkit add walk-in-queuenpx thebookingkit add check-in-kiosknpx thebookingkit add wait-time-badgenpx thebookingkit add timezone-selectornpx thebookingkit add status-badgenpx thebookingkit add copy-snippetnpx thebookingkit add embed-generatorClean separation between scheduling logic, backend infrastructure, and database schema. Swap any external dependency without touching your booking logic.
Pure scheduling math — no side effects, no I/O, no framework dependencies. Works in browser, Node, and Cloudflare Workers.
Backend infrastructure with swappable adapters. Handles auth, email, webhooks, background jobs, and booking tokens.
Drizzle ORM schema for PostgreSQL 15+. EXCLUDE USING gist prevents double-bookings at the database level. SERIALIZABLE transactions with retry.