Next.js expense tracker with private per-user records, spending analytics, and secure transaction management.
A privacy-first expense tracker built to practice full-stack development outside of Laravel. Users can log income and expenses, view spending patterns through interactive charts, and manage their financial records — with every account's data fully isolated at the database query level. Built end-to-end with Next.js App Router, Prisma ORM, and credentials-based authentication.
Challenge
Needed every user's financial records to stay strictly private, with no risk of one account ever seeing or modifying another's data.
Solution
Scoped every database query (reads, updates, deletes) to the authenticated session's user ID, and added explicit ownership checks in Server Actions so a user could never mutate a transaction they didn't own — even by guessing another record's ID.
Challenge
Prisma's Decimal type (used for currency precision) can't cross the Server-to-Client Component boundary in Next.js — passing raw transaction data to chart or export components threw serialization errors.
Solution
Converted Decimal fields to plain numbers immediately after fetching from the database, before any data reached a Client Component, keeping currency precision intact server-side while satisfying React's serialization rules.
Challenge
The NextAuth middleware bundle exceeded Vercel's 1MB Edge Function limit because it pulled in Prisma and bcrypt — both incompatible with the Edge runtime.
Solution
Split the auth configuration into an Edge-safe config (used only by middleware for route protection) and a full config with the credentials provider and database logic (used only in Node runtime contexts), cutting the middleware bundle well under the limit.
Challenge
Needed a way to filter and export transaction history without adding a heavy client-side state library.
Solution
Used URL search params as the single source of truth for filters (type, category, date range), letting Server Components re-fetch filtered data on navigation, and built CSV export client-side from the already-fetched transaction list.