# tanbinrkyser/currency-exchange architecture

> Architecture diagram of the GitHub repository tanbinrkyser/currency-exchange, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tanbinrkyser/currency-exchange
- Repository: https://github.com/tanbinrkyser/currency-exchange

## Overview

This repository demonstrates two Spring Boot services: clients request a conversion, which obtains an exchange rate over HTTP and calculates the total; the exchange service looks up seeded rates in an in-memory H2 database. Conversion supports both RestTemplate and OpenFeign, with timeouts, a shared circuit breaker, and unavailable-service responses. Compose and Kubernetes provide service discovery and deployment; Kubernetes adds replicas and health probes. Prometheus and Grafana expose a separate monitoring branch. Runtime calls are grounded in sampled source; deployment and monitoring details follow the README and listed manifests.

Main entry points: [`currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/controller/CurrencyExchangeController.java`](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/controller/CurrencyExchangeController.java) (Exchange API), [`currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/controller/CurrencyConversionController.java`](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/controller/CurrencyConversionController.java) (Conversion API), [`currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/service/CurrencyConversionService.java`](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/service/CurrencyConversionService.java) (Conversion calculation), [`currency-exchange-service/deployment.yaml`](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-exchange-service/deployment.yaml) (Exchange deployment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversion["Conversion service"]
  node_conversion_api["Conversion API"]
  node_conversion_logic["Conversion calculation"]
  node_resttemplate["RestTemplate client"]
  node_feign_proxy["OpenFeign proxy"]
  node_conversion_model["Conversion result"]
  node_error_handler["Unavailable handler"]
end

subgraph group_exchange["Exchange service"]
  node_exchange_api["Exchange API"]
  node_exchange_logic["Rate lookup"]
  node_exchange_repo["Exchange repository"]
  node_exchange_db[("In-memory H2")]
  node_exchange_model["Exchange rate"]
  node_sample_api["Bulkhead sample API"]
end

subgraph group_runtime["Deployment runtime"]
  node_compose["Compose services<br/>[compose.yaml]"]
  node_conversion_deploy["Conversion deployment<br/>[deployment.yaml]"]
  node_exchange_deploy["Exchange deployment<br/>[deployment.yaml]"]
  node_conversion_config["Exchange URI config<br/>[configmap.yaml]"]
end

subgraph group_observability["Monitoring"]
  node_prometheus["Prometheus<br/>[prometheus.yml]"]
  node_grafana["Grafana"]
end

node_client(("API client"))

node_client -->|"requests"| node_conversion_api
node_conversion_api -->|"dispatches"| node_conversion_logic
node_conversion_logic -->|"calls direct"| node_resttemplate
node_conversion_logic -->|"calls Feign"| node_feign_proxy
node_resttemplate -->|"HTTP request"| node_exchange_api
node_feign_proxy -->|"HTTP request"| node_exchange_api
node_exchange_api -->|"looks up"| node_exchange_logic
node_exchange_logic -->|"queries"| node_exchange_repo
node_exchange_repo -->|"reads rates"| node_exchange_db
node_exchange_logic -->|"returns rate"| node_exchange_api
node_exchange_api -->|"returns rate"| node_exchange_model
node_conversion_logic -->|"builds result"| node_conversion_model
node_conversion_api -->|"returns result"| node_conversion_model
node_conversion_api -->|"maps failures"| node_error_handler
node_compose -.->|"runs service"| node_conversion_deploy
node_compose -.->|"runs service"| node_exchange_deploy
node_conversion_config -.->|"sets exchange URI"| node_conversion_logic
node_conversion_deploy -.->|"discovers service"| node_exchange_deploy
node_exchange_deploy -.->|"replicates pods"| node_exchange_deploy
node_conversion_api -.->|"exposes metrics"| node_prometheus
node_exchange_api -.->|"exposes metrics"| node_prometheus
node_prometheus -.->|"provides metrics"| node_grafana

click node_conversion_api "https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/controller/CurrencyConversionController.java"
click node_conversion_logic "https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/service/CurrencyConversionService.java"
click node_resttemplate "https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/CurrencyConversionMicroserviceApplication.java"
click node_feign_proxy "https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/service/CurrencyExchangeProxy.java"
click node_conversion_model "https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/model/CurrencyConversion.java"
click node_error_handler "https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/exception/ExchangeServiceExceptionHandler.java"
click node_exchange_api "https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/controller/CurrencyExchangeController.java"
click node_exchange_logic "https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/service/CurrencyExchangeService.java"
click node_exchange_repo "https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/repository/CurrencyExchangeRepository.java"
click node_exchange_db "https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-exchange-service/src/main/resources/application.properties"
click node_exchange_model "https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/model/CurrencyExchange.java"
click node_sample_api "https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/controller/CircuitBreakerController.java"
click node_compose "https://github.com/tanbinrkyser/currency-exchange/blob/main/compose.yaml"
click node_conversion_deploy "https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/deployment.yaml"
click node_exchange_deploy "https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-exchange-service/deployment.yaml"
click node_conversion_config "https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/configmap.yaml"
click node_prometheus "https://github.com/tanbinrkyser/currency-exchange/blob/main/prometheus.yml"

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_conversion_api,node_conversion_logic,node_resttemplate,node_feign_proxy,node_conversion_model,node_error_handler,node_client toneBlue
class node_exchange_api,node_exchange_logic,node_exchange_repo,node_exchange_db,node_exchange_model,node_sample_api toneAmber
class node_compose,node_conversion_deploy,node_exchange_deploy,node_conversion_config toneMint
class node_prometheus,node_grafana toneRose
```

## Components

### Conversion service

- [Conversion API](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/controller/CurrencyConversionController.java): `currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/controller/CurrencyConversionController.java`
- [Conversion calculation](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/service/CurrencyConversionService.java): `currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/service/CurrencyConversionService.java`
- [RestTemplate client](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/CurrencyConversionMicroserviceApplication.java): `currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/CurrencyConversionMicroserviceApplication.java`
- [OpenFeign proxy](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/service/CurrencyExchangeProxy.java): `currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/service/CurrencyExchangeProxy.java`
- [Conversion result](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/model/CurrencyConversion.java): `currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/model/CurrencyConversion.java`
- [Unavailable handler](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/exception/ExchangeServiceExceptionHandler.java): `currency-conversion-microservice/src/main/java/com/tusker/currencyconversionmicroservice/exception/ExchangeServiceExceptionHandler.java`

### Exchange service

- [Exchange API](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/controller/CurrencyExchangeController.java): `currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/controller/CurrencyExchangeController.java`
- [Rate lookup](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/service/CurrencyExchangeService.java): `currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/service/CurrencyExchangeService.java`
- [Exchange repository](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/repository/CurrencyExchangeRepository.java): `currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/repository/CurrencyExchangeRepository.java`
- [In-memory H2](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-exchange-service/src/main/resources/application.properties): `currency-exchange-service/src/main/resources/application.properties`
- [Exchange rate](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/model/CurrencyExchange.java): `currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/model/CurrencyExchange.java`
- [Bulkhead sample API](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/controller/CircuitBreakerController.java): `currency-exchange-service/src/main/java/com/tusker/currencyexchangeservice/controller/CircuitBreakerController.java`

### Deployment runtime

- [Compose services](https://github.com/tanbinrkyser/currency-exchange/blob/main/compose.yaml): `compose.yaml`
- [Conversion deployment](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/deployment.yaml): `currency-conversion-microservice/deployment.yaml`
- [Exchange deployment](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-exchange-service/deployment.yaml): `currency-exchange-service/deployment.yaml`
- [Exchange URI config](https://github.com/tanbinrkyser/currency-exchange/blob/main/currency-conversion-microservice/configmap.yaml): `currency-conversion-microservice/configmap.yaml`

### Monitoring

- [Prometheus](https://github.com/tanbinrkyser/currency-exchange/blob/main/prometheus.yml): `prometheus.yml`
- **Grafana**

### Other components

- **API client**

## Connections

- API client → Conversion API: requests
- Conversion API → Conversion calculation: dispatches
- Conversion calculation → RestTemplate client: calls direct
- Conversion calculation → OpenFeign proxy: calls Feign
- RestTemplate client → Exchange API: HTTP request
- OpenFeign proxy → Exchange API: HTTP request
- Exchange API → Rate lookup: looks up
- Rate lookup → Exchange repository: queries
- Exchange repository → In-memory H2: reads rates
- Rate lookup → Exchange API: returns rate
- Exchange API → Exchange rate: returns rate
- Conversion calculation → Conversion result: builds result
- Conversion API → Conversion result: returns result
- Conversion API → Unavailable handler: maps failures
- Compose services → Conversion deployment: runs service
- Compose services → Exchange deployment: runs service
- Exchange URI config → Conversion calculation: sets exchange URI
- Conversion deployment → Exchange deployment: discovers service
- Exchange deployment → Exchange deployment: replicates pods
- Conversion API → Prometheus: exposes metrics
- Exchange API → Prometheus: exposes metrics
- Prometheus → Grafana: provides metrics
