# Bookings

> Bookable resources with weekly hours and exceptions, services with durations and buffers, and bookings that a gist exclusion constraint (btree_gist) keeps from overlapping per seat. Holds expire; recurring series book every occurrence; a share link opens public booking; confirmed bookings mirror into the calendar and reminders.

- Category: Scheduling
- Module: `bookings`
- Modes: `managed`, `custom`
- Docs: https://bettersupabase.com/docs/blocks/bookings
- Page: https://bettersupabase.com/blocks/bookings

## Install

```bash
npx better-supabase add bookings
```

The command also installs `updated-at`, `memberships`, `permissions`, `recurrence`.

## Configure

Add the block to `better-supabase.config.ts`:

```ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  blocks: {
    // Required by bookings; add installs them too.
    "updated-at": {},
    memberships: {},
    permissions: {},
    recurrence: {},
    // Modes: "managed", "custom". The default is "managed".
    bookings: { mode: "managed" },
  },
});
```

## Client

The React hooks are the registry item `@better-supabase/use-bookings` (`npx shadcn add @better-supabase/use-bookings`). They return data and actions and render no UI. Source: https://github.com/ScaleDockHQ/better-supabase/blob/main/packages/registry/items/hooks/use-bookings.ts

## Events

- `booking.archived`
- `booking.cancelled`
- `booking.confirmed`
- `booking.expired`
- `booking.reserved`
- `booking.restored`

## Related blocks

Requires: [memberships](https://bettersupabase.com/blocks/memberships.md), [permissions](https://bettersupabase.com/blocks/permissions.md), [recurrence](https://bettersupabase.com/blocks/recurrence.md)

Works with: [queue](https://bettersupabase.com/blocks/queue.md), [share-links](https://bettersupabase.com/blocks/share-links.md), [rate-limit](https://bettersupabase.com/blocks/rate-limit.md), [calendar](https://bettersupabase.com/blocks/calendar.md), [reminders](https://bettersupabase.com/blocks/reminders.md), [outbox](https://bettersupabase.com/blocks/outbox.md)

## Recipes

- [Booking page](https://bettersupabase.com/recipes/booking-page.md): A public page that shows open slots and books one without overlaps.
- [Availability editor](https://bettersupabase.com/recipes/availability-editor.md): Weekly working hours and date overrides that set which slots can be booked.
