A production-grade payment processing system built with Node.js and microservices. It provides reliable asynchronous payment execution with retries, rate limiting, circuit breakers, and idempotent processing.
- Asynchronous payment processing with BullMQ
- JWT authentication
- Redis-backed rate limiting
- Circuit breaker for fault tolerance
- Automatic retries with exponential backoff
- Dead Letter Queue (DLQ)
- Duplicate payment protection
- Structured logging with Winston
- Health check endpoints
Client
│
▼
API Gateway
│
▼
Payment Service
├── PostgreSQL
├── Redis + BullMQ
▼
Payment Worker
▼
External Payment Provider
- Node.js
- Express.js
- PostgreSQL
- Redis
- BullMQ
- JWT
- Opossum (Circuit Breaker)
- Winston
# Clone repository
git clone <repository-url>
cd distributed-payment-orchestrator-system
# Install dependencies
npm install
# Start PostgreSQL and Redis
docker-compose up -d
# Start services
npm run api-gateway
npm run payment-service
npm run start-workerVerify:
curl http://localhost:3000/health
curl http://localhost:4000/healthpayment-orchestrator/
├── api-gateway/
├── payment-service/
├── shared/
├── logs/
├── docker-compose.yml
└── package.json
Client
↓
API Gateway
↓
Payment Service
↓
PostgreSQL (PENDING)
↓
BullMQ Queue
↓
Worker
↓
Payment Provider
↓
SUCCESS / FAILED
Detailed documentation is available in separate files:
| File | Description |
|---|---|
QUICK_START.md |
Setup and local development |
ARCHITECTURE.md |
System design and patterns |
API.md |
API reference and examples |
DEPLOYMENT.md |
Deployment instructions |
SECURITY.md |
Security considerations |
- Microservices Architecture
- Circuit Breaker
- Queue-based Asynchronous Processing
- Idempotency
- Retry with Exponential Backoff
- Dead Letter Queue
- Rate Limiting
- Structured logging with Winston
- Health check endpoints
- Worker success/failure events
- Queue monitoring
- Error tracking
Create a .env file:
cp .env.example .envImportant variables:
JWT_SECRET_KEYPOSTGRES_DB_PASSWORDREDIS_URLPAYMENT_SERVICE_URL
- Prometheus metrics
- OpenTelemetry tracing
- Webhooks
- TypeScript migration
- Kubernetes deployment
ISC License.