Jump to an app, a write-up or an action
Hosts set weekly hours and date overrides; invitees pick a slot in their own time zone. The interesting problems are correctness ones: never double-book, and never show a wrong time.


Checking for a free slot and then inserting is a race: two requests can both see the slot as free. Instead, Postgres enforces it. An exclusion constraint (EXCLUDE USING gist, with btree_gist) rejects any confirmed booking whose time range, including the buffer after it, overlaps another for the same host.
The server still re-computes the slot list before inserting, so nobody can book outside working hours, and it turns a constraint violation (23P01) into a friendly "that time was just booked" message. An end-to-end test races two browsers for the same slot and asserts exactly one wins.
Availability is stored as wall-clock minutes in the host's time zone, and slots are generated with the Temporal API, so 9:00 stays 9:00 when the clocks change. The tests cover a DST week and a window that crosses the skipped hour.
The visitor's time zone is only known in the browser, so the booking widget renders after hydration instead of guessing on the server, which would cause a hydration mismatch.
View the codeEach booking gets a private manage link. The token is 32 random bytes; only its SHA-256 hash is stored, comparisons are constant-time, and the page sets Referrer-Policy: no-referrer so the token can't leak to other sites.
Emails are sent with after(), once the response has gone out, so a slow email provider never delays a booking. Without an API key they're logged instead, which keeps local development free.