Munafa is a full-stack trading and expense tracker built with React, Vite, Express, Prisma, and PostgreSQL. It lets users sign up, log in, track trades and expenses, and review a dashboard with their net financial position.
- Secure authentication with JWT.
- Trade tracking with buy price, sell price, quantity, and P&L calculation.
- Expense tracking with debit and credit entries.
- Dashboard summary with charts and key metrics.
- Custom date picker and a polished light/dark theme.
- Frontend: React, Vite, React Router, Axios, Recharts
- Backend: Node.js, Express, Prisma
- Database: PostgreSQL
backend/- Express API, Prisma schema, and database migrations.frontend/- Vite React app for the user interface.
The app uses a warm, paper-like palette with muted accent colors:
| Color | Hex | Usage |
|---|---|---|
| Background | #FAF8F3 |
Main page background |
| Surface | #F4EFE7 |
Cards, panels, and UI surfaces |
| Surface 2 | #EBE2D5 |
Secondary surface tone |
| Border / Ink | #3A3A3A |
Borders, outlines, and strong text |
| Text | #2F343D |
Main body text |
| Accent | #8A9FB7 |
Highlights and soft emphasis |
| Success | #6D8B7E |
Positive values and success states |
| Danger | #BB6F63 |
Negative values and warnings |
- Node.js 18 or newer
- PostgreSQL database
git clone <repo-url>
cd munafacd backend
npm installCreate a .env file in backend/ with at least:
DATABASE_URL="postgresql://USER:PASSWORD@HOST:PORT/DATABASE?schema=public"
JWT_SECRET="your-secret-key"
PORT=5000Then prepare Prisma and start the server:
npx prisma generate
npx prisma migrate deploy
npm run devIf you are setting up a fresh local database and want Prisma to create the tables for development, you can also use:
npx prisma migrate devOpen a new terminal:
cd frontend
npm installIf your backend is not running on http://localhost:5000, create a .env file in frontend/ and set:
VITE_API_URL="http://localhost:5000/api"Start the frontend:
npm run dev- Start the backend and frontend.
- Open the frontend in your browser and create a new account or log in.
- Go to the Trades page to add buy/sell details and track your P&L.
- Go to the Expenses page to record debit and credit entries.
- Open the Dashboard to see total P&L, total expenses, and net balance.
npm run dev- start the Express server with nodemon.npm run start- run Prisma migrations and start the production server.npm run build- generate Prisma client.
npm run dev- start the Vite dev server.npm run build- build the frontend for production.npm run lint- run ESLint.
- Backend base URL:
http://localhost:5000 - API base URL:
http://localhost:5000/api - Main endpoints:
POST /api/auth/registerPOST /api/auth/loginGET /api/tradesPOST /api/tradesDELETE /api/trades/:idGET /api/expensesPOST /api/expensesDELETE /api/expenses/:id
- The frontend stores the auth token in local storage.
- The app is designed for local-first personal finance tracking.
- If you change the backend URL, update
VITE_API_URLin the frontend environment file.