in daily use since apr 2026own project
commit alarm
an iphone alarm that sends a fixed stake of my money to charity if i oversleep.
private repo, no public link




- whenapr 2026 to now
- teamsolo
i can dismiss any alarm, so i wanted one where getting up costs something real.
commit alarm is an iphone app plus a server. a loud alarm rings, and the only way to stop it is scanning a barcode stuck up in my bathroom.
if i haven't scanned by the deadline, the server sends a fixed stake (about 1.74 usdc) from a wallet to a charity. turning the phone off doesn't help, because the phone isn't the one deciding.
the hard part was the money. a bug that charges twice, or charges when it shouldn't, is a real bug with real cost. so every doubt means no charge, and every charge is written down before it is sent.
v1 was too blunt: a miss sent the whole wallet. i changed it to a fixed stake, frozen onto each morning at 11 pm so tired me can't renegotiate with tomorrow's me.
the data then showed a hole in my own design: some misses cost nothing because the wallet was empty and the app never said so. a penalty with no teeth is just an alarm. so the dashboard now warns about an empty wallet, and the server has an optional card backstop for when the wallet can't cover the stake.
i also rebuilt the whole iphone app from scratch in october 2026 after the original source was lost. the server and its tests carried over.
i've used it daily since april 2026. best stretch: 12 of 13 wakes on target, 16 to 31 may.

- the server decides, not the phone. a postgres cron job (supabase pg_cron) calls
/api/cron/tickevery minute. it arms each day, then charges any armed day whose deadline has passed and which is still pending. a scan is judged by the server's receive time, and a local match on the phone never marks a day safe. - days are frozen. between 23:00 the night before and midday, the server writes the wake time, scan window and stake onto that day's row. settings lock from 23:00 until the morning settles. one escape hatch until 04:00: push that one alarm later or skip it, never earlier. the scan window opens an hour before the wake time and closes 5 minutes after.
- money code fails closed. a partial unique index in the database allows at most one live charge per date. the signed usdc transfer (viem, on Base) is saved before it is broadcast, so a crash can only ever re-send the identical bytes, never sign a second transaction. an unclear config, database or chain read means no charge. a reverted or dropped transaction is recorded as costing nothing, never replaced.
- a scan must match exactly. barcode matching is exact string match against saved codes (no fuzzy matching), and the flip from pending to success is an atomic conditional update. an optional door check wants a second scan of a different code 20 to 60 minutes after wake time, to prove i stayed up (off by default).
- native app plus web. swiftui iphone app (xcodegen project, ios 26 target, 69 swift files, about 13k lines including tests) with a looping-audio alarm, 12 capped "mute 10s" presses, a 22:00 heads-up, and a night-reset routine. it talks to a next.js and typescript api with per-phone bearer tokens (only a sha-256 of the token is stored) and a pairing rate limit.
- tested. the server suite is vitest, including database migrations run against an in-process postgres (pglite). the swift side has its own test suite with a stub server.
- 201commits locally, first on 27 apr 2026
- 164commits on the github default branch
- 568server tests passing, 37 test files, re-run 19 nov 2026 (
npx vitest run, 5 s, no secrets needed) - 263swift tests passing as of 10 nov 2026, not re-run today (needs xcode)
- 14database migrations
- checks every minute, every day, weekends included
- 12best stretch of 13 apple watch wakes, 16 to 31 may 2026
- 13commits by month (apr), 11 (may), 7 (jun), 6 (jul), 2 (sep), 67 (oct), 95 (nov to 10 nov)