Skip to content

A comprehensive AI-powered financial advisor application that helps users create detailed financial profiles, analyze their financial health, and receive personalized financial recommendations.

Notifications You must be signed in to change notification settings

alexarevalo9/ai-finance-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– AI Finance Agent

A comprehensive AI-powered financial advisor application that helps users create detailed financial profiles, analyze their financial health, and receive personalized financial recommendations.

πŸ“Ή Demo Video

πŸ“Ί Watch the AI Finance Agent in Action

✨ Features

🏦 Financial Profile Collection

  • Interactive Chat Interface: Step-by-step guided conversation to collect comprehensive financial information
  • Structured Data Collection: Captures personal info, income sources, expenses, debts, savings, and financial goals
  • Real-time Progress Tracking: Visual progress indicators and session management
  • Persistent Sessions: Resume conversations with unique session IDs

πŸ“Š Financial Health Analysis

  • AI-Powered Analysis: Advanced financial metrics calculation using Mastra AI agents
  • Comprehensive Reports:
    • Debt-to-Income (DTI) ratio analysis
    • Savings rate calculations
    • Emergency fund adequacy assessment
    • Net worth tracking
    • Financial health scoring (A/B/C grades)
    • Personalized recommendations
  • Visual Data Presentation: Clean, responsive charts and metrics display

πŸ“ Financial Records Management

  • CSV File Upload: Import expense and income records via drag-and-drop interface
  • Smart Column Mapping: Automatic detection and manual mapping of CSV columns
  • Data Validation: Real-time validation and error handling
  • Batch Processing: Efficient handling of large financial datasets

πŸ” Authentication & Security

  • Supabase Authentication: Secure email/password and Google OAuth integration
  • Row Level Security (RLS): Database-level security policies
  • User Data Isolation: Complete data privacy and user separation
  • Session Management: Secure chat session handling

πŸ’¬ AI Chat Integration

  • OpenAI GPT-4 Integration: Advanced conversational AI capabilities
  • Structured Responses: AI responses with embedded JSON data for seamless processing
  • Message Persistence: All conversations saved to database
  • Real-time Interaction: Smooth chat experience with typing indicators

🎨 Modern UI/UX

  • Responsive Design: Works seamlessly across desktop, tablet, and mobile devices
  • Dark/Light Theme: Modern interface with Tailwind CSS styling
  • Component Library: Reusable UI components built with Radix UI
  • Accessibility: WCAG compliant design patterns

πŸ› οΈ Tech Stack

Frontend

  • Next.js 15 - React framework with App Router
  • TypeScript - Type-safe development
  • Tailwind CSS - Utility-first CSS framework
  • Radix UI - Accessible component primitives
  • Lucide React - Beautiful icon library

Backend & AI

  • OpenAI GPT-4 - Advanced language model for financial analysis
  • Mastra AI - AI agent framework for specialized financial tools
  • AI SDK - Streamlined AI integration with React

Database & Authentication

  • Supabase - PostgreSQL database with real-time features
  • Supabase Auth - Authentication and authorization
  • Row Level Security - Database-level security policies

Development Tools

  • ESLint - Code linting and quality
  • Turbopack - Fast development bundler
  • PostCSS - CSS processing

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm, yarn, pnpm, or bun
  • Supabase account
  • OpenAI API key

1. Clone the Repository

git clone <repository-url>
cd ai-finance-agent

2. Install Dependencies

npm install
# or
yarn install
# or
pnpm install

3. Environment Setup

Create a .env.local file in the root directory:

# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key

# OpenAI Configuration
OPENAI_API_KEY=your_openai_api_key

# Google OAuth (Optional)
NEXT_PUBLIC_GOOGLE_CLIENT_ID=your_google_client_id

4. Database Setup

Run the Supabase migrations to set up your database schema:

# Apply migrations (run in Supabase dashboard or via CLI)
# The migrations are located in supabase/migrations/

5. Start Development Server

npm run dev
# or
yarn dev
# or
pnpm dev

Open http://localhost:3000 to see the application.

πŸ“ Project Structure

ai-finance-agent/
β”œβ”€β”€ app/                          # Next.js App Router
β”‚   β”œβ”€β”€ api/                      # API routes
β”‚   β”‚   β”œβ”€β”€ financial-health/     # Financial analysis endpoints
β”‚   β”‚   └── financial-profile/    # Profile collection endpoints
β”‚   β”œβ”€β”€ auth/                     # Authentication pages
β”‚   β”œβ”€β”€ chat/                     # Chat session pages
β”‚   └── page.tsx                  # Landing page
β”œβ”€β”€ components/                   # React components
β”‚   β”œβ”€β”€ auth/                     # Authentication components
β”‚   β”œβ”€β”€ ui/                       # Reusable UI components
β”‚   β”œβ”€β”€ financial-analysis.tsx    # Financial report display
β”‚   β”œβ”€β”€ financial-profile-collection.tsx  # Main chat interface
β”‚   └── financial-records-upload.tsx      # File upload component
β”œβ”€β”€ lib/                          # Utility libraries
β”‚   β”œβ”€β”€ supabase/                 # Supabase client and services
β”‚   └── utils.ts                  # Helper functions
β”œβ”€β”€ mastra/                       # AI agents and workflows
β”‚   β”œβ”€β”€ agents/                   # Mastra AI agents
β”‚   β”œβ”€β”€ tools/                    # AI tools and functions
β”‚   └── workflows/                # AI workflows
β”œβ”€β”€ supabase/                     # Database migrations
β”‚   └── migrations/               # SQL migration files
└── hooks/                        # Custom React hooks

πŸ”§ Available Scripts

  • npm run dev - Start development server with Turbopack
  • npm run build - Build for production
  • npm run start - Start production server
  • npm run lint - Run ESLint
  • npm run dev:mastra - Start Mastra AI development server
  • npm run build:mastra - Build Mastra AI agents

πŸ—„οΈ Database Schema

The application uses the following main tables:

  • user_profiles - User financial profile data
  • chat_sessions - Chat session management
  • chat_messages - Conversation history storage
  • financial_records - Uploaded financial data

All tables include Row Level Security (RLS) policies for data protection.

πŸ€– AI Features

Financial Profile Agent

  • Guides users through financial data collection
  • Validates and structures user responses
  • Maintains conversation context and progress

Financial Health Analysis Agent

  • Calculates key financial metrics
  • Generates personalized recommendations
  • Provides actionable financial insights

πŸ”’ Security Features

  • Row Level Security (RLS) - Database-level access control
  • Supabase Auth - Secure authentication system
  • Service Role Keys - Secure API operations
  • Input Validation - Client and server-side validation
  • CSRF Protection - Built-in Next.js security

πŸ“± Responsive Design

The application is fully responsive and optimized for:

  • Desktop (1024px+)
  • Tablet (768px - 1023px)
  • Mobile (320px - 767px)

πŸš€ Deployment

Vercel (Recommended)

  1. Connect your GitHub repository to Vercel
  2. Add environment variables in Vercel dashboard
  3. Deploy automatically on push to main branch

Other Platforms

The application can be deployed to any platform that supports Next.js:

  • Netlify
  • Railway
  • DigitalOcean App Platform
  • AWS Amplify

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

If you encounter any issues or have questions:

  1. Check the Issues page for existing solutions
  2. Create a new issue with detailed information
  3. Include error messages and steps to reproduce

πŸ™ Acknowledgments


Built with ❀️ using modern web technologies

About

A comprehensive AI-powered financial advisor application that helps users create detailed financial profiles, analyze their financial health, and receive personalized financial recommendations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published