Server runs at http://localhost:5000 (or PORT).
Headers: Content-Type: application/json
{ "name": "John Doe", "email": "john@example.com", "password": "password123" }
{ "name": "Asha Nair", "email": "asha@example.com", "password": "StrongP@ssw0rd" }
{ "name": "Test User", "email": "test@example.com", "password": "test1234" }
Headers: Content-Type: application/json Body examples:
{ "email": "john@example.com", "password": "password123" }
{ "email": "asha@example.com", "password": "StrongP@ssw0rd" }
{ "email": "john@example.com", "password": "wrongpassword" }
Response (successful):
{ "token": "<JWT_TOKEN>", "user": { "_id": "690ecbdbc02d1151c7ac6b74", "name": "John Doe", "email": "john@example.com" } }
Headers: Content-Type: application/json, Authorization: Bearer Body examples:
{ "title": "Lunch", "amount": 15.50, "category": "Food", "description": "Lunch at restaurant", "date": "2025-11-01T12:00:00.000Z" }
{ "title": "Bus Ticket", "amount": 2.50, "category": "Transportation", "description": "Bus fare home", "date": "2025-11-06T18:00:00.000Z" }
{ "title": "Monthly Rent", "amount": 450.00, "category": "Bills", "description": "Apartment rent for November", "date": "2025-11-01T00:00:00.000Z" }
{ "title": "Movie Night", "amount": 12.00, "category": "Entertainment", "description": "Cinema ticket", "date": "2025-11-03T21:00:00.000Z" }
Headers: Authorization: Bearer Examples:
Fetch all (no query)
Optional pagination/filter (if implemented):
Response: array of expense objects.
Headers: Authorization: Bearer Example:
Response: expense object or 404.
Headers: Content-Type: application/json, Authorization: Bearer Body examples (partial updates allowed):
{ "amount": 20.00 }
{ "title": "Updated Lunch", "description": "Veg thali instead" }
{ "category": "Food" }
Response: updated expense object.
Headers: Authorization: Bearer Example:
{ "userId": "690ecbdbc02d1151c7ac6b74", "total": 780.25, "monthlySummary": [ { "month": "2025-10", "total": 450.50, "categories": { "Food": 250.00, "Transportation": 100.00, "Entertainment": 100.50 }, "suggestion": "You're spending over 55.4% on Food. Try reducing it by 15% to save more." }, { "month": "2025-11", "total": 329.75, "categories": { "Food": 200.00, "Bills": 79.75, "Transportation": 50.00 }, "suggestion": "Good month — spending looks balanced." } ], "topCategory": "Food", "overallSuggestion": "Consider tracking small food expenses — they add up quickly!" }
This endpoint always uses the logged-in user (from JWT). It supports optional query params:
category — e.g. Food
minAmount — number
maxAmount — number
search — text (matches title or description, case-insensitive)
Food Transportation Entertainment Bills Shopping Healthcare Education Other
src/ ├── config/ │ └── db.ts ├── controllers/ │ ├── authController.ts │ ├── expenseController.ts │ └── expenseSummaryController.ts ├── middleware/ │ ├── authMiddleware.ts │ └── errorHandler.ts ├── models/ │ ├── userModel.ts │ └── expenseModel.ts ├── routes/ │ ├── authRoutes.ts │ └── expenseRoutes.ts ├── utils/ │ └── generateToken.ts ├── app.ts └── server.ts