A distributed banking system built with a microservices architecture using Spring Boot 3, Java 21, RabbitMQ for async communication, and Docker Compose for orchestration.
┌─────────────────────────────────┐
│ Docker Compose │
│ │
┌──────────────┤ ┌────────────┐ │
│ REST API │ │ RabbitMQ │ │
▼ │ │ (Broker) │ │
┌─────────────────┐ │ └─────┬──────┘ │
│ Customers │─────┼─────────┤ customer.created │
│ Service :8081 │ │ ▼ │
│ │ │ ┌─────────────────┐ │
│ - CRUD clients │ │ │ Accounts │ │
│ - Publish │ │ │ Service :8082 │ │
│ events │ │ │ │ │
└────────┬────────┘ │ │ - Accounts │ │
│ │ │ - Transactions │ │
│ │ │ - Reports │ │
▼ │ └────────┬────────┘ │
┌─────────────────┐ │ │ │
│ MySQL DB │ │ ┌────────▼────────┐ │
│ (customers) │ │ │ MySQL DB │ │
└─────────────────┘ │ │ (accounts) │ │
│ └─────────────────┘ │
└─────────────────────────────────┘
Handles client lifecycle and publishes events to RabbitMQ when a new customer is created.
Package structure:
com.bank.customers
├── config
├── controller
├── events
├── model
├── repository
├── service
└── CustomersApplication.java
Manages bank accounts, processes transactions (deposits & withdrawals), validates balances, and generates financial reports by date range.
Package structure:
com.bank.accounts
├── config
├── controller
├── exception
├── listener
├── model
├── repository
├── service
└── AccountsApplication.java
| Service | Action | Exchange | Routing Key |
|---|---|---|---|
| Customers | Publishes event on customer creation | customers.exchange |
customer.created |
| Accounts | Listens and syncs customer data | customers.exchange |
customer.created |
- Java 21
- Maven 3.9+
- Docker & Docker Compose
mvn clean package -DskipTestsdocker-compose up --build| Service | URL |
|---|---|
| Customers API | http://localhost:8081 |
| Accounts API | http://localhost:8082 |
| RabbitMQ Dashboard | http://localhost:15672 |
RabbitMQ credentials:
guest/guest
A ready-to-use Postman collection is included in the root of the project:
postman_collection.json
Import it directly into Postman to test all available endpoints.
mvn testTests are written with JUnit 5 + Mockito and validate business logic without loading the full Spring context.
Coverage includes:
- Customer creation with RabbitMQ event publishing
- Transaction registration with balance validation
- Insufficient balance exception handling
The SQL schema is included in the root of the project:
banking_schema.sql
Each microservice has its own dedicated MySQL database following the Database per Service pattern.
| Layer | Technology |
|---|---|
| Language | Java 21 (LTS) |
| Framework | Spring Boot 3.5.6 |
| Persistence | Spring Data JPA |
| Messaging | Spring AMQP · RabbitMQ |
| Database | MySQL / MariaDB |
| Containerization | Docker · Docker Compose |
| Testing | JUnit 5 · Mockito |
| Build Tool | Maven 3.9.9 |