#Expense Tracker App
A full-stack expense tracking application built with MongoDB, Express.js, React, and Node.js. Track your income and expenses, visualize data with charts, generate monthly reports, and export data to CSV.
- π User Authentication: Secure login/signup with JWT
- π° Transaction Management: Add, edit, delete income/expenses with categories
- π Data Visualization: Interactive charts (Pie charts for categories, Line charts for trends) using Chart.js
- π Advanced Filtering: Filter by date range, category, type (income/expense), and amount
- πΎ Local Storage Fallback: Store transactions locally for offline access and quick loading
- π Monthly Reports: Generate detailed monthly summaries with category breakdowns
- π₯ CSV Export: Download transactions or reports as CSV files
- π± Responsive Design: Mobile-friendly UI built with Tailwind CSS
- π€ AI-Powered Features:
- Smart Categorization: Automatically categorize transactions based on description
- Spending Insights: AI-generated insights and recommendations
- Anomaly Detection: Detect unusual spending patterns automatically
- Budget Recommendations: AI-suggested budgets based on your spending patterns
- Natural Language Entry: Add transactions using plain English (e.g., "spent $50 on groceries yesterday")
- React.js 18
- Redux Toolkit (State Management)
- React Router (Routing)
- Chart.js & react-chartjs-2 (Data Visualization)
- Axios (API Calls)
- Tailwind CSS (Styling)
- json2csv (CSV Export)
- Node.js
- Express.js
- MongoDB with Mongoose
- JWT (Authentication)
- bcryptjs (Password Hashing)
- express-validator (Input Validation)
- Node.js (v14 or higher)
- MongoDB (local installation or MongoDB Atlas)
- npm or yarn
cd "Expense Tracker App"cd backend
npm installCreate a .env file in the backend directory:
PORT=5000
MONGODB_URI=mongodb://localhost:27017/expense-tracker
JWT_SECRET=your-super-secret-jwt-key-change-this-in-productionStart the backend server:
npm run devThe backend server will run on http://localhost:5000
Open a new terminal and navigate to the frontend directory:
cd frontend
npm installStart the frontend development server:
npm startThe frontend will run on http://localhost:3000
- Register/Login: Create a new account or login with existing credentials
- Add Transactions: Click "Add Transaction" to record income or expenses
- View Transactions: Browse all your transactions in the list view
- Filter Data: Use the filter panel to find specific transactions
- View Charts: Switch to the Charts tab to see visualizations
- Generate Reports: Go to Reports tab to view monthly summaries
- Export Data: Export transactions or reports as CSV files
Expense Tracker App/
βββ backend/
β βββ models/
β β βββ User.js
β β βββ Transaction.js
β βββ routes/
β β βββ auth.js
β β βββ transactions.js
β β βββ reports.js
β βββ middleware/
β β βββ auth.js
β βββ server.js
β βββ package.json
βββ frontend/
β βββ public/
β β βββ index.html
β βββ src/
β β βββ components/
β β β βββ auth/
β β β β βββ Login.js
β β β β βββ Register.js
β β β βββ charts/
β β β β βββ Charts.js
β β β βββ dashboard/
β β β β βββ SummaryCards.js
β β β βββ filters/
β β β β βββ FilterPanel.js
β β β βββ layout/
β β β β βββ Navbar.js
β β β βββ reports/
β β β β βββ MonthlyReport.js
β β β βββ transactions/
β β β β βββ TransactionForm.js
β β β β βββ TransactionList.js
β β β βββ Dashboard.js
β β β βββ PrivateRoute.js
β β βββ store/
β β β βββ slices/
β β β β βββ authSlice.js
β β β β βββ transactionSlice.js
β β β βββ store.js
β β βββ utils/
β β β βββ api.js
β β β βββ exportCSV.js
β β β βββ localStorage.js
β β βββ App.js
β β βββ index.js
β β βββ index.css
β βββ package.json
β βββ tailwind.config.js
β βββ postcss.config.js
βββ README.md
POST /api/auth/register- Register a new userPOST /api/auth/login- Login userGET /api/auth/me- Get current user (Protected)
GET /api/transactions- Get all transactions (Protected, supports filters)GET /api/transactions/:id- Get a single transaction (Protected)POST /api/transactions- Create a new transaction (Protected)PUT /api/transactions/:id- Update a transaction (Protected)DELETE /api/transactions/:id- Delete a transaction (Protected)GET /api/transactions/stats/summary- Get summary statistics (Protected)
GET /api/reports/monthly- Get monthly report (Protected)GET /api/reports/category-breakdown- Get category breakdown (Protected)GET /api/reports/trends- Get trends over time (Protected)
The app uses browser localStorage as a fallback mechanism:
- Transactions are automatically saved to localStorage when created/updated/deleted
- If the API is unavailable, the app can load data from localStorage
- Data syncs with the backend when online
PORT- Server port (default: 5000)MONGODB_URI- MongoDB connection stringJWT_SECRET- Secret key for JWT tokens
cd backend
npm run dev # Uses nodemon for auto-reloadcd frontend
npm start # Runs on http://localhost:3000cd frontend
npm run buildThis creates an optimized production build in the build folder.
The application includes several AI-powered features to enhance your expense tracking experience:
-
Smart Categorization: Automatically suggests categories based on transaction descriptions using pattern matching and keyword analysis.
-
Spending Insights: Provides intelligent insights such as:
- Top spending categories
- Budget health indicators
- Daily spending averages
- Spending diversity metrics
-
Anomaly Detection: Identifies unusual spending patterns:
- Unusually large transactions
- Spending spikes compared to historical data
- Patterns that deviate from your normal behavior
-
Budget Recommendations: Suggests appropriate budgets for each category based on your historical spending patterns.
-
Natural Language Entry: Add transactions using conversational language. Examples:
- "spent $50 on groceries yesterday"
- "paid $25 for lunch today"
- "earned $1000 from freelance work"
Note: The current implementation uses rule-based AI and pattern matching. For production use, consider integrating with OpenAI API or similar services for more advanced natural language processing.
- Recurring transactions
- Advanced budget management with AI suggestions
- Multi-currency support
- Dark mode
- Email notifications
- Data backup/restore
- Receipt OCR (Optical Character Recognition)
- Integration with OpenAI API for advanced NLP
- Predictive spending forecasts
- Smart alerts and reminders
This project is open source and available under the MIT License.
Contributions, issues, and feature requests are welcome!
For support, email sasanthasanju1111@gmail.com or create an issue in the repository.