Production-style payment processing system inspired by Razorpay and Juspay.
Built with Node.js, Express, React, Vite, and MongoDB.
This project simulates a modern payment gateway where users can:
- sign up and log in
- create payment orders
- pay using card, UPI, net banking, or wallet simulation
- retry failed payments
- view transaction history
- access admin analytics and logs
It goes beyond a normal CRUD app by covering real payment-system concepts like:
- idempotency
- retry handling
- transaction logging
- webhook simulation
- rate limiting
- secure card masking and hashing
- redesigned frontend with a more attractive 3D-style dashboard
- richer hover effects and layered visual cards
- improved checkout experience with trust/timeline sections
- better order insights, search, and retry visibility
- admin dashboard polished for demos and interviews
- interview guide generated in
docs/and kept out of Git using.gitignore
| Layer | Tech |
|---|---|
| Frontend | React 18, Vite, React Router, Axios |
| Backend | Node.js, Express |
| Database | MongoDB, Mongoose |
| Auth | JWT |
| Security | Helmet, CORS, rate limiting, validators |
| Docs | Swagger / OpenAPI |
| Logging | Winston, custom transaction logs |
payment-processing-system/
|-- backend/
| |-- config/
| |-- controllers/
| |-- middlewares/
| |-- models/
| |-- routes/
| |-- services/
| |-- utils/
| |-- .env.example
| |-- seed.js
| `-- server.js
|-- frontend/
| |-- src/
| | |-- components/
| | |-- context/
| | |-- pages/
| | `-- services/
| |-- index.html
| `-- vite.config.js
|-- docs/
|-- package.json
`-- README.md
- JWT-based signup and login
- protected dashboard and routes
- order creation with amount, currency, description, and metadata
- payment checkout with multiple simulated methods
- retry for failed payments within max attempt limit
- transaction history page
- idempotency key required on payment operations
- mock payment engine with configurable delay and success rate
- card details masked and hashed
- UPI VPA support
- webhook simulation after payment result
- separate payment and order lifecycle tracking
- overall payment stats
- revenue view
- payment method breakdown
- recent payments table
- transaction/event logs
- User authenticates and receives JWT.
- User creates an order.
- Frontend sends payment request with
Idempotency-Key. - Backend validates payload and checks idempotency.
- Payment service processes payment through mock engine.
- Payment and order statuses are updated.
- Transaction logs are stored.
- Webhook dispatch is simulated asynchronously.
Ordermeans payment intent.Paymentmeans an actual transaction attempt.
One order can have multiple payment attempts because retries are supported.
- JWT auth
- role-based admin protection
- Helmet security headers
- route-level rate limiting
- request validation with
express-validator - SHA-256 card hashing
- masked card storage
- CVV is never stored
- idempotency protection for duplicate payment requests
Swagger UI:
http://localhost:5000/api/docs
POST /api/auth/signupPOST /api/auth/loginGET /api/auth/mePOST /api/auth/logout
POST /api/ordersGET /api/ordersGET /api/orders/:orderIdGET /api/orders/admin/all
POST /api/paymentsPOST /api/payments/retryGET /api/payments/myGET /api/payments/:paymentIdGET /api/payments/admin/allGET /api/payments/admin/dashboard
GET /api/transactions/myGET /api/transactions
- Node.js 18+
- MongoDB local or Atlas
- npm
From project root:
npm run install:allOr manually:
cd backend
npm install
cd ../frontend
npm installCopy:
cd backend
cp .env.example .envAdd values in backend/.env:
NODE_ENV=development
PORT=5000
MONGO_URI=mongodb://localhost:27017/payment_gateway
JWT_SECRET=your_super_secret_jwt_key_change_in_production
JWT_EXPIRES_IN=7d
ENCRYPTION_KEY=your_32_char_encryption_key_here!!
WEBHOOK_SECRET=your_webhook_secret_key
WEBHOOK_URL=http://localhost:5000/api/webhooks/payment
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX=100
PAYMENT_SUCCESS_RATE=0.85
PAYMENT_MIN_DELAY_MS=500
PAYMENT_MAX_DELAY_MS=3000npm run seedDemo credentials:
- Admin:
admin@paygateway.io/Admin@1234 - User:
user@paygateway.io/User@1234
npm run dev:backendBackend runs on:
http://localhost:5000
npm run dev:frontendFrontend runs on:
http://localhost:3000
Vite proxy is already configured to forward /api requests to backend http://localhost:5000.
Frontend production build:
npm run build:frontendLogin using demo credentials or register a new user.
- go to Orders
- create a new order
- enter amount, currency, description
- choose card, UPI, net banking, or wallet
- submit payment
- if failed, use retry when attempts remain
- open Transactions page for user events
- open Admin page for global analytics
This project is strong for interviews because it demonstrates:
- full stack architecture
- modular backend design
- practical payment concepts
- authentication and authorization
- observability and audit logging
- security-aware data handling
- polished product UI, not just backend APIs
- Generated interview docs in
docs/are ignored from Git. - Logs and build output are also ignored through
.gitignore. - There is a stray file
backend/1.pyin the repo which does not appear to be part of the main application flow.
MIT