A booking page without a booking service
2026-11-18
How /book works: open slots worked out from a few settings, a lock document per slot so nothing is double-booked, and invites from my own calendar.
Most portfolios send you to a scheduling service to book a call. I wanted it to feel like part of the site, with no extra account for me and no third-party page for the client. It turned out to be a small amount of code.
Slots are worked out, not stored
The weekly hours are a handful of settings I change on my admin site: which days, the first and last start time, the call length, how much notice I need and how far ahead you can book. One function turns that into every start time on offer, then drops the ones that are taken, on a day off, or busy on my calendar. The page and the Worker both import it, so they always agree.
openSlots(now, settings, booked, busy) // → ["2026-11-24T14:00:00.000Z", …]One document per slot
Booking a time creates a document named after its start time, with "only if it doesn't exist" set. Two people clicking the same slot at the same moment can't both win: the second write is refused and that person sees what's still free.
Times in your zone, calls in mine
Everything is stored in UTC, which is also Ghana's time all year. The page shows times in the visitor's own time zone, with a switch to GMT, so nobody has to do the maths.
Invites that land in the calendar
Each booking becomes an event on my Google Calendar with its own Meet link, and Google sends you the invite. Cancelling deletes the event, so it disappears from both calendars instead of leaving a ghost.
- If my copy of the email can't be sent, the booking is rolled back: a call I don't know about is worse than no call.
- Turnstile and a hidden field keep bots out, without a CAPTCHA for people.