Booking flow
A customer books from a tenant site (e.g. site-hypno, site-main,
site-shop) against the public, slug-scoped scheduler surface
(/api/public/:slug/*). The request + response shapes are pinned by
@nexus/scheduler-contracts (drift is a runtime 500 — see Contract chain).
sequenceDiagram
actor C as Customer
participant Site as Tenant site
participant SDK as scheduler-sdk
participant API as scheduler-api (/api/public/:slug)
participant DB as Scheduler DB
participant Q as BullMQ (scheduler-worker)
C->>Site: pick service / staff / slot
Site->>SDK: book(request)
SDK->>API: POST /api/public/:slug/book
API->>API: validate request (Zod contract)
API->>DB: insert booking (status=confirmed)
API->>Q: enqueue reminders (24h / 1h)
API->>API: serialize response (Zod contract)
API-->>SDK: { data: booking }
SDK-->>Site: typed booking
Site-->>C: confirmation
Q-->>C: reminder emails/SMS (later, via worker)
Contract chain
Section titled “Contract chain”The booking shape flows one direction so client and server types cannot drift:
flowchart LR
contracts["@nexus/scheduler-contracts<br/>(Zod source of truth)"]
server["scheduler-api<br/>validate + serialize<br/>(drift = 500)"]
sdk["@nexus/scheduler-sdk<br/>z.infer types"]
client["@nexus/business-client<br/>hooks"]
sites["site-main / site-shop / site-hypno"]
contracts --> server
contracts --> sdk
sdk --> client
client --> sites
See also
Section titled “See also”- Glossary: slug, tenant, contract-drift
- Reference: the public API surface under Reference → Scheduler API.