# soliman-sdev/customer-management-service architecture

> Architecture diagram of the GitHub repository soliman-sdev/customer-management-service, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/soliman-sdev/customer-management-service
- Repository: https://github.com/soliman-sdev/customer-management-service

## Overview

Customer Management Service exposes REST operations to onboard and retrieve customers, request account creation, and fetch accounts. The main flow is HTTP controller → customer service → relational persistence or account integration; account-creation requests are published through RabbitMQ, while account reads use the Account Service client. The README documents H2 storage, secured endpoints, and the event-driven integration. Source excerpts establish the controller and service calls; unsampled configuration and repository internals limit detail on persistence and security wiring.

Main entry points: [`src/main/java/com/service/CustomerManagement/Service/CustomerService.java`](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Service/CustomerService.java) (Customer Service), [`src/main/java/com/service/CustomerManagement/Controller/CustomerController.java`](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Controller/CustomerController.java) (Customer), [`src/main/java/com/service/CustomerManagement/RabbitMQ/AccountEventPublisher.java`](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/RabbitMQ/AccountEventPublisher.java) (Account Event Publisher), [`src/main/java/com/service/CustomerManagement/Model/entity/Customer.java`](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Model/entity/Customer.java) (Customer Entity)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["REST API"]
  node_customer["Customer"]
  node_service["Customer Service"]
  node_apiresponse["API Response<br/>[ApiResponse.java]"]
  node_errors["Error Handling"]
end

subgraph group_domain["Customer Domain"]
  node_businesserror["Business Exception"]
  node_onboard["Onboarding Request"]
  node_customerentity["Customer Entity<br/>[Customer.java]"]
  node_address["Address Entity<br/>[Address.java]"]
end

subgraph group_integration["Account Integration"]
  node_accountrequest["Account Request"]
  node_publisher["Account Event Publisher"]
  node_broker["RabbitMQ"]
  node_event["Account Create Event"]
  node_accountclient["Account Client<br/>[AccountClient.java]"]
  node_accountservice["Account Service"]
end

subgraph group_persistence["Persistence"]
  node_customerrepos["Customer Repository"]
  node_addressrepos["Address Repository"]
  node_database[("H2 Database<br/>[application.yml]")]
end

node_customer -->|"delegates to"| node_service
node_customer -->|"wraps responses"| node_apiresponse
node_service -->|"reads and saves"| node_customerrepos
node_service -->|"publishes request"| node_publisher
node_service -->|"fetches accounts"| node_accountclient
node_service -->|"maps customer"| node_customerentity
node_service -->|"maps address"| node_address
node_service -->|"raises errors"| node_businesserror
node_errors -->|"handles"| node_businesserror
node_errors -->|"formats errors"| node_apiresponse
node_customer -->|"accepts"| node_onboard
node_customer -->|"accepts account data"| node_accountrequest
node_publisher -->|"publishes event"| node_event
node_publisher -->|"sends message"| node_broker
node_accountclient -->|"calls API"| node_accountservice
node_customerentity -->|"references address"| node_address
node_customerrepos -.->|"persists entities"| node_database
node_addressrepos -.->|"persists entities"| node_database
node_onboard -->|"provides fields"| node_customerentity

click node_customer "https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Controller/CustomerController.java"
click node_service "https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Service/CustomerService.java"
click node_apiresponse "https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Response/ApiResponse.java"
click node_errors "https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Exception/ServiceExceptionHandler.java"
click node_businesserror "https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Exception/BusinessException.java"
click node_onboard "https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Request/OnboardCustomerRequest.java"
click node_customerentity "https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Model/entity/Customer.java"
click node_address "https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Model/entity/Address.java"
click node_customerrepos "https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Repository/CustomerRepository.java"
click node_addressrepos "https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Repository/AddressRepository.java"
click node_database "https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/resources/application.yml"
click node_accountrequest "https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Request/CreateAccountRequest.java"
click node_publisher "https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/RabbitMQ/AccountEventPublisher.java"
click node_event "https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Request/AccountCreateEvent.java"
click node_accountclient "https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Client/AccountClient.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_customer,node_service,node_apiresponse,node_errors toneBlue
class node_businesserror,node_onboard,node_customerentity,node_address toneAmber
class node_accountrequest,node_publisher,node_broker,node_event,node_accountclient,node_accountservice toneMint
class node_customerrepos,node_addressrepos,node_database toneRose
```

## Components

### REST API

- [Customer](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Controller/CustomerController.java): `src/main/java/com/service/CustomerManagement/Controller/CustomerController.java`
- [Customer Service](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Service/CustomerService.java): `src/main/java/com/service/CustomerManagement/Service/CustomerService.java`
- [API Response](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Response/ApiResponse.java): `src/main/java/com/service/CustomerManagement/Response/ApiResponse.java`
- [Error Handling](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Exception/ServiceExceptionHandler.java): `src/main/java/com/service/CustomerManagement/Exception/ServiceExceptionHandler.java`

### Customer Domain

- [Business Exception](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Exception/BusinessException.java): `src/main/java/com/service/CustomerManagement/Exception/BusinessException.java`
- [Onboarding Request](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Request/OnboardCustomerRequest.java): `src/main/java/com/service/CustomerManagement/Request/OnboardCustomerRequest.java`
- [Customer Entity](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Model/entity/Customer.java): `src/main/java/com/service/CustomerManagement/Model/entity/Customer.java`
- [Address Entity](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Model/entity/Address.java): `src/main/java/com/service/CustomerManagement/Model/entity/Address.java`

### Account Integration

- [Account Request](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Request/CreateAccountRequest.java): `src/main/java/com/service/CustomerManagement/Request/CreateAccountRequest.java`
- [Account Event Publisher](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/RabbitMQ/AccountEventPublisher.java): `src/main/java/com/service/CustomerManagement/RabbitMQ/AccountEventPublisher.java`
- **RabbitMQ**
- [Account Create Event](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Request/AccountCreateEvent.java): `src/main/java/com/service/CustomerManagement/Request/AccountCreateEvent.java`
- [Account Client](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Client/AccountClient.java): `src/main/java/com/service/CustomerManagement/Client/AccountClient.java`
- **Account Service**

### Persistence

- [Customer Repository](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Repository/CustomerRepository.java): `src/main/java/com/service/CustomerManagement/Repository/CustomerRepository.java`
- [Address Repository](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/java/com/service/CustomerManagement/Repository/AddressRepository.java): `src/main/java/com/service/CustomerManagement/Repository/AddressRepository.java`
- [H2 Database](https://github.com/soliman-sdev/customer-management-service/blob/main/src/main/resources/application.yml): `src/main/resources/application.yml`

## Connections

- Customer → Customer Service: delegates to (evidence: `src/main/java/com/service/CustomerManagement/Controller/CustomerController.java`)
- Customer → API Response: wraps responses (evidence: `src/main/java/com/service/CustomerManagement/Controller/CustomerController.java`)
- Customer Service → Customer Repository: reads and saves (evidence: `src/main/java/com/service/CustomerManagement/Service/CustomerService.java`)
- Customer Service → Account Event Publisher: publishes request (evidence: `src/main/java/com/service/CustomerManagement/Service/CustomerService.java`)
- Customer Service → Account Client: fetches accounts (evidence: `src/main/java/com/service/CustomerManagement/Service/CustomerService.java`)
- Customer Service → Customer Entity: maps customer (evidence: `src/main/java/com/service/CustomerManagement/Service/CustomerService.java`)
- Customer Service → Address Entity: maps address (evidence: `src/main/java/com/service/CustomerManagement/Service/CustomerService.java`)
- Customer Service → Business Exception: raises errors (evidence: `src/main/java/com/service/CustomerManagement/Service/CustomerService.java`)
- Error Handling → Business Exception: handles (evidence: `src/main/java/com/service/CustomerManagement/Exception/ServiceExceptionHandler.java`)
- Error Handling → API Response: formats errors (evidence: `src/main/java/com/service/CustomerManagement/Exception/ServiceExceptionHandler.java`)
- Customer → Onboarding Request: accepts (evidence: `src/main/java/com/service/CustomerManagement/Controller/CustomerController.java`)
- Customer → Account Request: accepts account data (evidence: `src/main/java/com/service/CustomerManagement/Controller/CustomerController.java`)
- Account Event Publisher → Account Create Event: publishes event (evidence: `src/main/java/com/service/CustomerManagement/RabbitMQ/AccountEventPublisher.java`)
- Account Event Publisher → RabbitMQ: sends message (evidence: `README.md`)
- Account Client → Account Service: calls API (evidence: `src/main/java/com/service/CustomerManagement/Client/AccountClient.java`)
- Customer Entity → Address Entity: references address (evidence: `src/main/java/com/service/CustomerManagement/Model/entity/Customer.java`)
- Customer Repository → H2 Database: persists entities
- Address Repository → H2 Database: persists entities
- Onboarding Request → Customer Entity: provides fields (evidence: `src/main/java/com/service/CustomerManagement/Request/OnboardCustomerRequest.java`)
