An intelligent personal finance management system that uses AI to help users track expenses, categorize transactions, predict spending, and get personalized financial advice.
- Frontend: React + TypeScript with Tailwind CSS
- Backend: Node.js + Express + PostgreSQL
- AI Service: Python FastAPI with Gemini API and ML models
- Database: Local PostgreSQL (easily migratable to hosted services)
- Node.js (v18+)
- Python (v3.8+)
- PostgreSQL (local installation)
# Create database
createdb finance_ai
# Run migrations (after backend setup)
cd backend
npm run migratecd backend
npm install
cp .env.example .env
# Edit .env with your database credentials
npm run devcd mlservice
pip install -r requirements.txt
cp .env.example .env
# Add your Gemini API key to .env
python main.pycd frontend
npm install
npm run dev/frontend # React + TypeScript + Tailwind CSS
/backend # Node.js + Express + PostgreSQL
/mlservice # Python FastAPI + ML models
/models # Saved ML models
See .env.example files in each directory for required configuration.
- Receipt OCR: Extract transaction details using Gemini Vision
- Smart Categorization: Random Forest + NLP for expense classification
- Spending Prediction: RNN for future expense forecasting
- Financial Advice: Personalized recommendations via Gemini LLM
- Account and transaction management
- Budget tracking and alerts
- Receipt upload and processing
- AI-powered insights and predictions
- Interactive dashboard with charts
- CSV import/export functionality
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/me- Get current user
GET /api/accounts- Get all accountsPOST /api/accounts- Create accountPUT /api/accounts/:id- Update accountDELETE /api/accounts/:id- Delete account
GET /api/transactions- Get transactionsPOST /api/transactions- Create transactionPOST /api/transactions/uploadReceipt- Upload receipt for OCRPUT /api/transactions/:id- Update transactionDELETE /api/transactions/:id- Delete transaction
GET /api/budgets- Get budgetsPOST /api/budgets- Create budgetPUT /api/budgets/:id- Update budgetDELETE /api/budgets/:id- Delete budgetGET /api/budgets/analysis- Get budget analysis
POST /api/ai/categorize- Categorize transactionPOST /api/ai/train- Retrain modelGET /api/ai/predict- Get spending predictionsPOST /api/ai/advice- Get financial adviceGET /api/ai/insights- Get spending insights
-- Users table
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name VARCHAR NOT NULL,
email VARCHAR UNIQUE NOT NULL,
password_hash VARCHAR NOT NULL,
created_at TIMESTAMP DEFAULT NOW()
);
-- Accounts table
CREATE TABLE accounts (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
name VARCHAR NOT NULL,
type VARCHAR NOT NULL,
balance DECIMAL(15,2) DEFAULT 0,
created_at TIMESTAMP DEFAULT NOW()
);
-- Transactions table
CREATE TABLE transactions (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
account_id INTEGER REFERENCES accounts(id) ON DELETE CASCADE,
date DATE NOT NULL,
merchant VARCHAR,
description TEXT,
category VARCHAR,
amount DECIMAL(15,2) NOT NULL,
created_at TIMESTAMP DEFAULT NOW()
);
-- Budgets table
CREATE TABLE budgets (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
category VARCHAR NOT NULL,
limit_amount DECIMAL(15,2) NOT NULL,
month INTEGER NOT NULL,
year INTEGER NOT NULL,
created_at TIMESTAMP DEFAULT NOW()
);
-- Receipts table
CREATE TABLE receipts (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
transaction_id INTEGER REFERENCES transactions(id) ON DELETE CASCADE,
file_path VARCHAR NOT NULL,
extracted_text TEXT,
created_at TIMESTAMP DEFAULT NOW()
);
-- Predictions table
CREATE TABLE predictions (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
category VARCHAR NOT NULL,
predicted_amount DECIMAL(15,2) NOT NULL,
month INTEGER NOT NULL,
year INTEGER NOT NULL,
created_at TIMESTAMP DEFAULT NOW()
);
-- Category corrections table
CREATE TABLE category_corrections (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
transaction_id INTEGER REFERENCES transactions(id) ON DELETE CASCADE,
old_category VARCHAR NOT NULL,
new_category VARCHAR NOT NULL,
created_at TIMESTAMP DEFAULT NOW()
);- ✅ Setup PostgreSQL and schema
- ✅ Build Auth (register/login)
- ✅ Accounts + Transactions CRUD
- ✅ Receipt upload → Gemini OCR
- ✅ Random Forest categorization (NLP)
- ✅ RNN-based prediction
- ✅ Gemini advice integration
- ✅ Frontend (React + Tailwind)
- ✅ Dashboard (charts + AI insights)
- ✅ Backend with all REST APIs working locally
- ✅ Frontend React app with Tailwind CSS and charts
- ✅ ML microservice (FastAPI) with OCR, categorization, prediction, and advice
- ✅ .env.example files for setup
- ✅ Complete documentation
- All AI/ML features work offline except Gemini API calls
- No Docker or cloud setup required
- Code is modular, clean, and well-commented
- Uses realistic sample data to demonstrate charts
- Polished UI using Tailwind CSS components
For setup issues, refer to the detailed SETUP.md file or check the troubleshooting section.