An AI-assisted expense tracking system with intelligent categorization and real-time financial insights.
SpendSense is a full-stack AI-assisted expense tracking application that helps users manage and analyze their finances intelligently. It combines machine learning with interactive dashboards to provide automatic expense categorization and meaningful insights into spending habits.
๐ Frontend: SpendSense App
๐ Backend API: API Endpoint
The application is fully deployed and accessible through the live demo links above.
- HTML
- CSS
- JavaScript
- React (CDN)
- Chart.js
- Python (Flask)
- REST API architecture
- JWT Authentication
- PostgreSQL (Render โ Production)
- SQLite (Local Development)
- Scikit-learn
- TF-IDF Vectorizer
- Naive Bayes Classifier
- ๐ User Authentication (Signup / Login)
- ๐ฐ Add, Edit, Delete Expenses
- ๐ Search & Filter Expenses
- ๐ค AI-assisted Expense Categorization
- ๐ Interactive Dashboard & Charts
- ๐ Spending Insights & Analytics
- โ๏ธ Fully Deployed (Frontend + Backend + Database)
All endpoints require the header:
Authorization: Bearer <token>
except authentication routes.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/signup |
Register a new user |
| POST | /api/auth/login |
Login and receive JWT token |
Example signup request:
{
"name": "Jane",
"email": "jane@example.com",
"password": "secret123"
}Example login request:
{
"email": "jane@example.com",
"password": "secret123"
}Example response:
{
"token": "<jwt>",
"user": {
"id": 1,
"name": "Jane",
"email": "jane@example.com"
}
}| Method | Endpoint | Description |
|---|---|---|
| GET | /api/expenses |
List all expenses |
| POST | /api/expenses |
Add a new expense |
| PUT | /api/expenses/<id> |
Update an expense |
| DELETE | /api/expenses/<id> |
Delete an expense |
| POST | /api/expenses/categorize |
Get AI category suggestion |
| GET | /api/expenses/insights |
Spending insights and analytics |
Example expense request:
{
"title": "Lunch at Zomato",
"amount": 350.00,
"category": "",
"date": "2024-01-15",
"notes": "Team lunch"
}Example insights response:
{
"total": 12500.00,
"count": 45,
"by_category": [
{
"category": "Food & Dining",
"amount": 4200.00,
"percent": 33.6
}
],
"monthly": [
{
"month": "2024-01",
"amount": 6200.00
}
]
}Expense Title โ TF-IDF Vectorization โ Naive Bayes Model โ Category Prediction โ Confidence Check
- If confidence โฅ 40% โ ML prediction used
- If confidence < 40% โ Rule-based fallback categorization
spendsense/
โ
โโโ backend/
โ โโโ app.py # Flask application entry point
โ โโโ requirements.txt # Python dependencies
โ โโโ expenses.db # SQLite database (auto-created on first run)
โ โ
โ โโโ models/
โ โ โโโ __init__.py
โ โ โโโ models.py # SQLAlchemy models (User, Expense)
โ โ
โ โโโ routes/
โ โ โโโ __init__.py
โ โ โโโ auth.py # Authentication APIs (signup, login)
โ โ โโโ expenses.py # Expense CRUD operations & insights APIs
โ โ
โ โโโ utils/
โ โโโ categorizer.py # Rule-based expense categorization logic
โ โโโ train_model.py # Script to train ML categorization model
โ โโโ model.pkl # Trained machine learning model
โ
โโโ frontend/
โ โโโ index.html # Single-page React interface (CDN-based)
โ
โโโ screenshots/ # UI screenshots for README
โ โโโ auth.png
โ โโโ dashboard.png
โ โโโ expenses.png
โ โโโ insights.png
โ
โโโ .gitignore # Ignored files (venv, cache, env files)
โโโ README.md # Project documentation
Follow these steps to run the project locally.
git clone https://github.com/kamalsharma001/spendsense.git
cd spendsenseNavigate to the backend folder and create a virtual environment.
cd backend
python -m venv venvActivate the virtual environment.
Windows
venv\Scripts\activateMac / Linux
source venv/bin/activateInstall dependencies and start the backend server.
pip install -r requirements.txt
python utils/train_model.py
python app.pyThe backend will start at:
http://127.0.0.1:5000
Open a new terminal and run:
cd frontend
python -m http.server 3000Then open your browser and go to:
http://localhost:3000
The application should now be running locally.
- Frontend: Netlify
- Backend: Render
- Database: PostgreSQL (Render)
- Free database has limited lifetime on free tier
- Backend may experience cold start delay
- ML model accuracy depends on training dataset
- ๐ฑ Mobile application version
- ๐ Budget alerts & notifications
- ๐ค Export reports (PDF / Excel)
- ๐ง Advanced ML categorization models
- ๐ฅ Multi-user financial analytics
Kamal Sharma
B.E. Computer Science Engineering (AI & ML)
Chandigarh University



