Platform

An iPhone app that tells me when to walk out the door, not when the train leaves

Spec sheet

Status
In development
Kind
App
Started
2026
Role
Solo build
Platforms
iOS
Stack
  • SwiftUI
  • ActivityKit
  • WidgetKit
  • TypeScript
  • Cloudflare Workers
  • D1
  • KV
  • Queues
  • APNs

Leave in four minutes#

Timetables tell you when the train leaves. What I want on a weekday morning is when to walk out the door. Platform is an iPhone app for one Melbourne commute that turns "the 8:12 to the city" into "leave in 4 minutes", allowing for the walk at each end, and puts that countdown on the lock screen as a Live Activity around the times it matters.

The job is narrow on purpose. The engineering behind it isn't, and I built it to the standard I'd hold anything I hand to a client.

One Worker owns the plumbing#

A Cloudflare Worker owns every call to the Public Transport Victoria Timetable API. It signs each request with HMAC-SHA1 exactly as PTV expects, caches responses in KV, and runs every minute on a cron, fanning work out through Cloudflare Queues with a dead-letter queue and a lock per device.

The push budget Apple doesn't publish#

The Live Activity is started and updated by server push through APNs. The obvious design pushes every minute so the number moves. Apple meters those updates against a per-device budget it doesn't publish, and the failure mode for going over it is a frozen countdown with no error anywhere.

So I turned it around. The phone renders its own countdown, which costs no pushes and keeps ticking without a network. The Worker hashes the state each minute and pushes only when something real changes: a new estimate, a platform change, a cancellation, or the next train. It's the decision I'm most pleased with, because the obvious design fails without telling anyone.

What the timetable hides#

The leave-time arithmetic exists in Swift on the phone and TypeScript on the Worker, and both are tested against the same JSON vectors, so they can't quietly disagree about when to leave.

Most of the thinking went into the edge cases a timetable hides. Travel times are anchored to stations, not whole trips. A train that has already departed keeps the stopping pattern it left with, even if the timetable changes under it. And when the direct service isn't the fastest way home, the app routes through one change of train, a decision that took the longest write-up in the project.

Operated, not just deployed#

The Worker runs in staging and production with a written service level objective, alerts, an admin status endpoint and a rollback runbook. That's more operations than a one-person app needs, and it's why I trust it on a weekday morning. The app is heading to TestFlight next.

Timetable data is licensed from Public Transport Victoria under a Creative Commons Attribution 4.0 International Licence.