A comprehensive MERN stack application for personal finance management with AI-powered receipt processing, bank statement analysis, and intelligent analytics.
π Live Demo β’ π Documentation β’ π€ Contributing β’ π Report Bug
- Smart Receipt Processing: Extract transaction data from photos using Google Gemini AI
- Bank Statement Analysis: Parse PDF statements and auto-import transactions
- Intelligent Categorization: AI-powered transaction categorization
- Financial Insights: Get personalized spending recommendations
- Complete CRUD Operations: Create, view, edit, and delete transactions
- Advanced Filtering: Filter by date range, category, amount, and type
- Smart Search: Search across descriptions, merchants, and categories
- Bulk Operations: Select and manage multiple transactions
- Interactive Dashboards: Mobile-optimized financial overview
- Spending Trends: Beautiful charts showing income/expense patterns
- Category Breakdown: Detailed analysis of spending by category
- P2P Tracking: Monitor money lent, borrowed, and shared
- P2P Transaction Tracking: Track money with friends and family
- Status Management: Pending, completed, overdue status tracking
- Contact Integration: Link transactions to contacts
- Due Date Reminders: Never forget to collect or pay back money
- Mobile-First Design: Optimized for all screen sizes
- Real-time Updates: Instant feedback and notifications
- Drag & Drop Uploads: Intuitive file upload interface
- Minimal UI: Clean, rounded design with smooth animations
Frontend Libraries:
- React 18 - Modern UI library with hooks
- Vite - Lightning-fast build tool and dev server
- Tailwind CSS - Utility-first CSS framework
- Recharts - Responsive charting library
- React Router - Declarative routing
- Axios - Promise-based HTTP client
- React Hot Toast - Beautiful notifications
- Lucide React - Beautiful & consistent icons
Backend Stack:
- Node.js - JavaScript runtime environment
- Express.js - Fast, unopinionated web framework
- MongoDB - NoSQL document database
- Mongoose - Elegant MongoDB object modeling
- JWT - Secure authentication tokens
- bcryptjs - Password hashing
- Multer - File upload middleware
- Express Rate Limit - Rate limiting middleware
AI Integration:
- Google Gemini API - Advanced AI for text processing
- pdf-parse - PDF text extraction
- Sharp - Image processing
Ensure you have the following installed on your system:
- Node.js (v16.0.0 or higher) - Download
- MongoDB (v4.4 or higher) - Download
- npm (comes with Node.js) or yarn
- Git - Download
- MongoDB Compass - GUI for MongoDB
- Postman - API testing tool
- VS Code - Code editor with extensions
git clone https://github.com/4xush/Spendiq.git
cd Spendiq# Navigate to backend directory
cd backend
# Install dependencies
npm install
# Create environment file
cp .env.example .env
# OR create .env file manuallyBackend Environment Variables (.env):
# Server Configuration
NODE_ENV=development
PORT=5000
# Database Configuration
MONGODB_URI=mongodb://localhost:27017/personal_finance
# JWT Configuration
JWT_SECRET=punisherishere
JWT_EXPIRES_IN=7d
# Google Gemini AI Configuration
GEMINI_API_KEY=your_gemini_api_key_here
# File Upload Configuration
UPLOAD_PATH=uploads
MAX_FILE_SIZE=5242880
ALLOWED_IMAGE_TYPES=image/jpeg,image/jpg,image/png,image/gif,image/webp
ALLOWED_DOCUMENT_TYPES=application/pdf
# CORS Configuration
FRONTEND_URL=http://localhost:3000
# Rate Limiting
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100
# OCR Configuration
OCR_TIMEOUT_MS=60000
OCR_MAX_FILE_SIZE_MB=10
# Timezone Configuration
TZ=Asia/Kolkata
# Security Configuration
BCRYPT_SALT_ROUNDS=12
# Logging Configuration
LOG_LEVEL=info
# API Configuration
API_VERSION=v1
API_PREFIX=/api
# Session Configuration
SESSION_SECRET=your-session-secret-key-change-this-too# Navigate to frontend directory (from project root)
cd frontend
# Install dependencies
npm install
# Create environment file
cp .env.example .env
# OR create .env file manuallyFrontend Environment Variables (.env):
VITE_BACKEND_URL=http://localhost:5000/api- Visit Google AI Studio
- Create a new API key
- Replace
your_gemini_api_key_herein backend.envfile
Option A: Local MongoDB
# Start MongoDB service
mongod
# Optional: Seed default categories
cd backend
npm run seedOption B: MongoDB Atlas (Cloud)
- Create account at MongoDB Atlas
- Create a cluster
- Get connection string
- Update
MONGODB_URIin.env
Terminal 1 - Backend:
cd backend
npm run devTerminal 2 - Frontend:
cd frontend
npm run dev- Frontend: http://localhost:3000
- Backend API: http://localhost:5000/api
- API Health Check: http://localhost:5000/api/health
cd frontend
npm run buildcd backend
npm start- Update
NODE_ENV=productionin backend.env - Update
VITE_BACKEND_URLto your production API URL - Use production MongoDB database
- Ensure proper security configurations
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/api/auth/register |
Register new user | β |
POST |
/api/auth/login |
Login user | β |
GET |
/api/auth/profile |
Get user profile | β |
PUT |
/api/auth/profile |
Update user profile | β |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/transactions |
List transactions (with pagination) | β |
POST |
/api/transactions |
Create new transaction | β |
GET |
/api/transactions/:id |
Get single transaction | β |
PUT |
/api/transactions/:id |
Update transaction | β |
DELETE |
/api/transactions/:id |
Delete transaction | β |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/transactions/p2p |
List P2P transactions | β |
POST |
/api/transactions/p2p |
Create P2P transaction | β |
GET |
/api/transactions/p2p/summary |
Get P2P summary | β |
PATCH |
/api/transactions/p2p/:id/status |
Update P2P status | β |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/api/files/receipt |
Upload and process receipt | β |
POST |
/api/files/pdf |
Upload and process PDF statement | β |
POST |
/api/files/image |
Upload and process image statement | β |
GET |
/api/files/receipt/:id |
Get receipt processing status | β |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/analytics/summary |
Financial summary | β |
GET |
/api/analytics/by-category |
Expenses by category | β |
GET |
/api/analytics/by-date |
Transactions by date | β |
GET |
/api/analytics/top-categories |
Top spending categories | β |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/transactions/categories |
Get all categories | β |
POST |
/api/categories |
Create custom category | β |
PUT |
/api/categories/:id |
Update custom category | β |
DELETE |
/api/categories/:id |
Delete custom category | β |
- Navigate to the Transactions page
- Click "Add Transaction" button
- Fill in transaction details:
- Description/Merchant name
- Amount
- Date
- Category (auto-suggested)
- Type (Income/Expense)
- Save the transaction
- Go to Upload page
- Select "Receipt Upload" tab
- Upload receipt image (JPG, PNG, WebP)
- Wait for AI processing
- Review extracted data:
- Merchant name
- Amount
- Date
- Items (if available)
- Accept or Edit the transaction
- Confirm to add to your records
- Navigate to Upload page
- Select "Statement" tab
- Choose format (PDF or Image)
- Upload your bank statement
- Review extracted transactions
- Bulk confirm or review individually
- Import selected transactions
- Visit P2P Dashboard
- Click "Add P2P Transaction"
- Fill details:
- Person name
- Amount
- Transaction type (Lent/Borrowed/Gift/Payment)
- Due date (optional)
- Contact info (optional)
- Notes
- Track status (Pending/Completed/Overdue)
- Update status as needed
- Navigate to Analytics page
- Select date ranges using filters
- View different insights:
- General: Overall summary and trends
- P2P: Person-to-person analytics
- Export data as needed
- Get AI-powered insights
cd backend
npm testcd frontend
npm test- User registration and login
- Transaction CRUD operations
- Receipt upload and processing
- PDF statement import
- P2P transaction management
- Analytics data visualization
- Responsive design on mobile
- File upload validation
- Error handling
- JWT Tokens with secure expiration
- Password Hashing using bcrypt (12 salt rounds)
- Route Protection with middleware
- User Data Isolation per authenticated user
- Input Validation with express-validator
- File Upload Validation (type, size, format)
- Rate Limiting (100 requests per 15 minutes)
- CORS Configuration for specific origins
- Security Headers with Helmet
- Graceful Error Responses with proper status codes
- Input Sanitization to prevent injection attacks
- File Size Limits to prevent DoS attacks
- Timeout Handling for long-running operations
Vercel:
# Install Vercel CLI
npm i -g vercel
# Deploy
cd frontend
vercel --prodNetlify:
- Connect GitHub repository
- Set build command:
npm run build - Set publish directory:
dist - Set environment variable:
VITE_BACKEND_URL
Railway:
# Install Railway CLI
npm i -g @railway/cli
# Deploy
cd backend
railway login
railway init
railway upEnvironment Variables for Production:
- Set all backend
.envvariables - Use production MongoDB URI
- Update
FRONTEND_URLto production domain
- Create MongoDB Atlas account
- Create new cluster
- Configure network access (0.0.0.0/0 for now)
- Create database user
- Get connection string
- Update
MONGODB_URIin production environment
- Code Splitting with React Router
- Lazy Loading for heavy components
- Image Optimization with proper formats
- Bundle Analysis with Vite analyzer
- Caching for API responses
- Database Indexing on frequently queried fields
- Pagination for large datasets (20 items per page)
- Connection Pooling with Mongoose
- Response Compression with express compression
- Query Optimization with select and populate
- Error Tracking with try-catch blocks
- Performance Monitoring with response times
- Usage Analytics with request logging
- Health Checks for API endpoints
We welcome contributions to Spendiq! Here's how you can help:
-
Fork the repository on GitHub
# Visit: https://github.com/4xush/Spendiq.git # Click "Fork" button
-
Clone your fork
git clone https://github.com/YOUR_USERNAME/Spendiq.git cd Spendiq -
Create a feature branch
git checkout -b feature/awesome-new-feature
-
Make your changes
-
Test your changes thoroughly
-
Commit with descriptive messages
git commit -m "Add awesome new feature: detailed description" -
Push to your fork
git push origin feature/awesome-new-feature
-
Create a Pull Request
- Code Style: Follow existing code style and formatting
- Testing: Add tests for new features
- Documentation: Update README and code comments
- Commits: Use clear, descriptive commit messages
- Issues: Reference issue numbers in PRs
When reporting bugs, please include:
- Operating system and version
- Node.js and npm versions
- Browser and version (for frontend issues)
- Steps to reproduce
- Expected vs actual behavior
- Screenshots or error logs
We love new ideas! Please provide:
- Clear description of the feature
- Use case and benefits
- Any implementation suggestions
- Mockups or examples (if applicable)
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2025 Spendiq Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
# Error: MongooseError: The `uri` parameter to `openUri()` must be a stringSolution:
- Ensure MongoDB is running:
mongod - Check connection string in
.env - For Atlas: Verify network access and credentials
# Error: API key not validSolution:
- Verify API key in
.envfile - Check Google AI Studio for key status
- Ensure API quota isn't exceeded
# Error: File too large or unsupported formatSolution:
- Check file size (max 5MB)
- Verify file format (JPG, PNG, PDF only)
- Ensure
uploadsdirectory exists and has write permissions
# Error: Cannot resolve moduleSolution:
- Clear node_modules:
rm -rf node_modules package-lock.json - Reinstall:
npm install - Check Node.js version (v16+)
# Error: Access-Control-Allow-OriginSolution:
- Verify
FRONTEND_URLin backend.env - Check if both servers are running
- Ensure correct API URLs in frontend
Enable detailed logging:
Backend:
LOG_LEVEL=debug
NODE_ENV=developmentFrontend:
# Open browser dev tools (F12)
# Check Console and Network tabs- Check existing GitHub Issues
- Search through documentation
- Create new issue with detailed information
- Join our community discussions
- Google Gemini AI - For powerful AI processing capabilities
- MongoDB - For flexible document storage
- React Team - For the amazing frontend framework
- Tailwind CSS - For beautiful, utility-first styling
- Vite - For lightning-fast development experience
Built with inspiration from modern fintech applications and the need for intelligent personal finance management tools.
Star β this repository if you found it helpful!