← All posts

How I built Pomodash: a Pomodoro app with streaks and a global leaderboard

By ·

Pomodash landing page, a Pomodoro timer app built by Adarsh Raut

I'm Adarsh Raut, a full stack software developer based in Pune. Pomodash is a Pomodoro app I built to practise the parts of full stack work that look simple and aren't: timers, time zones and trusting data from the browser. The code is on GitHub.

It has a focus and break timer, tasks, weekly stats, a 16-week heatmap, streaks and a leaderboard. It's built with Next.js 16, React 19, Prisma 7, PostgreSQL, NextAuth and Tailwind with DaisyUI.

Pomodash focus timer in the dark theme

A timer that doesn't drift

The obvious way to build a countdown is to subtract one from a number every second. Browsers throttle background tabs, so that timer falls behind the moment you switch windows.

Pomodash counts from the wall clock instead. It stores when the session should end and works out the time left from the current time on every tick. If the tab is throttled for a minute, the next tick still shows the right number.

Never losing focused time

People reset timers, skip breaks and close tabs mid-session. I didn't want any of that to throw away real work. If you reset, skip, switch modes or close the page, the time you actually focused is saved as a partial session.

Closing the tab is the tricky case, because a normal request may never finish. On pagehide the app sends a small sendBeacon request to a dedicated API route, and that route accepts partial runs only.

Making retries safe

Beacons and retries mean the same session can arrive twice. Every run carries a clientId, and the server returns the stored row if it has seen that ID before. Each run is saved exactly once, however many times the browser sends it.

Streaks that follow your calendar

Vercel runs on UTC, but a streak belongs to the user's day. A session at 11:30 pm in Pune should count for that day, not for the next one in UTC.

So the app keeps the user's time zone and does its date maths on calendar days with Intl, never with the server's local Date getters. Weeks, "today" and the heatmap all go through the same helpers.

Pomodash stats page with the consistency heatmap and focus time by task

A leaderboard that is hard to cheat

Anything the browser sends can be faked, so the server checks every session in one function that both the server action and the beacon route use:

  • A completed session can't be longer than the timer you configured.
  • A user can't log more than 24 hours of timer in any 24 hours.
  • Writes are rate limited per user.
  • A task has to belong to the person logging the session.

Inputs are validated with Zod, and the leaderboard only counts completed sessions from the last seven days.

Derived numbers can't drift

Task completion counts aren't stored. They're calculated from the session rows, so they can't disagree with the sessions behind them.

What I'd do next

  • Add team or friends-only leaderboards.
  • Export your history.
  • Write more tests around time-zone edge cases such as daylight saving changes.

If you want to try it, Pomodash is live, and I'm happy to talk about any of this on LinkedIn.