A modern digital wallet application built with Next.js, TypeScript, and Prisma, featuring real-time transactions, authentication, and a clean UI.
- 💳 Add Money via Bank Transfer, uses dummy bank api to get the token
- Support for multiple banks (SBI, HDFC)
- Real-time transaction status
- 💸 P2P Money Transfer
- Transfer to phone number or email
- Instant transfer between users
- 📊 Transaction History
- View all transactions (deposits and transfers)
- Real-time status updates
- 🔒 Multi-provider Authentication
- Phone Number + Password
- Google OAuth
- GitHub OAuth
- 💰 Balance Management
- View current balance
- Track locked and unlocked funds
- Real-time balance updates
-
User App (Port 3000)
- Main application interface
- Handles user authentication
- Manages transactions and balance
- Communicates with Bank App for payment processing
-
Bank App (Port 3003)
- Simulates bank interface
- Generates transaction tokens
- Processes payment requests
- Sends webhooks to notify transaction status
-
Webhook Handler (Port 3002)
-
Payment Initiation
sequenceDiagram User App->>Bank App: Create transaction with amount Bank App-->>User App: Return transaction token User App->>Bank: Redirect to bank page
-
Payment Processing
sequenceDiagram Bank->>Webhook Handler: Send transaction status Webhook Handler->>Database: Update transaction Webhook Handler->>Database: Update user balance
-
Retry Mechanism
- Bank App maintains a queue for failed webhook deliveries
- Automatic retries with exponential backoff
- Maximum 5 retry attempts
- 60-second intervals between retries
# User App (.env)
NEXT_PUBLIC_BANK_URL=https://bank-app-url
BANK_URL=https://bank-app-url
# Bank App (.env)
BANK_WEBHOOK_URL=https://webhook-handler-url
# Webhook Handler (.env)
DATABASE_URL=postgresql://...
- Token-based transaction verification
- Secure webhook endpoints
- Transaction status validation
- User authentication checks
- Balance locking mechanism
- 🏗️ Monorepo with Turborepo
- ⚛️ Next.js 14 with App Router
- 🔄 Server Actions for API endpoints
- 🗃️ PostgreSQL with Prisma ORM
- 🔑 NextAuth.js for authentication
- 🎨 TailwindCSS for styling
- 📦 Shared UI component library
- Node.js 18+
- PostgreSQL
- npm (recommended)
git clone <repository-url>
cd payme
npm install
Create .env
in apps/user-app
:
DATABASE_URL="postgresql://username:password@localhost:5432/payme"
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key"
# OAuth Credentials
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
GITHUB_CLIENT_ID="your-github-client-id"
GITHUB_CLIENT_SECRET="your-github-client-secret"
cd packages/db
npm prisma generate
npm prisma db push
# From root directory
npm dev
The app will be available at:
- User App:
http://localhost:3000
- Merchant App:
http://localhost:3001
- Bank Webhook Handler:
http://localhost:3002
├── apps/
│ ├── user-app/ # Main user application
│ ├── merchant-app/ # Merchant dashboard
│ └── bank_webhook_handler/ # Payment webhook processor
├── packages/
│ ├── ui/ # Shared UI components
│ ├── db/ # Database and Prisma schema
│ └── eslint-config/ # Shared ESLint configuration
AppbarClient
: Navigation and authentication UIP2P
: Peer-to-peer transfer interfaceTransactions
: Transaction history displayShowBalance
: Balance display componentAddmoney
: Bank deposit interface
Required variables in .env
:
DATABASE_URL
: PostgreSQL connection stringNEXTAUTH_URL
: Authentication callback URLNEXTAUTH_SECRET
: Session encryption key- OAuth credentials for Google and GitHub
# Start development servers
npm dev
# Build all apps
npm build
# Run type checking
npm check-types
# Run linting
npm lint