BoilerPrompt
Bolt

Bolt prompt to build a booking / scheduling app

Scheduling apps are where UI-only logic goes to fail, so this prompt anchors Bolt's build on a database constraint, a unique index on service and start time, that makes double booking impossible no matter what the client shows. Around that you get slot generation with buffers, timezone-aware rendering, and an owner calendar.

Last updated

Prompt
Build a booking app in this Bolt project: a public page where clients pick a slot, and an owner view for availability. Vite + React, Supabase for data and auth, every timestamp stored UTC.

Data model as Supabase migrations:
- services: id, name, duration_min, buffer_min, active.
- availability_rules: id, weekday, start_time, end_time.
- bookings: id, service_id, starts_at timestamptz, client_name, client_email, status, plus a unique index on (service_id, starts_at) so double booking fails at the database, not just in the UI.

Public flow at /book:
1. Pick a service from a card list showing duration.
2. A week view of open slots computed server-side from availability rules minus existing bookings minus buffer time, rendered in the visitor's local timezone with the timezone name printed under the grid.
3. Confirm with name and email, inline validation, then a confirmation screen with a cancel link carrying a signed token.

Owner view at /admin behind Supabase auth: a weekly calendar of bookings with click-to-cancel, and an availability editor of weekday rows with add and remove time ranges. Overlapping ranges merge on save with a notice.

Edge cases: past slots never render, a slot taken between page load and confirm returns a slot_taken error and refreshes the grid, cancelled bookings free their slot immediately, and slot generation gets checked across a daylight saving boundary week.

Empty states: an owner with no availability sees a setup prompt, and no active services hides the public flow behind a Coming soon card.

Acceptance: book a slot in the preview, open a second tab, try booking the same slot, and confirm the unique index rejects the duplicate.

Same task in other tools

Questions about this prompt

Why compute open slots server-side instead of in the React app?

The slot list depends on availability rules, existing bookings, and buffer math, and any client-side version goes stale the moment someone else books. Computing on request keeps one source of truth, and the unique index catches the remaining race when two visitors confirm the same slot at once.

How do I extend this to multiple staff members or locations?

Add an owner_id to services and availability_rules and scope the slot query by it. The unique index still holds because a service belongs to one owner, and the pick, view, confirm flow does not change. Ask Bolt for that as a follow-up migration rather than folding it into the first build.

Slots show at the wrong hour for visitors in another timezone. What broke?

Somewhere a timestamptz became a bare string. Store UTC, transmit ISO timestamps with offsets, and convert only at render using the browser's own timezone. The prompt prints the detected timezone under the grid so testers notice this. If that label is right but times are wrong, the conversion is happening twice.

Related prompts