all projects

Planner

A small app that keeps my recurring plans on my Google Calendar automatically, so I don't have to remember to.

  • Astro
  • TypeScript
  • Cloudflare Workers
  • Cloudflare D1
  • Google Calendar API
  • Claude API

I’m bad at keeping my calendar up to date. The plans exist: a quiz night every week, regular games nights with friends, time set aside with my partner. They just live in my head or a group chat, and never make it onto the calendar where other people can see them. So I built something to do it for me.

All the screenshots below use made-up example data.

What it does

The planner sits in the private, family-only part of this site. I set up a few rules once:

  • Weekly events happen on a fixed day: quiz night on Wednesday, two games nights a week.
  • Flexible time needs a number of slots per week, like two evenings together. The planner finds them when both our calendars are free.
  • Busy time is work hours, sleep and workouts. It’s never booked over.

Every night it looks at the next fortnight, works out what should be on my calendar and makes the changes. Anything it isn’t sure about, like where to put time together, waits for me to approve it.

A table of planned events for the next fortnight: games nights, Wednesday quizzes and slots of quality time, each marked 'add', with a note that one games night clashed and wasn't booked.
The planner's preview of the next fortnight. One games night clashed with something already in the calendar, so it was left out and flagged.

My partner can add things too. There’s a simple page she’s saved to her phone’s home screen, so it opens like an app. She types something like “Dinner at Mum’s Sat 6pm”, it shows what it understood, and it warns her if I’ve already got something on. Nothing goes in my calendar until she taps Add, and there’s an Undo button if she gets it wrong. It handles trips and anything else spanning several days too.

A phone screen titled 'Add to Ben's calendar' with a text box containing 'Dinner at Mum's Sat 6pm' and a Next button.
Type it in plain English…
A confirmation screen for 'Pub quiz with Sam' on Thursday 19:00 to 22:00, with a heads-up that Ben already has work drinks at that time.
…check it, including any clashes…
A screen saying 'Added' with the event details and an Undo button.
…and it's on the calendar.

How it’s built

It’s part of this website, which runs on Cloudflare Workers. The rules, and a log of everything it does, live in Cloudflare D1 (a small SQLite database). A scheduled job runs every night.

The scheduling logic is a set of pure functions with no network calls, so it’s easy to test. Given the rules and what’s already busy, it works out what should be on the calendar and the smallest set of changes to get there. A few decisions mattered:

  • It only touches its own events. Everything it creates carries a hidden tag. It reads my other events to know when I’m busy, but it will never edit or delete them, and it double-checks the tag before any delete.
  • It doesn’t shuffle things around. If last night’s booking still fits, it stays put. Only bookings that something new now clashes with get moved.
  • Clashes are reported, not forced. If I book something over quiz night, the quiz is dropped for that week and the planner says so.
  • Time zones are explicit. Workers run in UTC, so every “19:30 on Wednesday” is converted to UK time, including the clocks changing. That was the fiddliest part to get right, and it has its own tests.

Google Calendar is used directly through its REST API. I connect my Google account once, and the access token is stored encrypted.

Plain-English input uses Claude Haiku. It only pulls out the title, dates and times, and the result always goes through the same checks as the form. It doesn’t decide anything, and nothing is booked without a tap.

Telegram was my first idea for letting someone else add things: a bot you message, with buttons to confirm. It’s built, but Telegram has so far refused to talk to any bot I create, even brand-new ones. The phone page turned out to be simpler anyway, so the bot is on hold.

Screenshots come from running the site locally in a “demo mode” with a fake calendar, so none of my real plans end up in a blog post. A small script drives a headless browser through the pages, so I can retake them in one command whenever the design changes.

How to use it

Day to day, there’s nothing to do. Things just appear on my calendar. When plans change I can:

  • skip a games night with one click on the planner page
  • change a rule, like moving games night to a different day
  • approve the suggested slots for time together

There’s also a “remove everything the planner created” button, in case I ever want a clean slate.

What’s next

  • I’m planning to build a workout app. Done: a training planner now puts my sessions on my calendar, and this planner works around them.
  • If Telegram ever lets my bot in, the Sunday week-ahead summary will arrive as a message instead of me having to look.

Changelog

24/11/2026

  • Works with my new training planner. Time together is now fitted around training sessions, while quiz and games nights still take priority over training.
  • When my partner adds something on the phone page, the check screen now shows how my training will move to fit, and my training is re-planned as soon as she taps Add (and put back if she taps Undo).
  • Retired the placeholder “Workouts” busy rule.

Keep reading

This website

How I rebuilt itsjustben.co.uk with Astro and Cloudflare, with a public blog and a family-only private area.

parkrun + Spoons

A page that pairs parkruns with the nearest Wetherspoon for a post-run breakfast. A public finder for anyone, plus a private version that tracks the ones we've done.

Smart home

Tidying up the tech around the house, starting with stripping the ads, trackers and clutter out of my Google TV box and giving it a home screen that matches this website.