Class booking
Apps/Recipes/Class booking

Build class booking for a yoga or Pilates studio

A schedule where every class has a set number of spots. Book holds a spot for ten minutes while the person fills in their details, a reminder goes the day before, and a booking's link moves or cancels it. Admins see who's coming, change a class's capacity, cancel classes and close the studio on given days.

Web, admins by inviteKind membersRecipe id class-booking

What you'll build

Schedulea class with spotsbooking.holdthe lowest free spotBooking pagea countdownconfirmfrom the linkbooking.notifythe day before

What it shows: Delayed jobs you can watch happen (a hold that expires, a reminder at its time), two people going for the last spot with only one getting it (a unique key, not a count), times in the studio's own time zone, a daily schedule, and email through the team's own Resend account.

Before you start

  • The CLI: npm i -g @inferencebureau/apps, then ib-apps login once.
  • Resend, for confirmations, reminders and admin invites.

Create the app from the recipe

One command creates the app on Inference Bureau and downloads its files into ./my-class-booking. Web is the default platform, so the recipe id is all it takes.

ib-apps create my-class-booking --recipe class-booking

Tour what the recipe loaded

The recipe replaces the starter, keeping the coding-agent guidance. Here's where each piece lives.

WhereWhat's there
weeklyClass/, api/actions/generateSlots.tsThe weekly timetable becomes a slot per class per date the booking window reaches, at its time in the studio's zone, skipping closures. A slot's key is the weekly class and the date, and unique, so the daily run adds only what's missing.
booking/actions/hold.ts, api/lib/bookings.tsA hold takes the lowest free spot with a unique spotKey. Two people at once both pick the same spot and the second write is refused; web/lib/booking.ts tries again and finds the next spot, or a full class. The hold queues booking.expire for the minute it ends.
booking/actions/confirm.ts, move.ts, cancel.tsThe link's token is checked against its hash on the record. One booking per email per class (another unique key), moves and cancellations until the cutoff, admins any time.
booking/actions/notify.tsEvery booking email is a job, the reminder queued for the day before. Each checks it still applies when it runs, so a cancel or a move needs no job cancelled, and each send has an idempotency key.
slot/actions/, closure/actions/Capacity stays between what's taken and the room's spots. Cancelling a class, or closing a day, cancels its bookings in a job and emails each person the reason.
web/app/(site)/, web/app/admin/The schedule, a booking's page with its countdown, My bookings; the admin's week, a class's roster and activity, bookings, the timetable and closures, and settings. The first admin account is the owner's; others sign up from an invite.
tests/class-booking.test.tsWith a fake clock and Resend stubbed: studio time across clock changes, two holds for the last spot, holds that run out, the reminder sent once and not after a cancel, capacity limits, closures.
// api/models/booking/actions/hold.ts (excerpt): the lowest free spot, with a unique spotKey.
const spot = await freeSpot(api, slot, now); // 1 to capacity, skipping spots held or booked
if (!spot) throw new Error("This class is full.");
record.status = "held";
record.spot = spot;
record.spotKey = `${slot.id}:${spot}`; // unique: two people taking spot 8 at once, the second write is refused
record.holdExpiresAt = new Date(now + studio.holdMinutes * 60_000).toISOString();
await save(record);

// onSuccess: the hold ends on its own, a second after its time.
await api.enqueue("booking.expire", {}, { id: record.id, runAt: new Date(new Date(String(record.holdExpiresAt)).getTime() + 1000).toISOString() });

Check what it set on the app

Nothing to do here: this is what the recipe configured, so you know where to look in Settings later.

PlatformWeb, admins by invite
IntegrationsResend
SchedulegenerateSlots, daily

Finish setup

  1. Open /admin: the first account is the owner's
  2. Load the sample week, or add your rooms and classes on Schedule & closures
  3. Set the studio's name and time zone on Settings, and connect Resend in Settings → Integrations so bookings get their emails

In development without Resend, every email goes to Logs with its link. Development has no daily schedule: classes are added when the timetable changes and when a page finds the booking window short.

Run it

ib-apps dev syncs both ways while you work and runs the development server.

cd my-class-booking
ib-apps dev

Try it end to end

0 of 4 checked

Make it yours

Your studio

Name, time zone and booking rules are on the admin's Settings; the timetable and rooms on Schedule & closures.

The emails

Each one is a React Email template in web/emails/, its wording and look in one file, with layout.tsx for the studio's name and logo.

Ship it

ib-apps test runs its tests, then ib-apps deploy sends development to production. See Deploys.