Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏦 Banking Microservices System

Java Spring Boot RabbitMQ MySQL Docker Maven

A distributed banking system built with a microservices architecture using Spring Boot 3, Java 21, RabbitMQ for async communication, and Docker Compose for orchestration.


📐 Architecture Overview

                        ┌─────────────────────────────────┐
                        │         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)     │            │
                        │   └─────────────────┘            │
                        └─────────────────────────────────┘

🧩 Services

👤 Customers Service — localhost:8081

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

💳 Accounts Service — localhost:8082

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

🔗 Async Communication — RabbitMQ

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

🚀 Getting Started

Prerequisites

  • Java 21
  • Maven 3.9+
  • Docker & Docker Compose

Build

mvn clean package -DskipTests

Run with Docker

docker-compose up --build

Service URLs

Service URL
Customers API http://localhost:8081
Accounts API http://localhost:8082
RabbitMQ Dashboard http://localhost:15672

RabbitMQ credentials: guest / guest


📬 Postman Collection

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.


🧪 Running Tests

mvn test

Tests 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

🗄️ Database Schema

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.


🛠️ Tech Stack

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

👨‍💻 Author

Antony Chávez — Backend Developer
LinkedIn GitHub

About

Distributed banking system using microservices, Spring Boot 3, RabbitMQ and Docker

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages