bryanhamilton.info / writing / article
I Replaced Calendly With a JSON File and an ICS Feed
Every "book a call" button on this site pointed at Calendly for two years. Eight references, one monthly bill, one tracker. Now it is one 16.6 KB PHP page, a self-pruning JSON file, and an ICS feed my calendar subscribes to.
- Replaces: 8 Calendly references -> 0, one monthly bill -> $0
- Stack: one 16.6 KB PHP page, a flock-locked self-pruning JSON file, a ~100-line ICS feed
- Verified: fixture suite ran the real flow - double-book, honeypot, expired token - before ship
For two years, every "book a call" button on bryanhamilton.info pointed at the same Calendly link. When I finally counted, the link lived in eight places: the nav menu, the sticky-bar button, the contact page CTA, the banner CTA, the FAQ (the link and the visible word "Calendly" in the copy), the footer, the Cmd-K palette registry, and one string buried in a console easter egg.
Last week I replaced all of it with three files: a PHP page, a JSON file, and an ICS feed. The booking page is live at /book/, the Calendly references are at zero, and my "scheduling stack" now fits in a single git diff I can read.
Here's what the migration actually looked like - including the part I underestimated.
What Calendly was actually doing
Strip away the branding and Calendly was doing four jobs:
- Render available time slots.
- Block the taken ones.
- Take the booking and tell me about it.
- Keep my calendar in sync.
Job 4 is the one I didn't fully appreciate until it was gone. More on that later.
For a 15-minute meet-and-greet with one person (me), one timezone (America/New_York), and one kind of meeting, almost everything else Calendly ships - round-robin routing, reschedule links, workflow automations, payment gates, the analytics dashboard - is overhead I was paying for and never touching.
The page: one self-contained PHP file
/book/index.php is 16.6 KB and loads nothing. Not the site stylesheet, not a JS framework, not a font. System-ui, dark theme, done.
- Next 14 days, Monday through Friday.
- Slots on a 30-minute grid, 9:00-16:30 ET, for 15-minute calls.
- Past slots are filtered with a one-hour lead time, so nobody books the slot that starts in four minutes.
- Taken slots come from
/book/bookings.jsonand render struck-through with a disabled radio.
That JSON file is the entire database. It's flock-locked on every read-modify-write, and it prunes itself: anything older than a day gets dropped on the next render. The store of "who booked what" can never grow, because past bookings have no value to anyone. I find this genuinely satisfying.
Spam control without a captcha
Two mechanisms, both server-side:
A honeypot field named website. Humans never see it; bots autofill it. In fixture testing, the honeypot blocked every simulated bot submission: zero confirmations got through.
A day-rolled HMAC token. hash_hmac('sha256', $todayET, $secret) - the token embedded in the form changes at midnight ET, so a form saved yesterday is dead today, and a token scraped by a bot is dead on arrival. Get it wrong and you get the "rolled over" message, which is at least honest about why.
Then the POST validates everything again anyway: slot string against a regex, weekday check, hour-window check, filter_var on the email, and a portable length check (mb_strlen when it exists, strlen when it doesn't - shared-hosting realities).
The race condition Calendly solved for me
Two people have the page open. Both click the same 2:00 PM slot. Both hit Book.
My version handles it the boring way: the POST re-reads bookings.json under flock before accepting, and if the slot vanished while the form was open, the second visitor gets "Someone grabbed that slot" instead of a double-booking. The lock is the whole trick. No queue, no optimistic UI, no problem.
On success: a plain mail() goes out with From: set to me and Reply-To: set to the visitor - so hitting reply on my end goes straight to the person who booked, no copy-paste. The visitor gets an on-page confirmation. Total infrastructure: PHP's mail function.
The part I underestimated: the calendar
Calendly wasn't just a form. It was also quietly writing to my calendar, and a booking page that doesn't reach my calendar is a trap: I take a call I forgot about, or I double-book myself against a personal commitment the page can't see.
I nearly shipped that trap. The original plan stopped at the JSON file, and I told myself "calendar sync is a follow-up." Then I realized the follow-up didn't need Google's API, an OAuth dance, or a service account. It needed a second PHP file.
/book/feed.php reads bookings.json and emits an ICS feed - one VEVENT per taken slot, 30 minutes each, with floating local times (no TZID gymnastics, no VTIMEZONE block; the times are already in ET because the whole system is). If the JSON is missing, it returns a 503 instead of an empty calendar that lies to me.
Then I subscribed to that URL once in my calendar app. Done. Any calendar app that speaks ICS - which is all of them, it's a format from 1998 - now shows my booked calls. No integration, no polling service, no third party in the middle. The "calendar sync" I was about to defer turned out to be about a hundred lines of PHP.
The migration itself
Repointing eight references by hand is how you end up with a dead Calendly link somewhere you forgot about. So the deploy worker did it, with guard rails:
- All seven full-URL references swapped, each swap count-guarded (
==7or the worker aborts). - The FAQ's visible word "Calendly" rewritten to "the booking page".
- The console easter egg string updated too, because I refuse to ship an easter egg that lies.
- Post-check assertion: the string
calendlyappears zero times in the shipped homepage HTML. The worker fails if it's not zero.
Of course I still managed a bug. The page shipped, I hit /book/, and got a 404 - because the .htaccess I'd written in that directory had rewrites but no DirectoryIndex index.php. Two lines, fixed, verified live. The lesson is old and keeps being true: 200 on the worker is not 200 on the page.
What it cost me
Honesty section, because every "I replaced SaaS with a script" post skips it:
- No reschedule links. Visitors email me to move a call. For 15-minute meetings, that's fine.
- No calendar invite for the visitor - they get a confirmation page, not an .ics in their inbox. If that starts mattering,
mail()can attach one; it just doesn't yet. - No automatic reads of my personal calendar. The ICS feed shows booked slots; it doesn't ingest my Google Calendar to block those times. My availability window is a code constant, and I'm the only person whose calendar it needs to match.
- If traffic were thousands of bookings a day, this design would be wrong. It isn't, so it isn't.
The scoreboard
Calendly: a monthly bill, a redirect, a cookie banner, a third-party tracker, and a page that loads in their brand.
Mine: one 16.6 KB PHP file, a self-pruning JSON file, and an ICS feed. $0/month, no redirect, no tracking, loads instantly - and the fixture suite proved out the whole flow before it shipped: 144 slot radios rendered, a booking POST writing JSON and producing a correctly-headed email, double-book blocked, honeypot blocked, expired token rejected, taken slots struck through on re-render, zero PHP warnings.
The full audit trail shipped with it, because that's how everything on this site ships: JSON-LD (WebPage + BreadcrumbList), a generated OG image, a sitemap entry, llms.txt/ai.txt lines, IndexNow pings, and a row in the public receipts ledger that says what shipped and when.
I'm not saying Calendly is bad. I'm saying I was one form.
What's the last subscription you replaced with a file? The comments on the cross-posts are open - or you know where the booking page is.
More from the workshop
All writingEvery article, on this domain. I Replaced Google Analytics With a 204Same philosophy, different subscription: the whole analytics stack is one PHP file answering 204. No third party, no cookies, 2KB.Every change to this site is logged in the ship log
Every one of these builds is logged in the ship log. Follow along: RSS or The DJ Calendar newsletter.