Skip to content

jyothsnagrace/BudgetBuddy

Repository files navigation

πŸ’° BudgetBuddy

An intelligent personal finance app with AI-powered expense tracking, receipt OCR, and a city-aware cafΓ© companion for financial advice.

Python FastAPI React Status

Group 3 β€” DSBA 6010 Spring 2026 | UNC Charlotte


🎯 Overview

A full-stack personal budgeting application that combines Large Language Models (LLMs) with computer vision to make expense tracking effortless. Features natural language processing, receipt OCR, a multi-agent cafΓ© companion, and location-aware financial insights.

✨ Key Features

  • πŸ€– AI CafΓ© Companion β€” Chat with Penny 🐧, Esper πŸ‰, Mochi 🐱, or Capy 🦫 for personalized budget advice
  • β˜• Pet Community Cafe β€” Turn-based gossip mode with one new agent message per click and per-user memory persistence
  • πŸ“Έ Receipt OCR β€” Upload receipt photos for automatic expense extraction via Gemini Vision + Tesseract
  • πŸ’¬ Natural Language Input β€” Type "Spent $45 on pizza" instead of filling forms
  • πŸ“ Location-Aware Insights β€” Compare spending across US cities using real-time cost-of-living data
  • πŸ“… Interactive Calendar β€” Visual spending patterns with hover details
  • 🎨 Companion System β€” Build friendship levels through consistent tracking
  • πŸ“Š Smart Analytics β€” Category breakdowns, trends, and budget alerts

πŸš€ Live Deployments

Service URL
🌐 Frontend (Vercel) https://budget-buddy-llm-app.vercel.app
βš™οΈ Backend (Railway) https://budgetbuddy-group3.up.railway.app
πŸ“– API Docs https://budgetbuddy-group3.up.railway.app/docs

πŸ—οΈ Architecture

Frontend (React + TypeScript)

src/app/
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ BudgetBuddy.tsx        # AI Chat / CafΓ© Companion
β”‚   β”œβ”€β”€ BudgetSettings.tsx     # Budget goal management
β”‚   β”œβ”€β”€ BudgetSummary.tsx      # Monthly analytics
β”‚   β”œβ”€β”€ ExpenseList.tsx        # Expense history
β”‚   β”œβ”€β”€ CompanionSelector.tsx  # Pet selection system
β”‚   └── FriendshipStatus.tsx   # Companion friendship meter
└── dateUtils.ts               # Timezone-safe date handling

Backend (FastAPI + Python)

backend/
β”œβ”€β”€ main.py                    # FastAPI entry point & all API routes
β”œβ”€β”€ auth.py                    # JWT authentication
β”œβ”€β”€ database.py                # Supabase PostgreSQL client
β”œβ”€β”€ llm_pipeline.py            # Groq / Gemini LLM wrappers
β”œβ”€β”€ cafe_agents.py             # Multi-agent cafΓ© companion
β”œβ”€β”€ cafe_tools.py              # Companion memory load/save utilities
β”œβ”€β”€ receipt_parser.py          # OCR + Gemini Vision receipt parsing
β”œβ”€β”€ receipt_to_database.py     # Receipt β†’ expense DB pipeline
β”œβ”€β”€ function_calling.py        # LLM function/tool calling system
β”œβ”€β”€ cost_of_living.py          # RapidAPI cost-of-living integration
└── rag.py                     # RAG system (optional, gracefully disabled)

🧠 LLM Architecture & Flow

LLM Architecture and Flow


Stage Descriptions

Stage Model / Tool Purpose
Input Routing FastAPI Detects text vs. image input
NLP Parsing Groq LLaMA 3.1-8b Extracts expense fields from natural language
OCR Extraction Tesseract + Gemini 2.5 Flash Vision Reads text from receipt images
Normalization Groq LLaMA 3.1-8b Standardizes amounts, dates, categories
Function Calling Groq Tool Use Structures output into DB-ready JSON
Pet Community Cafe Multi-agent persona engine One-turn gossip generation with speaker rotation and persisted per-user memory
LLM Fallback Chain OpenAI -> Anthropic -> Groq -> Mock Ensures cafe continuity if provider keys are missing or unavailable
Agent Orchestration Planner -> Executor -> Reviewer Multi-step task decomposition, tool execution, and response synthesis
Cost-of-Living RapidAPI City-specific financial context
Persistence Supabase PostgreSQL Stores expenses, budgets, user profiles

πŸ› οΈ Technology Stack

Layer Technology Purpose
Frontend React 18 + TypeScript SPA with Vite bundler
UI Components MUI + Radix UI + Tailwind CSS Accessible, customizable components
Backend FastAPI + Python 3.12 Async REST API
Database Supabase (PostgreSQL) Row-level security, real-time
LLM Groq (LLaMA 3.1-8b) Fast inference for chat & parsing
Vision / OCR Gemini 2.5 Flash + Tesseract Receipt image understanding
Cost Data RapidAPI Real-time city cost-of-living
Auth JWT + Supabase Secure user sessions
Deploy Frontend Vercel Auto-deploy from main branch
Deploy Backend Railway + Railpack (default) Auto-deploy from \backend

πŸ’‘ Usage

1. Add an Expense β€” Natural Language

Type naturally: "Spent $32 on Uber to airport" or "Coffee $5.50 this morning"

  • LLM extracts amount, category, description, and date automatically
  • Review and confirm before saving

2. Receipt Upload

  • Click Upload Receipt
  • Select a photo (PNG/JPG)
  • Gemini Vision + Tesseract auto-extracts amount, merchant, and items
  • Review and submit

3. Chat with Your CafΓ© Companion

Choose your companion β€” each has a unique personality:

  • Penny the Penguin 🐧 β€” Cheerful and encouraging
  • Esper the Dragon πŸ‰ β€” Wise guardian of your treasure
  • Mochi the Cat 🐱 β€” Sassy but genuinely helpful
  • Capy the Capybara 🦫 β€” Zen and chill financial coach

Example questions:

  • "Should I cut back on dining out this month?"
  • "How does my spending compare to the Charlotte average?"
  • "Where can I save on groceries?"

Responses adapt based on companion personality, friendship level (0–100), and your current budget status.

4. Pet Community Cafe (Turn-Based)

  • Open the cafe panel and click Visit Cafe to start the session
  • Each click on Continue Chat generates exactly one new turn
  • Backend stores per-user cafe history so the conversation continues over time
  • Endpoints used by the feature:
    • POST /api/cafe/gossip
    • GET /api/cafe/context/{user_id}
    • GET /api/cafe/memory/{user_id}
    • DELETE /api/cafe/memory/{user_id}

5. Analytics & Calendar

  • Hover over any calendar day to see expense breakdown
  • Category icons + amounts displayed inline
  • Monthly budget vs. actual comparison

πŸ“Š Feature Status

Feature Status Description
Natural Language Parser βœ… LLM-powered expense extraction
Receipt OCR βœ… Gemini Vision + Tesseract
AI CafΓ© Companion βœ… Multi-agent chat with memory
Pet Community Cafe βœ… Turn-based one-message-per-click gossip flow with per-user memory
Cost-of-Living API βœ… City-aware financial context
Budget Tracking βœ… Category limits with alerts
Interactive Calendar βœ… Hover tooltips with expense details
Companion System βœ… Friendship levels + mood
JWT Authentication βœ… Secure login + user profiles
Supabase RLS βœ… Row-level security per user
Responsive Design βœ… Mobile-friendly UI

πŸ“– Documentation

Document Description
docs/SETUP.md Full installation & troubleshooting guide
docs/BudgetBuddy_Final_Report_Draft.docx 4–5 page white-paper style report draft in Microsoft Word format
database/schema.sql PostgreSQL schema with RLS policies

πŸ™ Acknowledgments

  • Groq β€” Fast LLM inference
  • Google Gemini β€” Vision + OCR capabilities
  • Supabase β€” Backend infrastructure
  • RapidAPI β€” Cost-of-living data
  • Radix UI / MUI β€” Accessible components
  • Tailwind CSS β€” Rapid styling
  • FastAPI β€” Modern Python framework
  • Vite β€” Lightning-fast dev server

πŸ“Š Project Metrics

  • Backend Endpoints: 20+
  • Frontend Components: 10+
  • Database Tables: 3 (users, expenses, budgets)
  • LLM Providers: 2 (Groq, Gemini)
  • Companion Personalities: 4
  • Cafe Endpoints: 4 (gossip, context, memory read, memory reset)
  • Supported Cities: 54 (via RapidAPI)

Built with ❀️ for DSBA 6010 β€” Spring 2026

Version: 1.0.0 | Status: βœ… Production Ready | Last Updated: April 2026

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors