Habib Afolabi
Case study03

Pennywise

A personal finance app for transactions, budgets, savings pots and recurring bills. It generates and tracks bills on a real cadence, weekly through yearly, persisted in IndexedDB instead of mock data.

Pennywise overview: current balance, income and expenses, savings pots, a budgets donut chart and recent transactions.
Pennywise recurring bills: one overdue bill under Needs paying, a monthly total of $232.16, and bills marked overdue, due soon, upcoming and paid.
Recurring bills
Pennywise on a phone: the Add New Bill form open as a bottom sheet over the recurring bills page.
Mobile bottom-sheet form
  • Next.js
  • TypeScript
  • Zustand
  • IndexedDB
  • Vitest and Playwright

The problem

Pennywise started as Frontend Mentor’s “Personal finance app” challenge. The brief supplies the design and a sample dataset, and the core screens follow it. They are the overview, transactions, budgets, pots and recurring bills. The brief’s data is static, though. Its recurring bills are rows in a JSON file that never fall due.

Beyond the brief, I built the parts that have to stay correct as days pass. Each bill is a stored record with a cadence, from weekly to yearly. Each due date creates a bill to pay, the app lists overdue bills under “Needs paying”, and marking one paid records the matching expense. If you come back after a month away, the app creates the bills you missed. Everything persists in the browser’s IndexedDB, with no backend.

One saved snapshot, not a database per entity

Zustand’s persist saves the whole store as one versioned record in IndexedDB. Separate object stores per entity would look more like a real database, but they’d mean replacing persist with a sync layer written by hand. At personal-finance sizes a snapshot is fast, and the existing schema versions and migrations keep working.

Moving storage never risks data. The app copies older localStorage data into IndexedDB and deletes the old copy only after the write succeeds. If IndexedDB can’t open, as in some private-browsing modes, or a write fails, the app keeps working in memory and says so.

Undo as well as confirmation

Deletes still ask first, as the design specifies. People soon click through a confirmation without reading it, though, so every change that loses something also offers Undo. Frequent small actions, like marking a bill paid or adding money to a pot, skip the question and rely on Undo alone. Each action keeps what it removed, such as a bill’s unpaid due dates or a pot’s place in the list, so the toast can put it back.

What went wrong

  • Saved data loaded twice. In development, React runs effects twice. Loading from IndexedDB twice meant the slower load could finish last and overwrite bills generated in between. A browser test that reopens the app on a later day caught it. Loading now goes through hydrateStore(), which only ever starts once.

Testing

Unit tests in Vitest, with fake-indexeddb, cover the money, date and persistence logic. Playwright tests cover the main flows and layouts.

  • The schedule maths, statuses and summaries are plain functions that take today’s date as an argument, so each test sets its own date. The browser tests use a fixed clock for the same reason.
  • The whole unit suite runs a second time in two opposite timezones, to catch date bugs that only appear far from UTC.

Sign-in is a demo on purpose. Any email and password work, and the app protects pages only on the client.