How y0i7/currency-converter-cli works
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: LanguageService.cs Language · Program.cs Program · CliHelper.cs CLI Helper · FrankfurterClient.cs Frankfurter Client
Components 17
UI / CLI
Console entrypoint, command handling, localization, and formatting
- Program · Composition root and app startup
CurrencyConverter.Cli/Program.cs - CLI Helper · Parses commands, drives interactive mode, and routes user input
CurrencyConverter.Cli/Utils/CliHelper.cs - Language · Selects culture and language behavior
CurrencyConverter.Cli/Utils/LanguageService.cs - Money Format · Renders amounts for user-facing output
CurrencyConverter.Cli/Utils/MoneyFormatter.cs
Application
Conversion rules and orchestration
- Currency Service · Validates requests and coordinates conversions
CurrencyConverter.Cli/Services/CurrencyService.cs - Exchange Client · Exchange-rate provider contract
CurrencyConverter.Cli/Services/IExchangeClient.cs
Infrastructure
HTTP client boundary and external API access
- Frankfurter Client · HTTP adapter for the Frankfurter API
CurrencyConverter.Cli/Services/FrankfurterClient.cs - HTTP Provider · Creates and configures the shared HTTP client
CurrencyConverter.Cli/Utils/HttpClientProvider.cs - API Response · Frankfurter JSON response model
CurrencyConverter.Cli/Models/FrankfurterResponse.cs - Frankfurter API · Remote exchange-rate service
Resources
Localized message bundles
- Messages · Localized UI strings
CurrencyConverter.Cli/Resources/Messages.resx - English · English resource bundle
CurrencyConverter.Cli/Resources/Messages.en.resx - Spanish · Spanish resource bundle
CurrencyConverter.Cli/Resources/Messages.es.resx - ES-CO · Colombian Spanish resource bundle
CurrencyConverter.Cli/Resources/Messages.es-CO.resx - ES-ES · Spain Spanish resource bundle
CurrencyConverter.Cli/Resources/Messages.es-ES.resx - French · French resource bundle
CurrencyConverter.Cli/Resources/Messages.fr.resx - Chinese · Simplified Chinese resource bundle
CurrencyConverter.Cli/Resources/Messages.zh-CN.resx
Connections 22
- 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