A one-person booking page: visitors see your free times from Google Calendar, pick one, and get an invite with a Meet link. Without credentials it runs on a demo calendar, so you can deploy it first and connect your calendar later.
lib/slots.tsasksfindFreeTimefor open slots in your working hours over the next 14 days.app/actions.tschecks the slot is still free, then books it withcreateEventand emails the invite.lib/calendar.tspicks Google Calendar when credentials are set, and a demo calendar otherwise.
Swapping google() for microsoft() or icloud() from calsdk is the only change needed for Outlook or iCloud.
- In the Google Cloud console, enable the Google Calendar API and create an OAuth client of type "Web application" with
https://developers.google.com/oauthplaygroundas a redirect URI. - Open the OAuth Playground, tick "Use your own OAuth credentials" in the settings, authorize the
https://www.googleapis.com/auth/calendarscope and exchange the code for a refresh token. - Publish the OAuth app (it can stay unverified for your own account). While it is in "Testing", Google expires refresh tokens after 7 days.
- Set these environment variables in Vercel, or in
.env.localwhen running locally:
| Variable | Value |
|---|---|
GOOGLE_CLIENT_ID |
OAuth client ID |
GOOGLE_CLIENT_SECRET |
OAuth client secret |
GOOGLE_REFRESH_TOKEN |
Refresh token from step 2 |
BOOKING_OWNER |
Your name, shown on the page |
BOOKING_TITLE |
Meeting name, such as Intro call |
BOOKING_TIME_ZONE |
IANA zone for your working hours, such as Europe/Berlin |
Meeting length, days ahead and working hours live in lib/config.ts.
cp .env.example .env.local
npm install
npm run devFrom the calsdk repo, run bun install, bun run build and then bun run --cwd examples/nextjs-booking dev instead.