SpendWise: AI-Powered Personal Finance with Structured Validation
Overview
SpendWise is an AI-powered personal finance platform that helps users track income, expenses, and budgets while providing intelligent spending insights. The core technical challenge was building a reliable AI pipeline using Google Gemini that produces structured, deterministic financial data from a non-deterministic language model.
Problem
Personal finance apps need accurate categorization to be useful, but AI models produce free-form natural language that is difficult to parse into structured financial data. Off-the-shelf solutions either use rigid rule-based systems that miss nuances or pass raw AI output straight to the user without validation.
Solution
Implemented a two-stage pipeline: a categorization stage that sends transaction data to Gemini with predefined spending buckets, followed by a validation stage that parses the output, checks against an allowed category list, and rejects anything ambiguous with a retry using a more constrained prompt.
Technical Architecture
- Frontend: Next.js 14 App Router, Tailwind CSS, Framer Motion
- Backend: Next.js API routes, Prisma ORM, MongoDB
- Auth: NextAuth.js with Google OAuth + credentials
- AI: Google Gemini for spending insights and categorization
- Caching: Redis for dashboard data and session management
Results
- 100% AI response validation rate after implementing the two-stage pipeline
- Budget snapshot system preserves historical data even after edits
- Sub-second dashboard loads via Redis cache layer
- Two-factor authentication for sensitive operations
Was this case study helpful?
Comments
Be the first to commentBe the first to share your thoughts.