Skip to content

πŸ’° ExpenseWise - Full-stack expense tracker with React, Node.js & MySQL. Track expenses πŸ“Š, set budgets 🎯, analyze spending πŸ“ˆ. Features: JWT auth πŸ”, Razorpay premium πŸ’³, AI receipt scanner πŸ€–, Gemini-powered insights 🧠, analytics πŸ“‰, category breakdown πŸ₯§, leaderboard πŸ†, PDF export πŸ“₯, dark/light theme πŸŒ“, Arcjet rate limiting πŸ›‘οΈ.

License

Notifications You must be signed in to change notification settings

MdAbdullahAnwar/ExpenseWise-Smart_Expense_Tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

42 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’° ExpenseWise - Personal Expense Tracker

A full-stack expense tracking application built with React, Node.js, Express, and MySQL. Track your expenses, set budgets, analyze spending patterns, and manage your finances effectively.

License Node React

πŸ“‹ Table of Contents

✨ Features

Core Features

  • πŸ” User Authentication - Secure signup/login with JWT tokens
  • πŸ’³ Expense & Income Tracking - Add, edit, delete expenses and income
  • 🏦 Bank Account Management - Multiple accounts with balance tracking
  • πŸ”„ Recurring Transactions - Auto-add monthly salary/expenses
  • πŸ“Š Budget Tracking - Set monthly budgets with visual progress indicators
  • πŸ” Search & Filter - Find expenses by description, category, or amount
  • πŸ“± Responsive Design - Works seamlessly on desktop, tablet, and mobile
  • πŸŒ“ Dark/Light Theme - Toggle between themes (Premium feature)
  • πŸ›‘οΈ Rate Limiting - Arcjet protection against abuse

Premium Features

  • ⭐ Premium Membership - Razorpay payment integration (β‚Ή499)
  • πŸ“ˆ Advanced Analytics - Daily, weekly, monthly expense trends
  • πŸ“Š Category Breakdown - Visual pie charts of spending by category
  • πŸ† Leaderboard - Compare spending with other premium users
  • πŸ“₯ PDF Export - Download detailed expense reports
  • πŸ€– AI Receipt Scanner - Auto-fill expenses from receipt images
  • πŸ“§ Monthly Email Reports - AI-powered financial insights via email

Additional Features

  • πŸ‘€ Profile Management - Update personal info and upload profile photo
  • πŸ”„ Real-time Updates - Optimistic UI updates for instant feedback
  • πŸ“§ Password Reset - Email-based password recovery via Brevo
  • πŸ’Ύ Transaction Safety - Database transactions ensure data consistency
  • πŸ”” Toast Notifications - User-friendly feedback messages
  • πŸ“… Date-based Tracking - Track expenses by specific dates
  • πŸ“ Notes & Comments - Add notes to transactions
  • 🎯 Budget Alerts - Visual warnings when approaching budget limits

πŸ“Έ Screenshots

Landing Page - Hero Section

Landing Page Hero
Beautiful hero section with call-to-action and feature highlights

Landing Page - Features

Landing Page Features
Comprehensive feature showcase with icons and descriptions

Landing Page - Pricing

Landing Page Pricing
Transparent pricing plans with feature comparison

Add Expense

Add Expense
Simple and intuitive expense entry form with budget indicator

Expense List

Expense List
View all expenses with search, filter, and pagination

Premium Features

Premium
Premium membership page with Razorpay integration

Profile Page

Profile
User profile with statistics and photo upload

Unlocked Premium Features

Unlocked Premium
Premium membership page unlocked with Transaction breakdown days, weekly and monthly spending with pagination and Expense Report PDF Export

Expense Analysis

Expense Analysis
Comprehensive expense Category Breakdown, Expense Trends and Leaderboard comes in Premium membership

Category Breakdown

Category Breakdown
Pie chart showing expense distribution by category

Expense Trends

Expense Trends
Visual analytics with charts and spending trends daily, weekly and monthly

User Leaderboard

User Leaderboard
Top spenders list - See how you rank among all users and compete for the top spot

Dark Mode

Dark Mode
Beautiful dark theme for comfortable viewing

πŸ›  Tech Stack

Frontend

  • React 18 - UI library
  • Vite - Build tool and dev server
  • Redux Toolkit - State management
  • React Router v6 - Client-side routing
  • Axios - HTTP client
  • Tailwind CSS - Utility-first CSS framework
  • Lucide React - Icon library

Backend

  • Node.js - Runtime environment
  • Express.js - Web framework
  • MySQL - Relational database
  • Sequelize - ORM for MySQL
  • JWT - Authentication tokens
  • Bcrypt - Password hashing
  • Razorpay - Payment gateway
  • Brevo (Sendinblue) - Email service
  • Arcjet - Rate limiting & security
  • Node-cron - Scheduled tasks
  • Axios - HTTP client for AI APIs
  • OpenRouter - AI model access (GPT-4o-mini, Llama 3.2)
  • Zod - Schema validation

πŸš€ Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • MySQL (v8 or higher)
  • npm or yarn
  • Razorpay account (for premium features)
  • Brevo account (for email service - FREE tier available)
  • OpenRouter API key (for AI features - FREE tier available)
  • Arcjet API key (for rate limiting - FREE tier available)

πŸ“¦ Installation

1. Clone the Repository

git clone https://github.com/yourusername/expense-tracker.git
cd expense-tracker

2. Install Backend Dependencies

cd Backend
npm install

3. Install Frontend Dependencies

cd ../Frontend
npm install

πŸ”§ Environment Variables

Backend (.env)

Create a .env file in the Backend directory:

# Server Configuration
PORT=5000
NODE_ENV=development

# Database Configuration
DB_NAME=expense_tracker
DB_USER=root
DB_PASSWORD=your_password
DB_HOST=localhost

# JWT Secret
JWT_SECRET=your_super_secret_jwt_key_here

# Razorpay Configuration
RAZORPAY_KEY_ID=your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_secret

# Email Configuration (Brevo)
BREVO_API_KEY=your_brevo_api_key
BREVO_SENDER_EMAIL=your_email@example.com

# Frontend URL
FRONTEND_URL=http://localhost:5173

# Arcjet Configuration
ARCJET_KEY=your_arcjet_api_key
ARCJET_ENV=development

# AI Configuration (OpenRouter)
GEMINI_API_KEY=your_openrouter_api_key

Frontend (.env)

Create a .env file in the Frontend directory:

VITE_API_URL=http://localhost:5000

πŸ—„ Database Setup

1. Create Database

CREATE DATABASE expense_tracker;

2. Run Migrations

cd Backend
npx sequelize-cli db:migrate

This will create the following tables:

  • Users
  • Expenses
  • Orders
  • ForgotPasswordRequests
  • BankAccounts

3. Run Migration Script (Optional)

node scripts/migrateUserTotals.js

This populates user totals for existing data.

▢️ Running the Application

Start Backend Server

cd Backend
npm run dev

Backend runs on http://localhost:5000

Start Frontend Development Server

cd Frontend
npm run dev

Frontend runs on http://localhost:5173

Access the Application

Open your browser and navigate to http://localhost:5173

πŸ“š API Documentation

Authentication Endpoints

POST /user/signup

Register a new user

{
  "name": "John Doe",
  "email": "john@example.com",
  "password": "password123"
}

POST /user/login

Login user

{
  "email": "john@example.com",
  "password": "password123"
}

Expense Endpoints

GET /expense

Get all expenses (requires authentication)

POST /expense/add

Add new expense or income

{
  "amount": 500,
  "description": "Groceries",
  "category": "Food",
  "note": "Weekly shopping",
  "expenseDate": "2024-01-15",
  "type": "expense",
  "BankAccountId": 1,
  "isRecurring": false,
  "recurringDay": null
}

POST /expense/scan-receipt

Scan receipt image and extract data (AI-powered)

{
  "image": "data:image/jpeg;base64,..."
}

PUT /expense/:id

Update expense

DELETE /expense/:id

Delete expense

Premium Endpoints

POST /payment/create-order

Create Razorpay order

POST /payment/verify

Verify payment and activate premium

Profile Endpoints

PUT /user/profile

Update user profile

{
  "name": "John Doe",
  "email": "john@example.com",
  "phone": "+91 9876543210",
  "profilePhoto": "base64_encoded_image"
}

PUT /user/budget

Update monthly budget

{
  "monthlyBudget": 50000
}

Bank Account Endpoints

GET /bank-account

Get all bank accounts

POST /bank-account

Create new bank account

{
  "name": "HDFC Savings",
  "balance": 50000,
  "isDefault": true
}

PUT /bank-account/:id

Update bank account

DELETE /bank-account/:id

Delete bank account

Password Reset Endpoints

POST /password/forgot-password

Request password reset

{
  "email": "john@example.com"
}

POST /password/reset-password/:token

Reset password with token

{
  "password": "newpassword123"
}

πŸ€– AI Features

Receipt Scanner

  • Upload receipt images to auto-fill expense forms
  • Extracts: Amount, Description, Category, Date
  • Powered by: GPT-4o-mini via OpenRouter
  • Location: Available on /expenses page

Monthly Email Reports (Premium Only)

  • Automatic: Sent on 1st of every month at 9 AM IST
  • Includes:
    • Monthly income summary
    • Category-wise spending breakdown (β‚Ή and %)
    • AI-generated financial insights (3 actionable tips)
  • Powered by: Llama 3.2 via OpenRouter
  • Delivered via: Brevo email service

🏦 Bank Account Features

  • Multiple Accounts: Track expenses across different bank accounts
  • Balance Tracking: Real-time balance updates with transactions
  • Default Account: Set a default account for quick expense entry
  • Account Management: Add, edit, delete bank accounts
  • Transaction History: View all transactions per account

πŸ”„ Recurring Transactions

  • Monthly Salary: Auto-credit salary on specified day
  • Recurring Expenses: Auto-add monthly bills (rent, subscriptions)
  • Flexible Scheduling: Set any day (1-28) of the month
  • Automatic Processing: Cron job runs daily to process due transactions

πŸ›‘οΈ Security Features

  • JWT Authentication: Secure token-based auth
  • Password Hashing: Bcrypt with salt rounds
  • Rate Limiting: Arcjet protection (5 requests/10 seconds for expenses)
  • Input Validation: Zod schema validation
  • SQL Injection Protection: Sequelize ORM parameterized queries
  • CORS Configuration: Controlled cross-origin access

πŸ“§ Email Features

  • Password Reset: Secure token-based password recovery
  • Monthly Reports: AI-powered financial insights (Premium)
  • Transaction Notifications: Optional email alerts
  • Brevo Integration: Reliable email delivery (300 emails/day free)

πŸ“ Project Structure

expense-tracker/
β”œβ”€β”€ Backend/
β”‚   β”œβ”€β”€ config/              # Database and app configuration
β”‚   β”œβ”€β”€ controllers/         # Request handlers
β”‚   β”œβ”€β”€ services/           # Business logic
β”‚   β”œβ”€β”€ models/             # Sequelize models
β”‚   β”œβ”€β”€ routes/             # API routes
β”‚   β”œβ”€β”€ middlewares/        # Auth, validation, rate limiting
β”‚   β”œβ”€β”€ validators/         # Zod schemas
β”‚   β”œβ”€β”€ migrations/         # Database migrations
β”‚   β”œβ”€β”€ scripts/            # Utility scripts
β”‚   β”œβ”€β”€ docs/               # Backend documentation
β”‚   β”œβ”€β”€ .env                # Production environment variables
β”‚   β”œβ”€β”€ .env.local          # Local development environment variables
β”‚   β”œβ”€β”€ server.js           # Entry point
β”‚   └── package.json
β”‚
β”œβ”€β”€ Frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ assets/        # Static assets
β”‚   β”‚   β”‚   └── react.svg
β”‚   β”‚   β”œβ”€β”€ components/     # React components
β”‚   β”‚   β”‚   β”œβ”€β”€ layout/    # Layout components
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Footer.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Header.jsx
β”‚   β”‚   β”‚   β”‚   └── Layout.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ pages/     # Page components
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ analyse/      # Analytics pages
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ AnalysePage.jsx
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ CategoryBreakdown.jsx
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ExpenseTrends.jsx
β”‚   β”‚   β”‚   β”‚   β”‚   └── Leaderboard.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ bankAccount/  # Bank account management
β”‚   β”‚   β”‚   β”‚   β”‚   └── BankAccountPage.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ expense/      # Expense management pages
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ExpenseDetailModal.jsx
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ExpenseListPage.jsx
β”‚   β”‚   β”‚   β”‚   β”‚   └── ExpensePage.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ forms/        # Auth forms
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ForgotPasswordForm.jsx
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ LoginForm.jsx
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ResetPasswordForm.jsx
β”‚   β”‚   β”‚   β”‚   β”‚   └── SignupForm.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ landing/      # Landing page
β”‚   β”‚   β”‚   β”‚   β”‚   └── LandingPage.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ premium/      # Premium features pages
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ PremiumExpenseTracker.jsx
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ PremiumPage.jsx
β”‚   β”‚   β”‚   β”‚   β”‚   └── PremiumPurchase.jsx
β”‚   β”‚   β”‚   β”‚   └── profile/      # User profile page
β”‚   β”‚   β”‚   β”‚       └── ProfilePage.jsx
β”‚   β”‚   β”‚   └── ui/        # Reusable UI components
β”‚   β”‚   β”‚       β”œβ”€β”€ badge.jsx
β”‚   β”‚   β”‚       β”œβ”€β”€ button.jsx
β”‚   β”‚   β”‚       β”œβ”€β”€ card.jsx
β”‚   β”‚   β”‚       β”œβ”€β”€ input.jsx
β”‚   β”‚   β”‚       β”œβ”€β”€ label.jsx
β”‚   β”‚   β”‚       β”œβ”€β”€ Pagination.jsx
β”‚   β”‚   β”‚       └── toast.jsx
β”‚   β”‚   β”œβ”€β”€ config/        # Configuration files
β”‚   β”‚   β”‚   └── config.js  # API URL configuration
β”‚   β”‚   β”œβ”€β”€ constants/     # Constants
β”‚   β”‚   β”‚   β”œβ”€β”€ api/       # API constants
β”‚   β”‚   β”‚   β”‚   └── auth.js
β”‚   β”‚   β”‚   └── message.js # Message constants
β”‚   β”‚   β”œβ”€β”€ context/       # React contexts
β”‚   β”‚   β”‚   └── ThemeContext.jsx
β”‚   β”‚   β”œβ”€β”€ hooks/         # Custom hooks
β”‚   β”‚   β”‚   └── usePagination.js
β”‚   β”‚   β”œβ”€β”€ lib/           # Utilities
β”‚   β”‚   β”‚   └── utils.js
β”‚   β”‚   β”œβ”€β”€ store/         # Redux store
β”‚   β”‚   β”‚   β”œβ”€β”€ store.js
β”‚   β”‚   β”‚   └── userSlice.js
β”‚   β”‚   β”œβ”€β”€ utils/         # Utilities
β”‚   β”‚   β”‚   β”œβ”€β”€ api/       # Centralized API calls
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ auth/         # Auth API calls
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ forgotPassword.js
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ index.js
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ login.js
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ register.js
β”‚   β”‚   β”‚   β”‚   β”‚   └── resetPassword.js
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ bankAccount/  # Bank account API calls
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ createAccount.js
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ deleteAccount.js
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ getAllAccounts.js
β”‚   β”‚   β”‚   β”‚   β”‚   └── index.js
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ expense/      # Expense API calls
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ createExpense.js
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ deleteExpense.js
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ getAllExpenses.js
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ index.js
β”‚   β”‚   β”‚   β”‚   β”‚   └── updateExpense.js
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ premium/      # Premium API calls
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ downloadExpenses.js
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ getLeaderboard.js
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ index.js
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ purchasePremium.js
β”‚   β”‚   β”‚   β”‚   β”‚   └── updateTransaction.js
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ profile/      # Profile API calls
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ getStats.js
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ index.js
β”‚   β”‚   β”‚   β”‚   β”‚   └── updateBudget.js
β”‚   β”‚   β”‚   β”‚   └── index.js      # Main API export
β”‚   β”‚   β”‚   β”œβ”€β”€ api.js     # Request handler (axios wrapper)
β”‚   β”‚   β”‚   └── validateForm.js
β”‚   β”‚   β”œβ”€β”€ App.css        # App styles
β”‚   β”‚   β”œβ”€β”€ App.jsx        # Main app component
β”‚   β”‚   β”œβ”€β”€ index.css      # Global styles
β”‚   β”‚   └── main.jsx       # Entry point
β”‚   β”œβ”€β”€ docs/              # Frontend documentation
β”‚   β”œβ”€β”€ .env               # Production environment variables
β”‚   β”œβ”€β”€ .env.local         # Local development environment variables
β”‚   β”œβ”€β”€ vite.config.js     # Vite configuration
β”‚   └── package.json
β”‚
β”œβ”€β”€ screenshots/           # Application screenshots
β”œβ”€β”€ README.md             # This file
└── LICENSE               # MIT License

🎯 Key Features Explained

Budget Tracking

Set a monthly budget and track your spending in real-time. Visual indicators show:

  • Green: Under 60% of budget
  • Yellow: 60-80% of budget
  • Orange: 80-100% of budget
  • Red: Over budget

Transaction Safety

All database operations use transactions to ensure:

  • Atomicity: Operations complete fully or not at all
  • Consistency: Data remains valid
  • Isolation: Concurrent operations don't interfere
  • Durability: Committed changes persist

Optimistic Updates

The UI updates immediately when you:

  • Add an expense
  • Edit an expense
  • Delete an expense

If the operation fails, changes are automatically reverted.

Premium Membership

Unlock advanced features with a one-time payment of β‚Ή499:

  • Advanced analytics and trends
  • Category breakdown charts
  • Leaderboard access
  • CSV export functionality
  • Dark/Light theme toggle

πŸ”’ Security Features

  • JWT-based authentication with 1-hour token expiry
  • Bcrypt password hashing with salt rounds
  • SQL injection prevention via Sequelize ORM
  • XSS protection with React's built-in escaping
  • CORS configuration for API security
  • Environment variables for sensitive data
  • Auto-logout on token expiration

πŸ§ͺ Testing

Backend Tests

cd Backend
npm test

Frontend Tests

cd Frontend
npm test

πŸ“ˆ Performance

  • Lazy loading for route-based code splitting
  • Optimized bundle size with Vite
  • Database connection pooling
  • Efficient state management with Redux
  • Pagination for large datasets
  • Image optimization for profile photos

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘¨β€πŸ’» Author

Your Name

πŸ™ Acknowledgments

  • React team for the amazing library
  • Express.js for the robust backend framework
  • Tailwind CSS for the utility-first CSS framework
  • Razorpay for payment integration
  • All open-source contributors

πŸ“ž Support

For support, email crazydeveloper4444@gmail.com or open an issue on GitHub.

πŸ—Ί Roadmap

  • Mobile app (React Native)
  • Recurring expenses
  • Multi-currency support
  • Expense categories customization
  • Budget alerts via email/SMS
  • Export to PDF
  • Expense sharing with family
  • AI-powered spending insights
  • Bank account integration
  • Receipt scanning with OCR

Made with ❀️ by MD Abdullah Anwar

About

πŸ’° ExpenseWise - Full-stack expense tracker with React, Node.js & MySQL. Track expenses πŸ“Š, set budgets 🎯, analyze spending πŸ“ˆ. Features: JWT auth πŸ”, Razorpay premium πŸ’³, AI receipt scanner πŸ€–, Gemini-powered insights 🧠, analytics πŸ“‰, category breakdown πŸ₯§, leaderboard πŸ†, PDF export πŸ“₯, dark/light theme πŸŒ“, Arcjet rate limiting πŸ›‘οΈ.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages