Expensync is a full-stack, production-hardened personal finance and expense tracking application built using the MERN stack (MongoDB, Express.js, React, Node.js) paired with a specialized Python Flask Machine Learning microservice. The platform helps users monitor their financial health, track transactions, set category-specific budgets, parse receipt text dynamically, and forecast spending habits with real-time feedback.
๐ Live Demo: https://expensyncj17.vercel.app
| Light Theme Layout | Dark Theme Layout |
|---|---|
![]() |
![]() |
- ๐ Secure Dual-Token Auth โ Stateless JWT authentication flow with automatic silent Access Token refresh interceptors.
- ๐ง Behavioral AI Financial Insights โ Dynamic assessment of Financial Health Score and Safe Spending Capacity driven by category budgeting and recent transactional velocity.
- ๐ Smart Forecasting โ Linear Regression spending models forecasting next-month categorical expenses.
- ๐ท๏ธ KNN Category Classifier โ Autocompletion and suggestion of categories based on historical transaction titles and contextual merchant normalization.
- ๐พ Adaptive Learning Memory โ Store merchant classification corrections locally to improve autocompletion over time.
- ๐ Smart Input NLP Parser โ Enter transactions in plain English (e.g. "$45 for pizza yesterday at Dominoes") and let the parser extract title, amount, category, and date.
- ๐งพ OCR Receipt Scanner โ Upload images of receipts to automatically extract transaction details via Tesseract.js.
- ๐ Premium Analytics & Visualizations โ Highly responsive Pie and Doughnut visualizations comparing category allocations and income-to-expense ratios.
- โฐ Obligations Tracker โ Live scheduler for upcoming, recurring reminders, and debt accounts.
- ๐ฑ Responsive Mobile-First UI โ Fully adaptive dark/light glassmorphic layout using Tailwind CSS.
- Frontend: React (Vite), Tailwind CSS, Framer Motion, Chart.js, Lucide Icons.
- Backend: Node.js, Express.js, JWT, Mongoose, Helmet (Security Headers), Express Rate Limit (Brute Force Protection).
- ML Microservice: Python, Flask, Scikit-Learn (KNN Classifier, Linear Regression), PyMongo.
- Database: MongoDB Atlas (Cloud NoSQL).
- Hosting: Vercel (Frontend), Render (Backend & ML Service).
graph TD
Client[React Frontend / Vite] <-->|HTTPS / JSON + JWT| API[Express API Server]
API <-->|Mongoose ORM| DB[(MongoDB Atlas)]
API <-->|HTTP / JSON + 2s Timeout| ML[Flask ML Service]
ML <-->|PyMongo Read-only| DB
Expensync/
โโโ client/ # React Frontend
โ โโโ src/
โ โ โโโ api/ # Centralized Axios Client & Interceptors
โ โ โโโ components/ # Reusable UI & Layout Components
โ โ โโโ context/ # Theme & Global Spinner Context
โ โ โโโ pages/ # Home, Login, Signup, Landing
โ โโโ vercel.json # Vercel SPA Routing Configuration
โโโ server/ # Express API Backend
โ โโโ controllers/ # Business Logic Modules
โ โโโ middleware/ # Auth, Upload, Validation Middlewares
โ โโโ models/ # Mongoose Database Schemas
โ โโโ routes/ # REST Route Groupings
โ โโโ index.js # Server Bootstrapper & Middleware Setup
โโโ ml-service/ # Flask Machine Learning Backend
โ โโโ services/ # KNN Predictor, Linear Forecast, Insights Engines
โ โโโ utils/ # Configuration & Environment Adapters
โ โโโ app.py # Flask Route ControllersSet up environment variables in their respective project subdirectories.
Create client/.env based on client/.env.example:
VITE_API_URL=http://localhost:5000/api/v1Create server/.env based on server/.env.example:
PORT=5000
MONGO_URI=mongodb+srv://your_user:your_password@your_cluster.mongodb.net/financeTracker
JWT_SECRET=your_jwt_access_secret_key
REFRESH_TOKEN_SECRET=your_jwt_refresh_secret_key
ML_SERVICE_URL=http://localhost:5050
ALLOWED_ORIGIN=http://localhost:5173Create ml-service/.env based on ml-service/.env.example:
ML_PORT=5050
MONGO_URI=mongodb+srv://your_user:your_password@your_cluster.mongodb.net/financeTrackerEnsure you have the following installed locally:
- Node.js (v16.x or newer)
- Python (v3.9.x or newer)
- A running MongoDB instance (or Atlas account)
cd server
npm install
npm run devcd ml-service
# Linux/macOS:
python3 -m venv venv
source venv/bin/activate
# Windows:
# python -m venv venv
# venv\Scripts\activate
pip install -r requirements.txt
python app.pycd client
npm install
npm run devOpen your browser to: http://localhost:5173
The application is structured to meet core industry security and stability guidelines:
- CORS Origin Restrictions: Only configured domains (e.g., Vercel host) are authorized to exchange data.
- Helmet Security Headers: Protection against cross-site scripting (XSS), clickjacking, and mime-sniffing.
- JSON Payload Limits: Enforced
10mbcap on uploads to prevent memory depletion exploits. - Network Resilience: Front-end requests are equipped with a
15-secondnetwork timeout; server calls to the Flask microservice use a2-secondcircuit-breaking timeout with automated fallback to mathematical calculations if the ML node goes offline. - Brute-Force Rate Limiting: Max 5 sign-in attempts per 15-minute window per IP.
The application utilizes six MongoDB collections modeled via Mongoose to maintain relational constraints:
users: Contains account identities, hashed passwords (bcryptjs), and active JWT refresh tokens.transactions: The core ledger holding date, title, amount (negatives represent expenses), category, tag arrays, and user owner association.budgets: Defines monthly category-specific spending caps and overall savings targets.reminders: Scheduled transactions tracking recurring billing events.debts: Outstanding loans or balances owed.merchantrules: Tracks custom classifications created by the user, powering the adaptive category-matching memory.
- Select the
/clientdirectory in the repository during importing. - Set the build framework to Vite.
- Add Environment Variable:
VITE_API_URLpointing to your Express API server. - Deployment completes automatically; routing fallbacks are pre-configured inside
vercel.json.
- Select the
/serverdirectory. - Set the Environment to Node.
- Use the build command
npm install. - Use the start command
npm start. - Map env variables:
MONGO_URI,JWT_SECRET,REFRESH_TOKEN_SECRET,ALLOWED_ORIGIN(your Vercel link), andML_SERVICE_URL(your Render ML link).
- Select the
/ml-servicedirectory. - Set the Environment to Python.
- Use the build command
pip install -r requirements.txt. - Use the start command
gunicorn app:app. - Map env variables:
MONGO_URIandML_PORT.
- ๐ Advanced Portfolio Analytics: Asset allocation tracking and investment returns integration.
- ๐ฆ Real-Time Bank Syncing: Secure bank connection via Plaid API for automated ledger updates.
- ๐ณ Smart Bill Splitting: Group split calculation and peer reminders.
- Jitesh Bhakat (Creator & Full-stack Architect)
- GitHub: Jitesh8260
- LinkedIn: Jitesh Kumar
โญ If you found Expensync helpful, please consider starring the repository! โญ


