A full-stack personal finance management application combining a C++ backend with a Node.js/Express web interface using RESTful APIs. Track expenses, manage budgets, get personalized spending recommendations, and with anomaly detection to flag unusual transactions.
- Features
- Tech Stack
- Installation
- API Endpoints
- Project Structure
- Usage
- Prerequisites
- Security
- Contributing
- Support
- User registration and authentication
- Add and track transactions
- Set budgets by category
- View spending analytics
- Get personalized recommendations
- Category-wise expense breakdown
- Anomaly Detection: Detects unusual spending patterns and alerts the user for confirmation before adding suspicious transactions with an achieved accuracy of 94.63% .
- Food
- Shopping
- Entertainment
- Personal
- Health
- Travel
- Rent
- Income
- Miscellaneous
- C++ core engine
- File-based data persistence
- Custom data structures (doubly linked lists)
- Priority queue for recommendations
- Node.js
- Express.js
- JWT (JSON Web Tokens) for user authentication and authorization
- Python Backend for Anomaly Detection:
- Isolation Forest Model
- Flask API for anomaly detection
- HTML/CSS
- Javascript
- REST APIs
- Clone the repository
git clone https://github.com/Luv-valecha/Finance_Tracker.git
cd Finance_Tracker- Install Node.js dependencies
npm install- Compile C++ backend
cd .\backend\
g++ -o finance_tracker main.cpp Login_system.cpp Transactions.cpp post_data.cpp get_data.cpp BudgetNRecommender.cpp Statistics.cpp- Set up the Anomaly Detection Python server:
- Navigate to the "Anomaly_Detection_Model" folder:
cd ./backend/Anomaly_Detection_Model- Install required Python dependencies (ensure Python 3.x is installed):
Install required Python dependencies (ensure Python 3.x is installed):- Run the Python server:
python anomaly_detector.pyThis will start a Flask server that listens for anomaly detection requests.
- Create environment file
# .env
PORT=3000- Start the Node.js server
cd .\frontend\
node server.jsPOST /api/register - Register new user
POST /api/login - Login user (JWT generated on success)
GET /api/logout - Logout user (invalidate JWT on client-side)POST /api/add-transaction - Add new transaction
GET /api/transactions - Get all transactions
GET /api/cattransactions - Get transactions by category
GET /api/daterangetransactions - Get transactions by date range
POST /api/detect-anomaly - Detect anomalies in a new transactionPOST /api/setbudget - Set category budgets
GET /api/categorywisespend - Get spending breakdown
GET /api/getrecommendation - Get spending recommendations├── backend/
│ ├── main.cpp
│ ├── Login_system.cpp/h
│ ├── Transactions.cpp/h
│ ├── Transhist.h
│ ├── post_data.cpp
│ ├── get_data.cpp
│ ├── BudgetNRecommender.cpp
│ ├── Statistics.cpp
│ └── Anomaly_Detection_Model/
│ ├── anomaly_detector.py
│ ├── requirements.txt
│ ├── encoder.pkl
│ ├── scaler.pkl
│ └── anomaly_detection_model.pkl
├── frontend/
│ ├── public/
│ │ ├── index.html
│ │ ├── register.html
│ │ ├── dashboard.html
│ │ ├── css/
│ │ │ ├──images/
│ │ │ └──style.css
│ │ └──js/
│ │ │ ├──app.js
│ │ │ └──utils.js
│ ├── routes/
│ │ └── api.js
│ └── server.js
├── package.json
└── README.md-
Register a new account at
/register -
Login at
/login- JWT token will be returned upon successful login. Store it securely (e.g., in a cookie or localStorage)
-
Add transactions:
- Enter date
- Enter amount
- Select category
- Add description
-
View transactions:
- See all transactions
- Filter by category
- Filter by type
- Filter by date range
-
Manage budget:
- Set category budgets
- Track spending vs budget
- View recommendations
-
Anomaly Detection:
- When a user adds a new transaction, the system sends the transaction data to the Python backend.
- The Python server uses an Isolation Forest model, trained on the user’s past transactions, to detect anomalies in the new transaction.
- If an anomaly is detected, the user is alerted to confirm the transaction details.
- The transaction is either confirmed and added to the system or rejected based on the user's input.
- Achieved an accuracy of 94.63%
- Note: To use the anomaly detection feature, ensure the Python server is running separately.
- Node.js
- C++ compiler
- npm
- Python 3.x
- Required Python dependencies (pip install -r requirements.txt)
- Password hashing
- JWT authentication (using tokens for secure user authentication and session management)
- Input validation
- Secure file operations
- Fork the repo
- Create feature branch
- Commit changes
- Push to branch
- Open pull request
For issues or questions, please open an issue in the repository.