david anderson
← All work Project 01 · Productivity

Pomodoro

A focus timer for the tab you aren't looking at. It keeps time accurately in the background, shows the countdown in the tab itself, and works without an account.

Roles
Product owner, analyst, engineer
Platform
Web app
For
Anyone working at a computer
Runs on
Cloudflare Pages, Functions and D1
01 · Problem

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.
02 · Roles

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.
03 · Requirements

What it had to do

An excerpt of the requirements, each written so it could be tested.

pomodoro / requirements.mdexcerpt
  1. 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.
  2. Readable from the tab strip. The favicon shows a progress pie, and the title shows 12:34 🍅 Focus.
  3. Hard to miss. A notification and a chime, plus an always-on-top mini timer where the browser supports it.
  4. Survives a reload. A session that ended while the tab was closed still counts.
  5. Account optional. Everything works as a guest. Creating a passkey account moves guest progress over.
  6. Works offline. Finished sessions queue while offline and sync once, without duplicates, when the connection is back.
04 · Decisions

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.

05 · Alternatives

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.

Pomodoro and typical alternatives
NeedTypical alternativePomodoro
Accuracy in a hidden tabCan drift when the browser throttles itReads the clock, with a Web Worker for updates
Seeing the timeSwitch tabs to checkCountdown in the favicon and tab title, plus a mini timer
Reload or closed tabTimer is lostRestored, and finished sessions still count
AccountsEmail and password, or no syncGuest mode, then passkey sync
Page weightOften heavy, with adsAbout 19 KB of JavaScript (gzipped), no ads
06 · Stack

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
How it was built

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.

07 · Status

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.