SAMPARK is an open-source project that simulates the architectural patterns and event flows of India's digital payment ecosystem. It provides a realistic reference model without replicating actual internal operations of real payment networks, serving as a practical blueprint for engineers exploring financial technology architectures and distributed system design.
SAMPARK implements a multi-layered architecture mirroring real-world payment ecosystems:
- National Transaction Hub (NTH): Central payment switch similar to NPCI's role
- Payment Service Providers (PSPs): Banks providing backend services
- Third Party Payment Applications (TPAP): Consumer-facing payment interfaces
- UPI: Unified Payments Interface
- IMPS: Immediate Payment Service
[BazzarPe] → [PSP: Paisa Vasool Bank] → [NTH] → [PSP: Babu Rao Ganpatrao Bank] → [ChillarPay]
[Remitter Bank] → [NTH] → [Beneficiary Bank]
- Initiation: User initiates payment through TPAP
- PSP Processing: Sponsoring bank validates and processes
- Central Routing: NTH routes transaction to destination PSP
- Settlement: Destination PSP credits beneficiary account
- Confirmation: End-to-end transaction confirmation
| Bank Name | IFSC Code | IIN | Port | Sponsored TPAP | Specialty Focus |
|---|---|---|---|---|---|
| Paisa Vasool Bank | PVB | 321987 | 3004 | BazzarPe | Merchant payments & marketplace solutions |
| Babu Rao Ganpatrao Bank | BRG | 654321 | 3001 | ChillarPay | P2P transfers & micro-payments |
| Chinta Mat Karo Bank | CMK | 456123 | 3003 | Available | Worry-free banking solutions |
| Chai Pani Bank | CPB | 789456 | 3002 | Available | Micro-transaction specialists |
| TPAP Name | Port | Sponsor PSP | Description |
|---|---|---|---|
| BazzarPe | 6001 | Paisa Vasool Bank | UPI merchant payment solution |
| ChillarPay | 6002 | Chinta Mat Karo Bank | UPI P2P transfer application |
| Service | Port | Description |
|---|---|---|
| NTH Switch | 3005 | National Transaction Hub |
| Redis Stack | 6379/8001 | Shared caching and session management |
| Kafka | 9092 | Message broker for event streaming |
| Zookeeper | 2181 | Kafka cluster coordination |
- Message Broker: Apache Kafka + Zookeeper
- Containerization: Docker & Docker Compose
- Caching: Redis Stack
- Database: PostgreSQL with Prisma ORM
- Runtime: Bun (Node.js)
- Language: TypeScript
- Framework: Express.js
- Testing: Jest
- Monitoring: Grafana + Prometheus (Optional)
- Docker and Docker Compose
- Git
- Clone the repository:
git clone https://github.com/Gajjar-Mohit/Sampark.git
cd sampark- Start all services:
docker-compose up -d- Verify services are running:
docker-compose ps- NTH Switch: http://localhost:3005
- Paisa Vasool Bank: http://localhost:3004
- Babu Rao Ganpatrao Bank: http://localhost:3001
- Chinta Mat Karo Bank: http://localhost:3003
- Chai Pani Bank: http://localhost:3002
- BazzarPe: http://localhost:6001
- ChillarPay: http://localhost:6002
- Redis Insight: http://localhost:8001
SAMPARK/
├── banks/ # Payment Service Providers
│ ├── babu-rao-ganpatrao-bank/
│ ├── chai-pani-bank/
│ ├── chinta-mat-karo-bank/
│ └── paisa-vasool-bank/
├── nth/ # National Transaction Hub
├── tpap/ # Third Party Applications
│ ├── BazaarPe/
│ └── ChillarPay/
├── k8s/ # Kubernetes configurations
├── tests/ # Test suites
├── assets/ # Static assets
├── docker-compose.yml # Container orchestration
└── README.md # This file
Each service uses environment variables for configuration. Key variables include:
NODE_ENV: Environment (development/production)DATABASE_URL: PostgreSQL connection stringKAFKA_BASEURL: Kafka broker URLREDIS_URL: Redis connection stringPORT: Service port
Services use Prisma for database operations:
# Run migrations
docker-compose exec <service> bun prisma migrate deploy
# Seed data
docker-compose exec <service> bun run seedTo reduce log noise, most services have logging disabled. Enable logging by removing logging: driver: "none" from docker-compose.yml.
Detailed API documentation is available in each module's README:
Run tests for specific services:
# Run all tests
docker-compose exec <service> bun test
# Run with coverage
docker-compose exec <service> bun test --coverage- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
This project is open-source. See LICENSE file for details.
This project is for educational and research purposes. It simulates payment system architectures and should not be used in production environments without proper security audits and compliance reviews.