A high-performance, distributed payments platform built with Next.js, Node.js, and PostgreSQL. This project features a decoupled architecture, secure P2P transfers, and an automated bank-webhook processing system.
- Monorepo Architecture: Managed via Turborepo and npm workspaces to optimize build pipelines and enable seamless code sharing across frontend and backend services.
- Decoupled Microservices: Independent deployment of the User-App (Next.js) and Bank-Webhook (Express) for optimized scaling on Render.
- Atomic Transactions: Leverages Prisma Transactions to ensure ACID compliance during wallet balance updates and P2P transfers.
- Security Migration: Successfully transitioned from plaintext storage to Bcrypt hashing, implementing a hybrid "auto-upgrade" logic to secure legacy user data.
- CI/CD & DevOps: Automated deployment pipelines using GitHub Actions and Docker to ensure environment parity and streamlined service updates.
- Frontend: Next.js 14 (App Router), Tailwind CSS, NextAuth.js
- Backend: Node.js, Express.js, TypeScript
- Database: PostgreSQL, Prisma ORM, Neon DB
- Infrastructure: Docker, Render, GitHub Actions, Turborepo
The application is split into two primary services that share a common database schema and shared TypeScript types:
- User-App: Handles the UI, user authentication, dashboard visualization, and P2P transfer requests.
- Bank-Webhook: A "headless" service that listens for external bank notifications to fulfill "Add Money" requests asynchronously.
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#3b82f6', 'edgeLabelBackground':'#ffffff', 'tertiaryColor': '#f3f4f6'}}}%%
graph TD
subgraph External ["External Actors"]
User([👤 User Browser])
BankApi[🏦 External Bank API]
end
subgraph RenderDeployment ["Render Deployment (Monorepo)"]
style RenderDeployment fill:#f8fafc,stroke:#cbd5e1,stroke-width:2px,stroke-dasharray: 5 5
subgraph Services ["Microservices"]
UserApp["🖥️ User App (Next.js)
(Auth, Dashboard, P2P)"]
WebhookApp["⚙️ Bank Webhook (Express)
(Async Balance Updates)"]
end
subgraph SharedLibs ["Shared Packages"]
PrismaClient["📦 @repo/db
(Prisma Client & Schema)"]
end
end
subgraph DataLayer ["Data Layer"]
Postgres[(🗄️ PostgreSQL DB
Neon DB)]
end
%% Connections
User ==>|HTTPS / NextAuth| UserApp
BankApi ==>|POST Webhook| WebhookApp
UserApp -.->|Imports| PrismaClient
WebhookApp -.->|Imports| PrismaClient
PrismaClient ==>|"TCP Connection
(Transactions/Queries)"| Postgres
%% Styling classes
classDef external fill:#fff1f2,stroke:#e11d48,stroke-width:2px;
classDef service fill:#dbeafe,stroke:#2563eb,stroke-width:2px;
classDef shared fill:#f3f4f6,stroke:#64748b,stroke-width:1px,stroke-dasharray: 5 5;
classDef database fill:#fef3c7,stroke:#d97706,stroke-width:2px;
class User,BankApi external;
class UserApp,WebhookApp service;
class PrismaClient shared;
class Postgres database;
- Node.js (v18+)
- Docker (Optional)
- PostgreSQL instance (or Neon DB account)
-
Clone the repository:
git clone https://github.com/rah7202/paytm.git cd paytm -
Install dependencies:
npm install
-
Setup Environment Variables: Create a
.envfile in the root and add yourDATABASE_URLandNEXTAUTH_SECRET. -
Database Migration & Seeding:
npx prisma migrate dev npx prisma db seed
-
Run the application:
npm run dev
To run the entire ecosystem (Frontend, Backend, and DB) locally using Docker:
docker-compose up --build