Distributed banking backend built with Spring Boot and event-driven communication.
This project demonstrates a production-style microservices architecture for account management, money transfers, fraud detection, OTP verification, and notifications.
- Microservices architecture with clear bounded contexts
- Event-driven workflows using Kafka topics
- Synchronous service-to-service calls with OpenFeign
- Stateful services using PostgreSQL and Redis
- Infrastructure orchestration via Docker Compose
- Real-world transaction lifecycle with compensation and fraud handling
flowchart LR
Client[Client App] --> Gateway[API Gateway]
Gateway --> TS[Transaction Service]
Gateway --> AS[Account Service]
TS -->|Feign| AS
TS -->|publish transaction.initiated| K[(Kafka)]
K -->|consume transaction.initiated| FDS[Fraud Detection Service]
FDS -->|Feign| AS
FDS -->|publish verification.required| K
K -->|consume verification.required| TS
TS -->|store OTP| R[(Redis)]
TS -->|verify OTP + complete/refund| K
K -->|transaction.completed| AS
K -->|transaction.otp.generated| NS[Notification Service]
AS --> P[(PostgreSQL)]
TS --> P
| Service | Responsibility |
|---|---|
| API Gateway | Single entry point and routing |
| Account Service | Account creation, balance, block, debit, credit |
| Transaction Service | Transfer workflow, OTP verification, compensation |
| Fraud Detection Service | Rule-based fraud checks and verification requests |
| Notification Service | Consumes events and sends user alerts |
- Java 25
- Spring Boot 4
- Spring Data JPA
- Spring Cloud OpenFeign
- Spring for Apache Kafka
- Spring Data Redis
- PostgreSQL
- Redis
- Docker Compose
- Maven Wrapper
- Transaction Service receives transfer request.
- Sender account is debited through Account Service (Feign).
- Transaction Service publishes transaction.initiated.
- Fraud Detection Service consumes and evaluates risk.
- If suspicious, verification.required is published.
- Transaction Service generates OTP and stores it in Redis with TTL.
- User verifies OTP.
- Transaction is completed or compensated/refunded depending on result.
- POST /api/v1/accounts
- GET /api/v1/accounts/{accountNumber}
- GET /api/v1/accounts/{accountNumber}/balance
- PUT /api/v1/accounts/{accountNumber}/deduct
- PUT /api/v1/accounts/{accountNumber}/credit
- PUT /api/v1/accounts/{accountNumber}/block
- POST /api/v1/transactions/transfer
- GET /api/v1/transactions/{transactionId}
- GET /api/v1/transactions/account/{accountNumber}
- POST /api/v1/transactions/{transactionId}/verify
Run at repository root:
docker compose up -dThis starts:
- PostgreSQL on 5432
- Redis on 6379
- Zookeeper on 2181
- Kafka on 9092
In each module folder, run:
./mvnw spring-boot:runSuggested order:
- account-service
- transaction-service
- fraud-detection-service
- notification-service
- api-gateway
account-service/
api-gateway/
fraud-detection-service/
notification-service/
payment-service/
transaction-service/
docker-compose.yml
- Designed and implemented an event-driven microservices banking backend.
- Built transaction safety workflow with OTP verification and compensation.
- Integrated synchronous and asynchronous communication (OpenFeign + Kafka).
- Applied Redis for short-lived security data (OTP TTL).
- Containerized local infrastructure with Docker Compose for consistent setup.
Active development. Core transfer, fraud, and account flows are implemented and can be expanded with stronger observability, tests, and deployment automation.