https://github.com/ajharry69/dt-bank
This project implements a simplified banking platform using a microservices' architecture. It includes services for managing customers, accounts, and cards, along with common cloud infrastructure patterns like service discovery, configuration management, API gateway, and security.
https://github.com/ajharry69/dt-bank
banking-applications cards docker feign interservice-communication microservices rabbitmq testcontainers
Last synced: 5 months ago
JSON representation
This project implements a simplified banking platform using a microservices' architecture. It includes services for managing customers, accounts, and cards, along with common cloud infrastructure patterns like service discovery, configuration management, API gateway, and security.
- Host: GitHub
- URL: https://github.com/ajharry69/dt-bank
- Owner: ajharry69
- License: apache-2.0
- Created: 2025-05-15T19:31:24.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-11-01T15:33:11.000Z (8 months ago)
- Last Synced: 2025-11-01T17:22:38.764Z (8 months ago)
- Topics: banking-applications, cards, docker, feign, interservice-communication, microservices, rabbitmq, testcontainers
- Language: Java
- Homepage:
- Size: 453 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# DT Bank - Microservices Platform
[](https://github.com/ajharry69/dt-bank/actions/workflows/ci-cd.yml)
[](https://github.com/ajharry69/dt-bank/actions/workflows/github-code-scanning/codeql)
[](https://github.com/ajharry69/dt-bank/actions/workflows/dependabot/dependabot-updates)
This project implements a simplified banking platform using a microservices' architecture.
It includes services for managing customers, accounts, and cards, along with common cloud
infrastructure patterns like service discovery, configuration management, API gateway, and
security.
---
## Architecture Overview
The platform is composed of several Spring Boot microservices that communicate with each other, often via REST APIs
orchestrated through an API Gateway.
* **Customer Service:** Manages customer biographical data.
* **Account Service:** Manages customer bank accounts.
* **Card Service:** Manages customer cards (virtual and physical) linked to accounts.
* **Spring Cloud Gateway:** Acts as the single entry point for all client requests, handling routing, security, and
other cross-cutting concerns.
* **Eureka Discovery Service:** Allows services to register and discover each other dynamically.
* **Spring Cloud Config Server:** Provides centralized configuration management for all microservices.
* **PostgreSQL:** The relational database used by each microservice for persistence.
* **RabbitMQ:** The messaging queue for inter-service communication.
* **Keycloak:** An open-source identity and access management tool that secures API endpoints using JWT Bearer token
authentication.
---
## Microservices
Each microservice is a Spring Boot application built with Maven.
### Customer Service (`customer-service`)
* **Description:** Handles CRUD operations for customer's biographical data.
* **API Documentation:** Exposes Swagger UI at http://localhost:8080/swagger-ui.html?urls.primaryName=Customers.
### Account Service (`account-service`)
* **Description:** Manages customer bank account data.
* **API Documentation:** Exposes Swagger UI at http://localhost:8080/swagger-ui.html?urls.primaryName=Accounts.
### Card Service (`card-service`)
* **Description:** Manages customer card data.
* **API Documentation:** Exposes Swagger UI at http://localhost:8080/swagger-ui.html?urls.primaryName=Cards.
---
## Infrastructure Services
These services support the microservices architecture.
### Spring Cloud Gateway (`gateway`)
* **Description:** Single entry point for all API requests. Handles routing to appropriate microservices and load
balancing.
* **Port:** 8080
* **Configuration:** Fetches its configuration (including routes) from the Spring Cloud Config Server.
### Eureka Service Discovery (`eureka-server`)
* **Description:** Allows microservices to register themselves and discover other registered services dynamically.
The Gateway uses Eureka to find downstream services.
* **Port:** 8761
* **Dashboard:** Accessible at http://localhost:8761
### Spring Cloud Config Server (`config-server`)
* **Description:** Provides centralized externalized configuration for all microservices and the gateway. Configurations
are typically backed by a Git repository.
* **Port:** 8888
---
## Core Technologies
* **Java 24**
* **Spring Boot 3.4.5**
* **Spring Cloud 2024.0.1**
* **Spring Cloud Gateway (Reactive)**
* **Spring Cloud Netflix Eureka**
* **Spring Cloud Config**
* **OpenFeign:** For inter-service communication.
* **PostgreSQL:** As the RDBMS for each service.
* **RabbitMQ:** As the messaging queue for inter-service communication.
* **Keycloak:** An open-source identity and access management tool that secures API endpoints using JWT Bearer token
authentication.
* **Maven:** For project build and dependency management.
* **Testcontainers:** For integration tests and running application services, providing ephemeral Docker containers for
dependencies like PostgreSQL, RabbitMQ, etc.
* **JUnit 5:** For unit and integration testing.
* **Lombok:** To reduce boilerplate code.
* **MapStruct:** For DTO-entity mapping.
* **Springdoc OpenAPI (Swagger):** For API documentation.
---
## Prerequisites
* **Java 24 JDK** (or compatible)
* **Gradle 8.14+**
* **Docker**
* **Git** (for cloning the project)
* An IDE (e.g., IntelliJ IDEA, Eclipse, VS Code)
---
## Setup and Running the Platform
This section outlines how to run the entire platform locally.
### Using docker compose
The following command starts all the services that are used internally by microservices.
```bash
make compose
```
> **N/B:** To access the services as [documented](#api-documentation-swagger), replace `localhost` with
`host.docker.internal`.
### Using test containers and Spring boot compose integration
Locate and run the main applications referenced in the following list.
> Ensure Docker is running on your system and start the applications in the order they are listed in.
>
> **Video reference:** https://drive.google.com/file/d/1PieCRJWxzD3R71tVUKQEufj_lphJWrlk/view
| Service | Start Command | Main Application |
|---------------------|-------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|
| `config-server` | `./gradlew :config-server:bootRun` | [ConfigServerApplication.java](config-server/src/main/java/com/github/ajharry69/config/server/ConfigServerApplication.java) |
| `discovery-service` | `./gradlew :discovery-service:bootRun` | [DiscoveryServiceApplication.java](discovery-service/src/main/java/com/github/ajharry69/discovery/DiscoveryServiceApplication.java) |
| `customer-service` | `./gradlew :customer-service:bootTestRun` | [TestCustomerServiceApplication.java](customer-service/src/test/java/com/github/ajharry69/customer/TestCustomerServiceApplication.java) |
| `account-service` | `./gradlew :account-service:bootTestRun` | [TestAccountServiceApplication.java](account-service/src/test/java/com/github/ajharry69/account/TestAccountServiceApplication.java) |
| `card-service` | `./gradlew :card-service:bootTestRun` | [TestCardServiceApplication.java](card-service/src/test/java/com/github/ajharry69/card/TestCardServiceApplication.java) |
| `gateway` | `./gradlew :gateway:bootRun` | [GatewayApplication.java](gateway/src/main/java/com/github/ajharry69/gateway/GatewayApplication.java) |
Wait for each service to start and register with Eureka (check Eureka dashboard) before starting dependent services or
the gateway.
---
## API Documentation (Swagger)
API documentation is generated using Springdoc OpenAPI.
* OpenAPI UI: http://localhost:8080/swagger-ui.html
---
## Testing
The project includes both unit and integration tests.
`./gradlew --info --rerun-tasks --exclude-task :gateway:test test`
> **Video reference:** https://drive.google.com/file/d/1VxS-deQrexQ3mpeLVd9cLlRDgV9M42TP/view
### Unit Tests
* Located in `src/test/java` of each microservice.
* Use JUnit 5 and Mockito.
### Integration Tests (Testcontainers)
* Located in `src/test/java` of each microservice (e.g., `customer-service`, `card-service`, `account-service`).
* Leverage **Testcontainers** to spin up required external dependencies, such as a PostgreSQL database, for each test
run.
This ensures tests are isolated and run against a clean environment.
* The Testcontainers setup for each service starts all its required Docker containers.
---
## Further Development
* Enhance error handling and logging.
* Add more comprehensive integration tests covering inter-service communication.
* Implement distributed tracing (e.g., using Micrometer Tracing with Zipkin).
* Set up CI/CD pipelines.