A3.3

Case study

Expense Tracker

Role
Full-Stack Developer
Timeline
Sep 2026
Stack
Next.js · Prisma · PostgreSQL

Expense Tracker is a solo full-stack project for splitting shared costs within a group — rent, trips, dinners — without the usual spreadsheet math. People create a group, add expenses with equal, exact, or percentage splits, and the app tracks who owes whom. The part that made it worth building rather than using an existing app: instead of just listing every individual debt, it reduces them down to the fewest possible payments that settle the whole group.

The backend is Next.js API routes on a Prisma/PostgreSQL schema (users, groups, members, expenses, splits), with its own JWT-based auth using jose and bcrypt for password hashing rather than an off-the-shelf auth library. Every request body is validated with Zod, and a shared AppError type plus a withErrorHandling wrapper turn expected failures into consistent, specific API error responses instead of generic 500s.

The core logic — split calculation and settlement — is isolated in plain TypeScript modules with a Vitest suite, deliberately kept framework-agnostic so it's cheap to test. The settlement function is a greedy minimum-cash-flow algorithm: repeatedly matching the largest creditor with the largest debtor until every balance is within a cent of zero. One test locks in a real bug I hit in production — an EXACT split that didn't sum to the total was crashing with an unhandled error — it now fails cleanly with a specific message instead.

Most of a later pass went into UI polish that isn't visible in the API: a custom Modal/Toast/Confirm system built on React context so no screen ever calls window.alert or window.confirm, loading and disabled states on every button that triggers a request, and a small dark, avatar-and-badge design system shared across the dashboard and group pages.

Visit Expense Tracker