Skip to content

koopatroopa787/finance-AI

Repository files navigation

AI Finance Analyst

A personal AI-powered finance analyst that helps you find savings opportunities by analyzing your bank transactions.

Finance AI Dashboard

Real-time dashboard with spending analysis

Screenshots

AI Chat Interface Smart Alerts

Features

  • 🏦 Bank Connection - Securely connect bank accounts via Plaid
  • πŸ“Š Spending Analysis - Visual breakdown of spending by category
  • πŸ€– AI Insights - Claude-powered detection of:
    • Unused subscriptions
    • Wasteful spending patterns
    • Bill negotiation opportunities
  • πŸ’¬ AI Chat - Ask natural language questions about your finances
  • πŸ”” Smart Alerts - Proactive notifications for unusual activity
  • πŸ’° Savings Dashboard - Track potential monthly savings

Tech Stack

  • Frontend: Next.js 14 (App Router), React 18, Tailwind CSS
  • UI Components: shadcn/ui
  • Database: PostgreSQL with Prisma ORM
  • Authentication: NextAuth.js (Credentials)
  • Bank Integration: Plaid API (Sandbox)
  • AI: Anthropic Claude (Sonnet 4)
  • Deployment: Vercel

Getting Started

Prerequisites

  • Node.js 18+
  • PostgreSQL database (local or cloud)
  • Plaid account (free sandbox)
  • Anthropic API key

1. Clone and Install

git clone <repository-url>
cd finance-analyst
npm install

2. Set Up Environment Variables

Copy the example environment file:

cp .env.example .env.local

Fill in the values:

# Database
DATABASE_URL="postgresql://user:password@localhost:5432/finance_analyst"

# NextAuth
NEXTAUTH_SECRET="your-secret-key-here"
NEXTAUTH_URL="http://localhost:3000"

# Plaid (get from https://dashboard.plaid.com/signup)
PLAID_CLIENT_ID="your-plaid-client-id"
PLAID_SECRET="your-plaid-sandbox-secret"
PLAID_ENV="sandbox"

# Anthropic (get from https://console.anthropic.com/)
ANTHROPIC_API_KEY="your-anthropic-api-key"

# Demo Mode (optional - uses mock data)
DEMO_MODE="false"

3. Set Up Database

# Generate Prisma client
npx prisma generate

# Push schema to database
npx prisma db push

# (Optional) Seed with demo data
npm run db:seed

4. Run Development Server

npm run dev

Open http://localhost:3000 in your browser.

Demo Mode

For presentations without real API credentials, enable demo mode:

DEMO_MODE="true"

Then seed the database with demo data:

npm run db:seed

Demo login credentials:

  • Email: demo@financeai.com
  • Password: demo123456

Plaid Sandbox Testing

When using Plaid in sandbox mode, use these test credentials in the Plaid Link flow:

  • Username: user_good
  • Password: pass_good
  • Select any institution

Project Structure

src/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ (auth)/           # Login/Register pages
β”‚   β”œβ”€β”€ (dashboard)/      # Protected dashboard pages
β”‚   β”‚   β”œβ”€β”€ dashboard/    # Main overview
β”‚   β”‚   β”œβ”€β”€ chat/         # AI chat interface
β”‚   β”‚   β”œβ”€β”€ savings/      # Savings opportunities
β”‚   β”‚   └── alerts/       # Financial alerts
β”‚   β”œβ”€β”€ api/              # API routes
β”‚   β”‚   β”œβ”€β”€ auth/         # NextAuth endpoints
β”‚   β”‚   β”œβ”€β”€ plaid/        # Plaid integration
β”‚   β”‚   β”œβ”€β”€ ai/           # Claude AI endpoints
β”‚   β”‚   └── dashboard/    # Dashboard data
β”‚   └── page.tsx          # Landing page
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ui/               # shadcn/ui components
β”‚   β”œβ”€β”€ dashboard/        # Dashboard components
β”‚   β”œβ”€β”€ charts/           # Data visualizations
β”‚   └── plaid/            # Plaid Link integration
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ auth.ts           # NextAuth configuration
β”‚   β”œβ”€β”€ prisma.ts         # Database client
β”‚   β”œβ”€β”€ plaid.ts          # Plaid API client
β”‚   β”œβ”€β”€ claude.ts         # Claude AI integration
β”‚   └── utils.ts          # Helper functions
└── types/
    └── next-auth.d.ts    # Type declarations

API Routes

Route Method Description
/api/auth/register POST Create new user account
/api/plaid/create-link-token POST Initialize Plaid Link
/api/plaid/exchange-token POST Exchange Plaid public token
/api/plaid/transactions GET/POST Fetch/sync transactions
/api/ai/analyze GET/POST Get/generate AI insights
/api/ai/chat POST Send message to AI assistant
/api/dashboard GET Get dashboard overview data
/api/alerts GET/PATCH Manage alerts

Demo Flow for Presentations

  1. Landing Page - Show value proposition
  2. Sign Up - Quick registration
  3. Connect Bank - Plaid sandbox flow
  4. Dashboard - Highlight balance, spending chart, AI insights card
  5. AI Insights - "Found 3 unused subscriptions - save $55/month!"
  6. AI Chat - Ask "Why did I spend so much last month?"
  7. Savings Page - Show all opportunities (~$200+/month total)

Security Notes

  • Access tokens are stored encrypted in production
  • Read-only bank access via Plaid
  • No storage of banking credentials
  • Session-based authentication with JWT
  • CSRF protection on all API routes

Deployment

Vercel (Recommended)

  1. Push to GitHub
  2. Import project in Vercel
  3. Add environment variables
  4. Deploy

Manual

npm run build
npm start

Future Implementation

Here is the roadmap for upcoming features:

πŸ“± Mobile Application

  • React Native / Flutter App: Native mobile experience for iOS and Android.
  • Biometric Login: FaceID/TouchID integration for faster access.
  • Push Notifications: Real-time alerts for large transactions.

πŸ“ˆ Investment & Wealth Tracking

  • Investment Portfolio: Connect brokerage accounts (Robinhood, E*TRADE).
  • Crypto Integration: Track Bitcoin/Ethereum holdings alongside fiat currency.
  • Net Worth Calculator: Unified view of assets vs. liabilities.

πŸ€– Advanced AI Features

  • Bill Negotiation: AI agent that automatically negotiates lower rates for internet/cable bills.
  • Subscription Cancellation: One-click cancellation for unwanted services.
  • Tax Preparation: Tag tax-deductible expenses throughout the year.

🌍 Global Support

  • Multi-currency: Support for EUR, GBP, CAD, and more.
  • Localization: UI translations for major languages.

πŸ“Š Data Export

  • CSV/PDF Reports: Download monthly financial statements for manual analysis or accountants.
  • Budget Goals: Set custom spending limits per category.

License

MIT

About

A personal AI-powered finance analyst that helps you find savings opportunities by analyzing your bank transactions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors