Browser timers fall behind when you stop watching them.
The point of a focus timer is that you look away from it. But browsers slow down background tabs, so many web timers drift by up to a minute in exactly that situation.
Chrome throttles timers in hidden tabs. A timer that counts by ticking on the main thread falls behind, so the end-of-session chime comes late. Beyond that, you have to switch tabs to check the time, it's easy to miss the alarm, and a reload usually loses the timer.
- Job to be done: “Keep accurate time while I work in another window, and let me know when it's done.”
- Background: The first version was a team project for a college software engineering course in 2020 (Django, jQuery, Heroku). This is my solo rebuild, starting from new requirements.
Rebuilding a class project around one requirement.
I did the rebuild on my own. I looked at what the first version couldn't do, wrote new requirements around the background-tab problem, picked a serverless platform so there'd be nothing to maintain, and built it with Claude Code. I tested each feature in real browsers with the tab hidden, minimized and offline.
- Business analystGap analysisReviewed v1 and other browser timers, and traced the drift to timers that count ticks instead of reading the clock.
- Product ownerRequirementsWrote requirements for accuracy, visibility, alerts, persistence and sign-in, each with a way to test it.
- Product managerScopeKept the tomato-garden reward from v1 and cut anything that didn't serve the main goal.
- Project managerStagingPlanned the rebuild in stages (timer, tab display, accounts, sync) with a working version after each.
- Software engineerArchitectureMoved from a Django server to Cloudflare Pages, Functions and D1, with a Web Worker and timestamp-based timing.
- Software engineerTestingAn end-to-end passkey test, including a check that sign-in challenges can't be replayed.
What it had to do
An excerpt of the requirements, each written so it could be tested.
- Accurate in the background. Remaining time comes from a stored end time, never from counting ticks, so it doesn't drift in a hidden or minimized tab.
- Readable from the tab strip. The favicon shows a progress pie, and the title shows
12:34 🍅 Focus. - Hard to miss. A notification and a chime, plus an always-on-top mini timer where the browser supports it.
- Survives a reload. A session that ended while the tab was closed still counts.
- Account optional. Everything works as a guest. Creating a passkey account moves guest progress over.
- Works offline. Finished sessions queue while offline and sync once, without duplicates, when the connection is back.
Decisions and trade-offs
Rewrite rather than refactor
v1 rendered pages on a Django server, which couldn't meet the main requirement, so v2 started from new requirements.
WhyThe goal had changed. Improving the old design wouldn't have got there.
Serverless on Cloudflare
A static frontend, Pages Functions for the API and D1 for data.
WhyNothing to patch or keep running, and it fits in the free tier.
Passkeys, guest mode first
No passwords. Guests get every feature; an account only adds sync.
WhyA sign-up form is a lot to ask before a 25-minute timer, and passwords are one more thing to protect.
Scores are counted in the browser
Game points aren't checked by the server.
WhyIt's a personal tool, so a server-side ledger wasn't worth it yet. I wrote the trade-off down so it's a known gap.
How it compares
Most browser Pomodoro timers are simple pages that count down on the main thread. Desktop apps keep better time, but they need installing and sit outside the browser.
| Need | Typical alternative | Pomodoro |
|---|---|---|
| Accuracy in a hidden tab | Can drift when the browser throttles it | Reads the clock, with a Web Worker for updates |
| Seeing the time | Switch tabs to check | Countdown in the favicon and tab title, plus a mini timer |
| Reload or closed tab | Timer is lost | Restored, and finished sessions still count |
| Accounts | Email and password, or no sync | Guest mode, then passkey sync |
| Page weight | Often heavy, with ads | About 19 KB of JavaScript (gzipped), no ads |
What it's built with
- Frontend
- Vite, TypeScript, Preact, @preact/signals
- Browser APIs
- Web Workers, canvas favicon, Notifications, Web Audio, Document Picture-in-Picture, View Transitions
- API
- Cloudflare Pages Functions, CSRF middleware
- Data
- Cloudflare D1 (SQLite) with migrations
- Auth
- WebAuthn passkeys via SimpleWebAuthn; single-use challenges; hashed session tokens
- Security
- Strict CSP and security headers; validation shared by client and server
- Original version
- Django, jQuery, Heroku (college team project, 2020)
- AI-assisted coding
- Claude Code
I wrote the requirements and made the design decisions. Claude Code wrote most of the first-draft code from them. I reviewed the changes, tested them in real browsers, and sent back anything that didn't meet a requirement.
Where it is now
Working, and deployed on Cloudflare Pages. It's moving to a permanent domain, which matters here because passkeys are tied to the address they were created on.
Next: A server-checked score ledger, to close the gap noted above.