A web-based personal finance management system built with Python and Flask. Users can track income and expenses by category, set monthly budgets, and receive real-time WhatsApp alerts when spending exceeds defined limits.
Transactions
- Log income and expense transactions with category, date, amount, and notes
- Mark transactions as recurring
- Filter transactions by date range and type
- Export full transaction history to CSV
Budget Management
- Set monthly spending limits per category
- Visual budget progress bars on the dashboard
- Automatic overspend detection on every new transaction
WhatsApp Alerts
- Real-time WhatsApp notification via Twilio when a category budget is exceeded
- Alert includes category name, budget limit, total spent, and overspend amount
- Each user registers their own phone number — alerts are user-specific
Dashboard
- Monthly summary: total income, total expenses, savings, SmartKharch score
- Expense breakdown chart by category
- Unread in-app alerts panel
| Layer | Technology |
|---|---|
| Backend | Python, Flask |
| Database | Microsoft SQL Server (via pyodbc) |
| Notifications | Twilio WhatsApp API |
| Frontend | HTML, CSS, Jinja2 |
| Environment | python-dotenv |
SmartKharch/
├── app.py # Flask routes and application logic
├── templates/
│ ├── login.html
│ ├── register.html
│ └── dashboard.html
├── static/
│ └── style.css
├── SQL For Projeck.sql # Full database schema and stored procedures
├── requirements.txt
├── .env # Environment variables (not committed)
└── README.md
Requirements: Python 3.9+, Microsoft SQL Server with ODBC Driver 17
Step 1 — Clone the repository
git clone https://github.com/Sta981/SmartKharch.git
cd SmartKharchStep 2 — Install dependencies
pip install -r requirements.txtStep 3 — Configure the database
Run SQL For Projeck.sql in SQL Server Management Studio to create the database, tables, and stored procedures.
Step 4 — Create the .env file
TWILIO_ACCOUNT_SID=your_account_sid
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_FROM=whatsapp:+14155238886
Step 5 — Run the application
python app.pyApp runs at http://localhost:5000
- Create a free account at twilio.com
- Go to Messaging > Try it Out > Send a WhatsApp Message
- From your phone, send the sandbox join message to
+14155238886 - Register on SmartKharch with your WhatsApp number (format:
+923001234567) - Alerts fire automatically when any category budget is exceeded
When a user adds an expense transaction, the system:
- Logs the transaction via a stored procedure (
sp_AddTransaction) - Fetches the user's phone number from the database
- Queries total spending for that category in the current month
- Compares against the set budget limit
- Sends a WhatsApp alert via Twilio if the limit is exceeded
| Table | Purpose |
|---|---|
| Users | Stores user credentials, currency, and phone number |
| Categories | Expense and income categories |
| Transactions | All income and expense records |
| Budgets | Monthly category spending limits per user |
| Alerts | In-app alert log |
| Monthly_Summary | Aggregated monthly stats and SmartKharch score |
| Package | Purpose |
|---|---|
| flask | Web framework |
| pyodbc | SQL Server database connection |
| twilio | WhatsApp notifications |
| python-dotenv | Environment variable management |
Developed by Syed Tahir — BS Artificial Intelligence, 4th Semester, Superior University Lahore