A full‑stack expense tracking application with a React (Vite) frontend and a Node.js/Express/MongoDB backend. Features authentication, groups, contacts, expenses, and bills.
backend/— Express API, MongoDB models, auth, email, and resource routesExpenseTracker/— React app (Vite), Redux Toolkit store and feature pages
- Frontend: React, React Router, Redux Toolkit, Vite
- Backend: Node.js, Express, Mongoose, JWT auth
- Email: Nodemailer (SMTP)
- DB: MongoDB Atlas or local MongoDB
- Node.js 18+ and npm
- MongoDB connection string (Atlas or local)
- Install dependencies
# backend
cd backend
npm install
# frontend
cd ../ExpenseTracker
npm install- Configure environment (backend)
Create
backend/.envwith:
PORT=7000
MONGODB_URI=mongodb+srv://<user>:<password>@<cluster>/<db>?retryWrites=true&w=majority
JWT_SECRET=your_jwt_secret_here
# SMTP for email (recommended to use app passwords / provider secrets)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=you@example.com
SMTP_PASS=your_smtp_password- Run the apps (two terminals)
# Terminal A (backend)
cd backend
npm run start # uses nodemon; if missing, run: npm i -D nodemon
# or: node server.js
# Terminal B (frontend)
cd ExpenseTracker
npm run devFrontend runs on http://localhost:5173. Backend defaults to http://localhost:7000 and allows CORS from 5173.
PORT— API port (default 7000)MONGODB_URI— MongoDB connection stringJWT_SECRET— secret for signing JWTsSMTP_HOST,SMTP_PORT,SMTP_SECURE,SMTP_USER,SMTP_PASS— SMTP credentials used by Nodemailer
Note: The sample transport currently targets Gmail SMTP. Prefer provider secrets and app‑passwords; never commit real credentials.
- Backend (
backend/package.json):start:nodemon server.jsdev:npm --watch server.js(Node watch)
- Frontend (
ExpenseTracker/package.json):dev: Vite dev serverbuild: Vite production buildpreview: Preview built applint: Run ESLint
Base URL: http://localhost:<PORT>
POST /auth/...— authentication endpointsGET/POST/PUT/DELETE /Home/...— grouped resource routes:- Expenses:
/Home/...viaexpenseRouter - Groups:
/Home/...viaGroupRouter - Contacts:
/Home/...viacontactRouter - Bills:
/Home/...viabillRouter
- Expenses:
Review the routers in backend/Routes/ and controllers in backend/controller/ for exact request/response shapes.
- Entry:
ExpenseTracker/src/main.jsx - App shell:
ExpenseTracker/src/App.jsx - State:
ExpenseTracker/src/store/ - Views:
ExpenseTracker/src/pages/andExpenseTracker/src/component/
Update the API base URLs inside components or services if you deploy the backend.
Frontend build:
cd ExpenseTracker
npm run build
# Output in: ExpenseTracker/distServe the dist directory with any static host. Ensure the frontend points to your deployed API URL.
Backend deploy: supply the same .env variables on your host (Render, Railway, Fly.io, etc.). Ensure CORS origin matches your frontend origin.
- Backend not starting: verify
MONGODB_URIand network access; check thatnodemonis installed or usenode server.js. - 401/403 responses: ensure
JWT_SECRETmatches across sign/verify and that cookies/headers are sent correctly from the frontend. - Email not sending: confirm SMTP credentials and less‑secure/app‑password settings. Log the transporter options and check provider logs.
- CORS errors: update
origininbackend/server.jsto your actual frontend URL.
Example navigation and icons are in ExpenseTracker/public/. A header image (Header.png) is present at the repo root.
- There is an additional
CONTACT_SECTION_README.mdwith context specific to the contacts feature. - Replace any hard‑coded credentials in source with environment variables before production.
This project is provided as‑is for educational use. Add your preferred license here.