# y0i7/currency-converter-cli architecture

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

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

## Overview

1. **Overall shape**
   This is a single-project .NET console application focused on one bounded domain: currency conversion. The executable is the `CurrencyConverter.Cli` project, and all runtime behavior starts in `Program.cs`.

2. **Entry point and orchestration**
   `Program.cs` is the composition root. It likely wires configuration, localization, HTTP access, and the command flow for both one-shot commands and interactive REPL mode. This is where CLI arguments are interpreted and the app decides whether to convert, list currencies, show help, or enter interactive input.

3. **Core business logic**
   `Services/CurrencyService.cs` appears to hold the main application rules: validating inputs, asking for exchange rates, and preparing conversion results. It sits above the API client so that command handling does not depend directly on HTTP concerns.

4. **External API boundary**
   `Services/FrankfurterClient.cs` is the infrastructure adapter for the Frankfurter API. It implements `Services/IExchangeClient.cs`, which is the abstraction that isolates the rest of the app from the concrete HTTP provider. This keeps API access swappable and makes the service layer easier to test.

5. **HTTP and configuration**
   `Utils/HttpClientProvider.cs` and `appsettings.json` define the runtime connection to the external service. The only configuration shown is the Frankfurter base URL, so the app’s network boundary is driven by external config rather than hardcoded endpoints.

6. **Data contracts**
   `Models/FrankfurterResponse.cs` is the JSON-shaped response model for the exchange API. This is the main data object crossing the network boundary before results are transformed into user-facing output.

7. **CLI presentation layer**
   `Utils/CliHelper.cs` likely handles command parsing, REPL interaction, help text, and command routing. It is the presentation boundary between raw console input/output and the application services.

8. **Localization and culture handling**
   `Utils/LanguageService.cs` plus the `Resources/` `.resx` files provide localized messages in English, Spanish variants, French, and Chinese. The CLI output is culture-aware, so user-facing text is separated from business logic and can change by language without touching conversion logic.

9. **Formatting and user-facing money output**
   `Utils/MoneyFormatter.cs` is responsible for turning numeric results into locale-appropriate currency strings. This is important because the app deals with decimal precision and display formatting separately from the exchange-rate calculation itself.

10. **Runtime flow**
   A typical conversion flows as: console input or command-line args → CLI helper/command handling → `CurrencyService` → `IExchangeClient`/`FrankfurterClient` → Frankfurter API → response model → formatting/localization → console output. The main architectural boundary is between the local CLI/domain logic and the external HTTP API.

11. **Operational characteristics**
   The app is stateless and client-side only; it does not persist data or depend on a database. Its only external dependency is the Frankfurter exchange-rate service, and all configuration appears to be file-based through `appsettings.json`.

12. **What to draw in a diagram**
   The clearest diagram should show three layers: the console/UI layer (`Program.cs`, `CliHelper`, localization, formatting), the application/service layer (`CurrencyService`), and the infrastructure layer (`FrankfurterClient`, `HttpClientProvider`, external Frankfurter API). `Models/FrankfurterResponse` sits at the API boundary, and `Resources/` hangs off the UI layer for localized messages.

Main entry points: [`CurrencyConverter.Cli/Utils/LanguageService.cs`](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Utils/LanguageService.cs) (Language), [`CurrencyConverter.Cli/Program.cs`](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Program.cs) (Program), [`CurrencyConverter.Cli/Utils/CliHelper.cs`](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Utils/CliHelper.cs) (CLI Helper), [`CurrencyConverter.Cli/Services/FrankfurterClient.cs`](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Services/FrankfurterClient.cs) (Frankfurter Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["UI / CLI"]
  node_program["Program<br/>entrypoint<br/>[Program.cs]"]
  node_clihelper["CLI Helper<br/>command flow<br/>[CliHelper.cs]"]
  node_lang["Language<br/>locale<br/>[LanguageService.cs]"]
  node_money["Money Format<br/>formatting<br/>[MoneyFormatter.cs]"]
end

subgraph group_app["Application"]
  node_currencyservice["Currency Service<br/>application logic<br/>[CurrencyService.cs]"]
  node_iexchange["Exchange Client<br/>abstraction<br/>[IExchangeClient.cs]"]
end

subgraph group_infra["Infrastructure"]
  node_frankfurterclient["Frankfurter Client<br/>http adapter"]
  node_httpclient["HTTP Provider<br/>http setup"]
  node_response["API Response<br/>contract"]
  node_api[("Frankfurter API<br/>external service")]
end

subgraph group_res["Resources"]
  node_messages["Messages<br/>localization<br/>[Messages.resx]"]
  node_messages_en["English<br/>localization<br/>[Messages.en.resx]"]
  node_messages_es["Spanish<br/>localization<br/>[Messages.es.resx]"]
  node_messages_esco["ES-CO<br/>localization"]
  node_messages_eses["ES-ES<br/>localization"]
  node_messages_fr["French<br/>localization<br/>[Messages.fr.resx]"]
  node_messages_zh["Chinese<br/>localization"]
end

node_program -->|"starts"| node_clihelper
node_program -->|"wires"| node_currencyservice
node_program -->|"configures"| node_lang
node_program -->|"uses"| node_money
node_program -->|"loads"| node_messages
node_clihelper -->|"invokes"| node_currencyservice
node_clihelper -->|"reads"| node_lang
node_clihelper -->|"formats"| node_money
node_clihelper -->|"displays"| node_messages
node_lang -.->|"selects"| node_messages_en
node_lang -.->|"selects"| node_messages_es
node_lang -.->|"selects"| node_messages_esco
node_lang -.->|"selects"| node_messages_eses
node_lang -.->|"selects"| node_messages_fr
node_lang -.->|"selects"| node_messages_zh
node_currencyservice -->|"depends on"| node_iexchange
node_currencyservice -->|"formats"| node_money
node_iexchange -.->|"implemented by"| node_frankfurterclient
node_frankfurterclient -->|"uses"| node_httpclient
node_frankfurterclient -->|"maps"| node_response
node_frankfurterclient -->|"calls"| node_api
node_httpclient -->|"connects to"| node_api

click node_program "https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Program.cs"
click node_clihelper "https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Utils/CliHelper.cs"
click node_lang "https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Utils/LanguageService.cs"
click node_money "https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Utils/MoneyFormatter.cs"
click node_messages "https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Resources/Messages.resx"
click node_messages_en "https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Resources/Messages.en.resx"
click node_messages_es "https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Resources/Messages.es.resx"
click node_messages_esco "https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Resources/Messages.es-CO.resx"
click node_messages_eses "https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Resources/Messages.es-ES.resx"
click node_messages_fr "https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Resources/Messages.fr.resx"
click node_messages_zh "https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Resources/Messages.zh-CN.resx"
click node_currencyservice "https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Services/CurrencyService.cs"
click node_iexchange "https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Services/IExchangeClient.cs"
click node_frankfurterclient "https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Services/FrankfurterClient.cs"
click node_httpclient "https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Utils/HttpClientProvider.cs"
click node_response "https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Models/FrankfurterResponse.cs"

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_program,node_clihelper,node_lang,node_money toneBlue
class node_currencyservice,node_iexchange toneAmber
class node_frankfurterclient,node_httpclient,node_response,node_api toneMint
class node_messages,node_messages_en,node_messages_es,node_messages_esco,node_messages_eses,node_messages_fr,node_messages_zh toneRose
```

## Components

### UI / CLI

Console entrypoint, command handling, localization, and formatting

- [Program](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Program.cs): entrypoint · Composition root and app startup · `CurrencyConverter.Cli/Program.cs`
- [CLI Helper](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Utils/CliHelper.cs): command flow · Parses commands, drives interactive mode, and routes user input · `CurrencyConverter.Cli/Utils/CliHelper.cs`
- [Language](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Utils/LanguageService.cs): locale · Selects culture and language behavior · `CurrencyConverter.Cli/Utils/LanguageService.cs`
- [Money Format](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Utils/MoneyFormatter.cs): formatting · Renders amounts for user-facing output · `CurrencyConverter.Cli/Utils/MoneyFormatter.cs`

### Application

Conversion rules and orchestration

- [Currency Service](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Services/CurrencyService.cs): application logic · Validates requests and coordinates conversions · `CurrencyConverter.Cli/Services/CurrencyService.cs`
- [Exchange Client](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Services/IExchangeClient.cs): abstraction · Exchange-rate provider contract · `CurrencyConverter.Cli/Services/IExchangeClient.cs`

### Infrastructure

HTTP client boundary and external API access

- [Frankfurter Client](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Services/FrankfurterClient.cs): http adapter · HTTP adapter for the Frankfurter API · `CurrencyConverter.Cli/Services/FrankfurterClient.cs`
- [HTTP Provider](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Utils/HttpClientProvider.cs): http setup · Creates and configures the shared HTTP client · `CurrencyConverter.Cli/Utils/HttpClientProvider.cs`
- [API Response](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Models/FrankfurterResponse.cs): contract · Frankfurter JSON response model · `CurrencyConverter.Cli/Models/FrankfurterResponse.cs`
- **Frankfurter API**: external service · Remote exchange-rate service

### Resources

Localized message bundles

- [Messages](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Resources/Messages.resx): localization · Localized UI strings · `CurrencyConverter.Cli/Resources/Messages.resx`
- [English](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Resources/Messages.en.resx): localization · English resource bundle · `CurrencyConverter.Cli/Resources/Messages.en.resx`
- [Spanish](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Resources/Messages.es.resx): localization · Spanish resource bundle · `CurrencyConverter.Cli/Resources/Messages.es.resx`
- [ES-CO](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Resources/Messages.es-CO.resx): localization · Colombian Spanish resource bundle · `CurrencyConverter.Cli/Resources/Messages.es-CO.resx`
- [ES-ES](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Resources/Messages.es-ES.resx): localization · Spain Spanish resource bundle · `CurrencyConverter.Cli/Resources/Messages.es-ES.resx`
- [French](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Resources/Messages.fr.resx): localization · French resource bundle · `CurrencyConverter.Cli/Resources/Messages.fr.resx`
- [Chinese](https://github.com/y0i7/currency-converter-cli/blob/main/CurrencyConverter.Cli/Resources/Messages.zh-CN.resx): localization · Simplified Chinese resource bundle · `CurrencyConverter.Cli/Resources/Messages.zh-CN.resx`

## Connections

- Program → CLI Helper: starts · Main entry initializes command flow
- Program → Currency Service: wires · Composition root connects the service layer
- Program → Language: configures · Sets culture and language behavior
- Program → Money Format: uses · Formats user-visible amounts
- Program → Messages: loads · Uses localized UI strings
- CLI Helper → Currency Service: invokes · Routes conversion and listing commands
- CLI Helper → Language: reads · Applies selected language/culture
- CLI Helper → Money Format: formats · Prepares amounts for console output
- CLI Helper → Messages: displays · Uses localized prompts and help text
- Language → English: selects · English resources
- Language → Spanish: selects · Spanish resources
- Language → ES-CO: selects · Colombian Spanish resources
- Language → ES-ES: selects · Spain Spanish resources
- Language → French: selects · French resources
- Language → Chinese: selects · Chinese resources
- Currency Service → Exchange Client: depends on · Service uses exchange-rate abstraction
- Currency Service → Money Format: formats · Prepares conversion results for output
- Exchange Client → Frankfurter Client: implemented by · Concrete HTTP provider behind the abstraction
- Frankfurter Client → HTTP Provider: uses · Relies on configured HTTP client
- Frankfurter Client → API Response: maps · Deserializes API payload into response model
- Frankfurter Client → Frankfurter API: calls · Requests exchange rates from remote service
- HTTP Provider → Frankfurter API: connects to · Base URL comes from app configuration
