This is a production-ready expense tracker application with:
- Frontend: React (Vite) + Tailwind CSS + React Router + Axios + Recharts
- Backend: Node.js + Express + MongoDB (Mongoose) + JWT authentication
Each user has their own account, avatar, categories, and expenses. New users start with no dummy data and can only access their own expenses.
backend/– REST API (Node, Express, MongoDB)frontend/– Single-page app (React, Vite, Tailwind)
cd backend
npm installCreate .env in backend/ based on .env.example:
cp .env.example .envSet:
MONGODB_URI– your MongoDB connection stringJWT_SECRET– a strong random secretPORT– API port (default5000)CLIENT_ORIGIN– frontend origin (defaulthttp://localhost:5173)
npm run devAPI will be available at http://localhost:5000/api.
Key endpoints:
POST /api/auth/register– register (name, email, password, avatar)POST /api/auth/login– loginGET /api/auth/me– current user profile (JWT required)PUT /api/auth/profile– update profile (name, avatar, categories)GET /api/expenses– list expenses (JWT required, filtered by user)POST /api/expenses– create expensePUT /api/expenses/:id– update expenseDELETE /api/expenses/:id– delete expense
All expense routes are user-scoped via JWT; users cannot see each other’s data.
cd frontend
npm installCreate .env in frontend/ based on .env.example:
cp .env.example .envEnsure VITE_API_URL points to your backend API, e.g.:
VITE_API_URL=http://localhost:5000/apinpm run devVite will start at http://localhost:5173.
-
Authentication
- Register with name, email, password, avatar selection
- Login with email/password
- JWT stored in
localStorage - Protected routes via
AuthContext+ProtectedRoute
-
User Profile
- Name, email, avatar
- Per-user category list (default + custom)
-
Expenses
- Add, edit, delete expenses (amount, category, date, description)
- All expenses linked to user (
userId) and isolated per user - Filters by date range, category, and search text
- Empty state for new users
-
Dashboard & Analytics
- Total expenses and current month summary
- Transaction count
- Bar chart for monthly totals
- Pie chart for category distribution
In two terminals:
# Terminal 1
cd backend
npm run dev
# Terminal 2
cd frontend
npm run devThen open http://localhost:5173 in your browser.
You should now be able to:
- Register a new user (choose an avatar).
- Log in and land on the dashboard.
- Add/edit/delete expenses and see charts update.