# dmytrozelinskyy/currency-converter architecture

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

- Interactive diagram: https://gitdiagram.com/dmytrozelinskyy/currency-converter
- Repository: https://github.com/dmytrozelinskyy/currency-converter

## Overview

This is a Spring Boot currency-conversion application with static browser pages, API controllers, services, an external exchange-rate provider, and persisted conversion history. The primary workflow validates a conversion request, fetches a rate, records the result, and returns it; separate API paths list currencies and retrieve history. Source excerpts establish the conversion and history calls. Some controller relationships are supported by the source index; wiring for the static pages, database, and application configuration was not excerpted, so those links are left unasserted or marked unverified.

Main entry points: [`src/main/java/io/github/dmytrozelinskyy/currencyconverter/client/ExchangeRateClient.java`](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/client/ExchangeRateClient.java) (Exchange-rate client), [`src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/ConversionHistoryService.java`](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/ConversionHistoryService.java) (History service), [`src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/CurrencyConversionService.java`](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/CurrencyConversionService.java) (Conversion service), [`src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/CurrencyListService.java`](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/CurrencyListService.java) (Currency-list service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_webpages["Browser pages<br/>[index.html]"]
  node_convert_ui["Conversion UI<br/>[app.js]"]
  node_currencies_ui["Currency UI<br/>[currencies.js]"]
  node_convert_api["Conversion endpoint"]
  node_currencies_api["Currency-list endpoint"]
  node_history_api["History endpoint"]
end

subgraph group_conversion["Conversion and rates"]
  node_conversion_service["Conversion service"]
  node_currency_list["Currency-list service"]
  node_rate_client["Exchange-rate client"]
  node_provider{{"Frankfurter provider"}}
  node_rate_response["Rate response"]
  node_currency_dto["Currency DTO<br/>[CurrencyDto.java]"]
end

subgraph group_history["Conversion history"]
  node_history_service["History service"]
  node_history_dto["History DTO"]
  node_history_model["History record"]
  node_history_repo["History repository"]
  node_history_db[("History database")]
end

subgraph group_support["API support"]
  node_unsupported_error["Unsupported currency error"]
  node_unavailable_error["Provider unavailable error"]
  node_error_handler["Error handler"]
end

node_user(("User"))

node_user -.->|"opens"| node_webpages
node_webpages -.->|"uses script"| node_convert_ui
node_user -->|"requests conversion"| node_convert_api
node_user -->|"requests currencies"| node_currencies_api
node_user -->|"requests history"| node_history_api
node_convert_api -->|"calls"| node_conversion_service
node_currencies_api -->|"calls"| node_currency_list
node_history_api -->|"calls"| node_history_service
node_conversion_service -->|"requests rate"| node_rate_client
node_conversion_service -->|"records conversion"| node_history_service
node_currency_list -->|"loads currencies"| node_rate_client
node_rate_client -->|"fetches rates"| node_provider
node_rate_client -->|"parses response"| node_rate_response
node_rate_client -->|"raises"| node_unsupported_error
node_rate_client -->|"raises"| node_unavailable_error
node_currency_list -->|"creates"| node_currency_dto
node_history_service -->|"reads and saves"| node_history_repo
node_history_service -->|"creates"| node_history_model
node_history_service -->|"maps results"| node_history_dto
node_history_dto -->|"maps fields"| node_history_model
node_history_repo -.->|"persists records"| node_history_db
node_error_handler -->|"handles"| node_unsupported_error
node_error_handler -->|"handles"| node_unavailable_error

click node_webpages "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/resources/static/index.html"
click node_convert_ui "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/resources/static/js/app.js"
click node_currencies_ui "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/resources/static/js/currencies.js"
click node_convert_api "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/controller/CurrencyController.java"
click node_currencies_api "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/controller/CurrencyListController.java"
click node_history_api "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/controller/HistoryController.java"
click node_conversion_service "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/CurrencyConversionService.java"
click node_currency_list "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/CurrencyListService.java"
click node_rate_client "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/client/ExchangeRateClient.java"
click node_rate_response "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/dto/FrankfurterResponse.java"
click node_currency_dto "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/dto/CurrencyDto.java"
click node_history_service "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/ConversionHistoryService.java"
click node_history_dto "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/dto/ConversionHistoryDto.java"
click node_history_model "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/model/ConversionHistory.java"
click node_history_repo "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/repositories/ConversionHistoryRepository.java"
click node_history_db "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/resources/db/migration/V1__create_conversion_history.sql"
click node_unsupported_error "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/exception/CurrencyNotSupportedException.java"
click node_unavailable_error "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/exception/ExchangeRateUnavailableException.java"
click node_error_handler "https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/exception/GlobalExceptionHandler.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_webpages,node_convert_ui,node_currencies_ui,node_convert_api,node_currencies_api,node_history_api,node_user toneBlue
class node_conversion_service,node_currency_list,node_rate_client,node_provider,node_rate_response,node_currency_dto toneAmber
class node_history_service,node_history_dto,node_history_model,node_history_repo,node_history_db toneMint
class node_unsupported_error,node_unavailable_error,node_error_handler toneRose
```

## Components

### Web interface

- [Browser pages](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/resources/static/index.html): `src/main/resources/static/index.html`
- [Conversion UI](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/resources/static/js/app.js): `src/main/resources/static/js/app.js`
- [Currency UI](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/resources/static/js/currencies.js): `src/main/resources/static/js/currencies.js`
- [Conversion endpoint](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/controller/CurrencyController.java): `src/main/java/io/github/dmytrozelinskyy/currencyconverter/controller/CurrencyController.java`
- [Currency-list endpoint](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/controller/CurrencyListController.java): `src/main/java/io/github/dmytrozelinskyy/currencyconverter/controller/CurrencyListController.java`
- [History endpoint](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/controller/HistoryController.java): `src/main/java/io/github/dmytrozelinskyy/currencyconverter/controller/HistoryController.java`

### Conversion and rates

- [Conversion service](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/CurrencyConversionService.java): `src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/CurrencyConversionService.java`
- [Currency-list service](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/CurrencyListService.java): `src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/CurrencyListService.java`
- [Exchange-rate client](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/client/ExchangeRateClient.java): `src/main/java/io/github/dmytrozelinskyy/currencyconverter/client/ExchangeRateClient.java`
- **Frankfurter provider**
- [Rate response](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/dto/FrankfurterResponse.java): `src/main/java/io/github/dmytrozelinskyy/currencyconverter/dto/FrankfurterResponse.java`
- [Currency DTO](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/dto/CurrencyDto.java): `src/main/java/io/github/dmytrozelinskyy/currencyconverter/dto/CurrencyDto.java`

### Conversion history

- [History service](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/ConversionHistoryService.java): `src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/ConversionHistoryService.java`
- [History DTO](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/dto/ConversionHistoryDto.java): `src/main/java/io/github/dmytrozelinskyy/currencyconverter/dto/ConversionHistoryDto.java`
- [History record](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/model/ConversionHistory.java): `src/main/java/io/github/dmytrozelinskyy/currencyconverter/model/ConversionHistory.java`
- [History repository](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/repositories/ConversionHistoryRepository.java): `src/main/java/io/github/dmytrozelinskyy/currencyconverter/repositories/ConversionHistoryRepository.java`
- [History database](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/resources/db/migration/V1__create_conversion_history.sql): `src/main/resources/db/migration/V1__create_conversion_history.sql`

### API support

- [Unsupported currency error](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/exception/CurrencyNotSupportedException.java): `src/main/java/io/github/dmytrozelinskyy/currencyconverter/exception/CurrencyNotSupportedException.java`
- [Provider unavailable error](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/exception/ExchangeRateUnavailableException.java): `src/main/java/io/github/dmytrozelinskyy/currencyconverter/exception/ExchangeRateUnavailableException.java`
- [Error handler](https://github.com/dmytrozelinskyy/currency-converter/blob/main/src/main/java/io/github/dmytrozelinskyy/currencyconverter/exception/GlobalExceptionHandler.java): `src/main/java/io/github/dmytrozelinskyy/currencyconverter/exception/GlobalExceptionHandler.java`

### Other components

- **User**

## Connections

- User → Browser pages: opens
- Browser pages → Conversion UI: uses script
- User → Conversion endpoint: requests conversion (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/controller/CurrencyController.java`)
- User → Currency-list endpoint: requests currencies (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/controller/CurrencyListController.java`)
- User → History endpoint: requests history (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/controller/HistoryController.java`)
- Conversion endpoint → Conversion service: calls (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/controller/CurrencyController.java`)
- Currency-list endpoint → Currency-list service: calls (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/controller/CurrencyListController.java`)
- History endpoint → History service: calls (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/controller/HistoryController.java`)
- Conversion service → Exchange-rate client: requests rate (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/CurrencyConversionService.java`)
- Conversion service → History service: records conversion (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/CurrencyConversionService.java`)
- Currency-list service → Exchange-rate client: loads currencies (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/CurrencyListService.java`)
- Exchange-rate client → Frankfurter provider: fetches rates (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/client/ExchangeRateClient.java`)
- Exchange-rate client → Rate response: parses response (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/client/ExchangeRateClient.java`)
- Exchange-rate client → Unsupported currency error: raises (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/client/ExchangeRateClient.java`)
- Exchange-rate client → Provider unavailable error: raises (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/client/ExchangeRateClient.java`)
- Currency-list service → Currency DTO: creates (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/CurrencyListService.java`)
- History service → History repository: reads and saves (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/ConversionHistoryService.java`)
- History service → History record: creates (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/ConversionHistoryService.java`)
- History service → History DTO: maps results (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/service/ConversionHistoryService.java`)
- History DTO → History record: maps fields (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/dto/ConversionHistoryDto.java`)
- History repository → History database: persists records
- Error handler → Unsupported currency error: handles (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/exception/GlobalExceptionHandler.java`)
- Error handler → Provider unavailable error: handles (evidence: `src/main/java/io/github/dmytrozelinskyy/currencyconverter/exception/GlobalExceptionHandler.java`)
