This repository contains a simple web app to generate UPI QR codes and manage split payments (frontend + backend).
Quick summary:
- Frontend: React + Vite (TypeScript)
- Backend: Express.js + MongoDB
Prerequisites:
- Node.js (>=18) and npm
- MongoDB instance (local or cloud)
Quick start (development)
- Start the server
cd server
npm install
npm run dev- Start the client
cd client
npm install
npm run devOpen the app in your browser at the Vite dev URL (usually http://localhost:5173). The frontend expects the API at http://localhost:4000/api by default.
Environment variables (server)
Create a .env file in the server folder with the following values:
PORT=4000
MONGO_URI=mongodb://localhost:27017/upi-qr-split
JWT_SECRET=your_jwt_secret_here
BASE_URL=http://localhost:5173
PORT defaults to 4000 if not set. BASE_URL is used for some generated links and defaults to http://localhost:3000 in code.
Available scripts
- Server (in
/server):npm run dev— start server withnodemon(development)npm run start— run production server (NODE_ENV=production)
- Client (in
/client):npm run dev— start Vite dev servernpm run build— build the app (runstsc -bthenvite build)npm run preview— preview the production build
**API overview (base: /api)
POST /api/auth/register— register a user (email, password, name)POST /api/auth/login— login (returns JWT)POST /api/qr— generate UPI QR code (body:{ upiId, name, amount, note })GET/POST/PUT/DELETE /api/templates— CRUD for payment templatesGET/POST/PUT/DELETE /api/splits— manage split groups and participants
For implementation details see the route files in server/src/routes.
Project structure (top-level)
client/— frontend (Vite + React + TypeScript)server/— backend (Express)server/src— server sourceroutes/— API route handlersmodels/— Mongoose modelshelper/andutils/— helpers and JWT utilitypuppeteerPdf.js— helper script for PDF generation using Puppeteer
Notes & tips
- Frontend's API base URL is in
client/src/api/apiClient.ts(defaults tohttp://localhost:4000/api). Update it or use environment-based configuration for deployments. - Ensure
MONGO_URIis reachable before starting the server. The server will exit with code 1 on connection failure. - Puppeteer is used in the project for PDF generation — installing and running may require additional system dependencies in some Linux environments.
License MIT