A full-stack, production-ready AI-powered expense and receipt management application built with the MERN stack. Features intelligent OCR scanning, AI-driven expense categorization, interactive dashboards, cloud backup, fraud detection, and multi-format reporting.
Designed for individuals and small businesses to digitize, organize, and gain insights from financial receipts and expenses β ideal for final-year projects, placement portfolios, and technical showcases.
- Live Demo
- Key Features
- Tech Stack
- Project Structure
- Screenshots
- Getting Started & Local Setup
- API Overview
- Security Architecture
- Docker Support
- Contact
Check out the live application: π ScanExpense
- Upload receipt images via drag-and-drop file upload (powered by
react-dropzone). - Automatic text extraction using Tesseract.js OCR engine with image preprocessing (grayscale, normalize, sharpen via Sharp).
- Extracted data parsed and structured into expense records with merchant name, date, amounts, line items, and tax.
- Fallback extraction logic when OCR confidence is low.
- Integrates with OpenAI GPT-4 to intelligently parse raw OCR text into structured receipt data.
- Extracts merchant name, date, total/subtotal/tax amounts, receipt number, currency, line items, and category.
- Smart category assignment from 9 predefined categories (Food & Dining, Transport, Shopping, Healthcare, Education, Entertainment, Travel, Utilities, Others).
- Fallback regex-based extraction when AI is unavailable.
- GPT-4 powered insights engine analyzes your spending patterns and generates personalized financial advice.
- Insights categorized by type: saving tips, warnings, budget recommendations, and general insights.
- Each insight includes a priority level (high/medium/low) for actionable decision-making.
- AI Chatbot Assistant β conversational interface to ask questions about your finances, get spending summaries, and receive personalized advice.
- Statistical anomaly detection: Flags transactions that exceed 3x the category average (Z-score based).
- Severity classification: high (>5x average) and medium (>3x average) severity levels.
- Duplicate receipt detection: Identifies receipts with same merchant and similar amounts within a 3-day window.
- Fraud scoring: Detects 3+ identical receipts within 24 hours and flags amounts over $10,000.
- Real-time fraud assessment during receipt upload with confidence scoring.
- Real-time spending summaries with Recharts visualizations (bar, pie, line, and area charts).
- Monthly/yearly spending trends and category breakdowns with color-coded categories.
- Key metrics: total expenses, monthly spending, average transaction value, receipt count.
- Responsive stat cards with animated counters and skeleton loading states.
- Full CRUD operations on expenses with search, filter (by category), and sort (by date/amount).
- Manual expense entry for non-receipt transactions.
- Paginated listing with 50 items per page.
- Total spending summary with formatted currency display.
- Set and track monthly budgets by category.
- Visual progress indicators showing spending vs. budget limits.
- Budget alerts and overspend warnings.
- Generate PDF reports using PDFKit with professional formatting and branding.
- Export multi-sheet Excel reports via ExcelJS for bookkeeping.
- Downloadable reports with unique filenames and timestamps.
- Report history with download management.
- One-click backup of all receipts, expenses, and user data.
- Cloudinary integration for receipt image storage with secure uploads.
- Full restore capability from any backup point.
- Backup history with timestamps and status tracking.
- Automated cron-based backup scheduling via node-cron.
- User management dashboard with role-based access (Admin/User).
- System-wide statistics: total users, receipts, expenses, storage usage.
- User account management (view, delete).
- Backup oversight and restore operations.
- JWT-based authentication with dual-token system: short-lived access tokens (15 min) + refresh tokens (7 days) with rotation.
- Password reset flow: Forgot password β email with reset link β secure token-based reset.
- bcrypt password hashing with salt rounds.
- Rate limiting: API-wide (100 req/15 min) + upload-specific (20 uploads/5 min).
- Helmet security headers (CSP, HSTS, X-Frame-Options, X-Content-Type-Options, etc.).
- CORS with strict origin whitelist.
- Input validation and sanitization via express-validator.
- Centralized error handler preventing information leakage.
- Transactional emails: welcome messages, password reset links, backup confirmations.
- Configurable SMTP provider (Gmail, SendGrid, etc.).
- HTML email templates with responsive design.
- Notification preferences and in-app notification center.
- Full dark mode support with persistent theme selection via Redux.
- Smooth theme transitions with Framer Motion animations.
- System preference detection for initial theme.
- Built with Tailwind CSS for fully responsive design across desktop, tablet, and mobile.
- Framer Motion page transitions, staggered list animations, and micro-interactions.
- Glass-morphism card designs with hover effects.
- Skeleton loading states for all data-fetching views.
- Receipt image preprocessing with Sharp: grayscale conversion, normalization, and sharpening for improved OCR accuracy.
- Multiple upload support with file type and size validation (10MB limit).
- Local filesystem + Cloudinary dual storage strategy.
| Layer | Technology |
|---|---|
| Frontend | React 18, Vite, Tailwind CSS, Framer Motion, Redux Toolkit, Recharts, Lucide Icons |
| Backend | Node.js, Express.js, Socket.IO, Winston Logger |
| Database | MongoDB + Mongoose (with indexed schemas) |
| OCR | Tesseract.js |
| AI/ML | OpenAI GPT-4 API |
| Storage | Cloudinary (images), Local filesystem (uploads) |
| Auth | JWT (access + refresh tokens), bcrypt |
| Nodemailer (SMTP) | |
| Reports | PDFKit, ExcelJS |
| Containerization | Docker + Docker Compose |
| Scheduling | node-cron |
expense-scanner/
βββ backend/
β βββ config/ # DB, Cloudinary, OpenAI, env config
β βββ controllers/ # Express route handlers (auth, receipts, expenses, reports, etc.)
β βββ middleware/ # JWT auth, admin guard, upload, rate limiter, validation, error handler
β βββ models/ # Mongoose schemas (User, Receipt, Expense, Category, Report, etc.)
β βββ routes/ # RESTful API route definitions
β βββ services/ # Business logic (AI, OCR, email, storage, reports, duplicates)
β βββ templates/ # Email and report templates
β βββ utils/ # Helpers and logger
β βββ uploads/ # Local file uploads directory
β βββ public/ # Static assets and placeholder images
β βββ jobs/ # Cron jobs (backup scheduling)
β βββ scripts/ # Utility scripts
β βββ server.js # Server entry point
β βββ package.json
βββ frontend/
β βββ src/
β β βββ api/ # Axios API client and auth helpers
β β βββ components/ # Reusable UI components (layouts, common, auth)
β β βββ pages/ # Route pages (Landing, Login, Dashboard, Receipts, etc.)
β β βββ store/ # Redux Toolkit slices (auth, theme, expenses, receipts)
β β βββ utils/ # Formatters & helpers
β βββ public/images/ # App screenshots
β βββ index.html
β βββ vite.config.js
β βββ tailwind.config.js
β βββ postcss.config.js
β βββ package.json
βββ docker/
β βββ Dockerfile.backend
β βββ nginx.conf
βββ docker-compose.yml
βββ docker-compose.prod.yml
βββ .env.example
βββ .gitignore
βββ render.yaml
βββ README.md
| Login | Register |
|---|---|
![]() |
![]() |
| Dashboard Overview |
|---|
![]() |
| Receipt Upload | Reconciliation Workbench |
|---|---|
![]() |
![]() |
| Fraud Alerts | Audit Logs |
|---|---|
![]() |
![]() |
| Profile | Storage | Password |
|---|---|---|
![]() |
![]() |
![]() |
| Devices & Sessions | Account Options |
|---|---|
![]() |
![]() |
- Node.js v18 or higher
- MongoDB (local instance or MongoDB Atlas connection string)
- Cloudinary account (for image uploads)
- OpenAI API key (for AI categorization)
# Install backend dependencies
cd backend
npm install
# Install frontend dependencies
cd ../frontend
npm installCopy the example environment file and configure your variables:
cp .env.example backend/.env# Server
PORT=5000
NODE_ENV=development
# MongoDB
MONGODB_URI=mongodb://localhost:27017/expense-scanner
# JWT
JWT_SECRET=your-super-secret-jwt-key
JWT_REFRESH_SECRET=your-super-secret-refresh-key
JWT_EXPIRES_IN=15m
JWT_REFRESH_EXPIRES_IN=7d
# Cloudinary (for receipt image uploads)
CLOUDINARY_CLOUD_NAME=your-cloud-name
CLOUDINARY_API_KEY=your-api-key
CLOUDINARY_API_SECRET=your-api-secret
# OpenAI (for AI categorization)
OPENAI_API_KEY=your-openai-api-key
# SMTP (for email notifications)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
EMAIL_FROM=noreply@expensescanner.com
# URLs
FRONTEND_URL=http://localhost:5173
BACKEND_URL=http://localhost:5000cd backend
npm run devThe API server starts at http://localhost:5000.
cd frontend
npm run devThe Vite dev server starts at http://localhost:5173.
Open your browser and navigate to http://localhost:5173.
| Method | Endpoint | Description |
|---|---|---|
| Auth | ||
| POST | /api/auth/register |
Register a new user |
| POST | /api/auth/login |
Login and receive JWT tokens |
| POST | /api/auth/refresh |
Refresh access token |
| POST | /api/auth/forgot-password |
Request password reset email |
| POST | /api/auth/reset-password/:token |
Reset password with token |
| GET | /api/auth/profile |
Get current user profile |
| Receipts | ||
| POST | /api/receipts/upload |
Upload receipt image(s) |
| GET | /api/receipts |
List all receipts (paginated) |
| GET | /api/receipts/:id |
Get single receipt details |
| DELETE | /api/receipts/:id |
Delete a receipt |
| Expenses | ||
| GET | /api/expenses |
List expenses (filtered, paginated) |
| POST | /api/expenses |
Create a new expense |
| GET | /api/expenses/stats |
Get spending statistics and charts data |
| GET | /api/expenses/:id |
Get single expense |
| PUT | /api/expenses/:id |
Update an expense |
| DELETE | /api/expenses/:id |
Delete an expense |
| Insights | ||
| GET | /api/insights |
Get AI-powered spending insights |
| Reports | ||
| POST | /api/reports/generate |
Generate PDF or Excel report |
| GET | /api/reports |
List generated reports |
| GET | /api/reports/download/:id |
Download a report file |
| Backup | ||
| POST | /api/backup |
Create a new backup |
| GET | /api/backup |
List all backups |
| POST | /api/backup/restore/:id |
Restore from a backup |
| DELETE | /api/backup/:id |
Delete a backup |
| Notifications | ||
| GET | /api/notifications |
List user notifications |
| PUT | /api/notifications/:id/read |
Mark notification as read |
| Admin | ||
| GET | /api/admin/users |
List all users (admin only) |
| GET | /api/admin/stats |
Get system statistics (admin only) |
| DELETE | /api/admin/users/:id |
Delete user (admin only) |
| Health | ||
| GET | /api/health |
Health check endpoint |
-
JWT Token Authentication: Short-lived access tokens (15 min) with refresh token rotation (7 days). Tokens are sent via secure HTTP-only cookies or Authorization headers.
-
Rate Limiting: API-wide rate limiting (100 requests per 15 min per IP) and upload-specific limits (20 uploads per 5 min).
-
Input Validation: All request bodies validated using
express-validatorwith sanitization to prevent NoSQL injection. -
Security Headers:
Helmetmiddleware configures 15+ HTTP security headers (CSP, HSTS, X-Frame-Options, etc.). -
CORS Protection: Strict origin whitelist allowing only configured frontend/backend URLs.
-
Password Security: bcrypt hashing with salt rounds; password reset flow with expiring tokens.
-
File Upload Safety: File type validation, size limits (10MB), and Cloudinary virus scanning integration.
-
Error Handling: Centralized error handler prevents information leakage in production.
docker-compose updocker-compose -f docker-compose.prod.yml upFeel free to reach out:
- LinkedIn: Jay Avgune
- GitHub: jayavgune18











