PayPal Backend Clone
Production-ready payment backend with event-driven settlement and distributed transactions.
Overview
PayPal Backend Clone is a production-inspired distributed payment system built using Spring Boot microservices. The project separates authentication, user management, wallets, ledger, payments, transaction graph, and notifications into independent services that can evolve and scale independently. The system is designed to explore modern payment backend architecture with asynchronous communication, distributed services, multiple databases, and production-ready observability.
Problem Statement
Modern payment platforms must process financial transactions reliably while managing user accounts, wallet balances, payment history, notifications, and audit records. As these responsibilities grow, a monolithic architecture becomes difficult to maintain and scale. This project explores how a payment platform can be decomposed into independent microservices that communicate efficiently while remaining scalable, fault tolerant, and easier to extend.
Features
- JWT-based authentication
- User management
- Wallet management
- Payment processing
- Ledger management
- Transaction graph service
- Notification service
- API Gateway
- Apache Kafka event communication
- Observability with Prometheus, Grafana and Zipkin
Core Services
The system is composed of independently deployable services, each responsible for a single business capability.
API Gateway
Single entry point for all external client requests.
Auth Service
Authentication and JWT token management.
User Service
User profile and account management.
Wallet Service
Maintains wallet balances and transactions.
Ledger Service
Stores immutable financial ledger records.
Payment Service
Processes payments between users.
Transaction Graph Service
Stores relationship-oriented transaction data using Neo4j.
Notification Service
Processes notification events.
Technology Stack
Technologies, frameworks, infrastructure, and tooling used throughout the development of this project.
Backend
Java 17 • Spring Boot • Spring Cloud Gateway • Spring Security
Database
MySQL • Redis • Neo4j
Messaging
Apache Kafka
Infrastructure
Docker • Docker Compose
Developer Tools
Prometheus • Grafana • Zipkin • Git • Postman
Engineering Decisions
Architectural choices made to improve scalability, maintainability, reliability, and long-term evolution of the system.
Microservice Architecture
Business capabilities such as payments, wallets, ledger, authentication, and notifications are separated into independent services to improve maintainability and scalability.
Event-Driven Communication
Apache Kafka is used to exchange events asynchronously between services, reducing coupling and improving system flexibility.
Polyglot Persistence
The system combines MySQL, Redis, and Neo4j so that each storage technology is used where it best fits the application's data access patterns.
Observability
Prometheus, Grafana, and Zipkin are integrated to monitor system health, collect metrics, and trace requests across services.
API Gateway
All incoming requests pass through a centralized API Gateway, simplifying routing and hiding the internal service topology.
Challenges
The most significant engineering challenges encountered while building the system.
Designing clear service boundaries for payment workflows.
Maintaining consistency across distributed services.
Managing communication using asynchronous Kafka events.
Handling multiple databases within a single platform.
Improving observability across independently deployed services.
What I Learned
Key technical concepts and engineering practices gained during the implementation.
Designing payment systems using microservice architecture.
Using Kafka for asynchronous service communication.
Applying different databases to different business requirements.
Building observable distributed systems.
Structuring production-style backend services.
Future Improvements
Potential enhancements that could improve scalability, reliability, and maintainability.
Implement Saga orchestration for distributed transactions.
Deploy the platform on Kubernetes.
Introduce distributed rate limiting.
Expand integration and end-to-end testing.
Add payment reconciliation workflows.