# Repository Overview

Welcome to the codebase. This repository appears to be a small desktop currency converter written in Java, with a Swing user interface and a lightweight API client for exchange-rate lookups. The application lets a user choose source and target currencies, enter an amount, and view the converted result. It uses standard JDK APIs along with Gson and SLF4J, and it appears to keep the architecture intentionally simple.

If you are new here, the best mental model is: `converter` starts the app, `ui` handles the window and user interaction, and `api` talks to the external currency service. The code is compact, so a new contributor should be able to understand the full flow quickly by following those three modules in order.

## Overview

This project appears to be a Java currency conversion application with a desktop front end. The UI presents a conversion form, loads supported currency codes, and sends conversion requests to an external exchange-rate service. The API layer handles configuration, HTTP access, and JSON parsing, while the launcher package bootstraps the Swing application on the correct thread.

There do not appear to be any large framework dependencies or application server pieces here. The code seems to rely on plain Java, Swing, and a couple of small libraries for JSON and logging.

## Technology Stack

Detected technologies and libraries include:

- **Java** — the application language and runtime
- **Swing / AWT** — desktop UI components and event handling
- **Gson** — JSON parsing for API responses
- **SLF4J** — logging
- **JDK networking APIs** — HTTP requests via `HttpURLConnection`, `URL`, and `URI`
- **JDK utilities** — `Properties`, `BigDecimal`, `DecimalFormat`, `SwingWorker`

No well-known web framework or dependency injection framework was detected from import analysis.

## Architecture

At a high level, the repository appears to have a simple layered structure:

- `converter` is the launch point.
- `ui` builds and manages the Swing window.
- `api` retrieves currency data and performs conversions against the external service.

```mermaid
flowchart TD
Overview["Repository Overview"] --> Converter["converter"]
Overview --> UI["ui"]
Overview --> API["api"]
Converter --> UI
UI --> API
```

The dependency direction looks straightforward: the launcher creates the UI, and the UI calls into the API client when it needs currency data or conversion results. The API module appears independent of the desktop layer and only depends on configuration and the external service.

## Module Guide

### `com.github.blaxk3.converter`

This package appears to contain the application entry point. The main class is `CurrencyConverter`, which defines `main(String[] args)` and starts the UI by calling `SwingUtilities.invokeLater(UI::new)`. In practice, this module is responsible for bootstrapping the desktop app and keeping Swing initialization on the Event Dispatch Thread.

### `com.github.blaxk3.ui`

This package appears to contain the full Swing user interface. The main class is `UI`, which extends `JFrame` and assembles the window, currency selectors, amount field, action buttons, and result label. It also contains `NumericFilter`, which restricts the amount field to numeric input, and `CurrencyCode`, which loads currency codes in the background so the interface stays responsive.

### `com.github.blaxk3.api`

This package appears to provide the exchange-rate client layer. The main class is `CurrencyRateAPI`, which reads the API key from `config.properties`, builds ExchangeRate API URLs, fetches JSON responses, extracts supported currency codes, and performs pair conversions. It is the module that connects the application to the external currency data service.

## Getting Started

If you are reading the code for the first time, a good order is:

1. **`src/main/java/com/github/blaxk3/converter/CurrencyConverter.java`**
   - Start here to see how the application launches.
   - The `main` method is the top-level entry point.

2. **`src/main/java/com/github/blaxk3/ui/UI.java`**
   - Read next to understand the user flow.
   - Focus on the `UI` constructor, `panel()`, `button()`, `textField()`, and the nested `CurrencyCode` worker.
   - This is where user actions turn into API calls.

3. **`src/main/java/com/github/blaxk3/api/CurrencyRateAPI.java`**
   - Then inspect the API client to see how currency codes and conversion results are retrieved.
   - Pay attention to configuration loading, URL construction, and null handling.

A few practical entry points for navigation:

- `CurrencyConverter.main(...)` — application startup
- `UI` — main screen and behavior
- `CurrencyRateAPI.getCurrencyCode()` — currency list loading
- `CurrencyRateAPI.convert(...)` — conversion request path

## Additional Notes

The repository appears to be intentionally small, which is helpful for onboarding but also means some responsibilities are tightly coupled. The UI layer currently seems to own both presentation and much of the user interaction flow, while the API client directly handles HTTP and JSON parsing without an intermediate service layer. That simplicity makes the code easy to trace, but it also means runtime error handling is fairly minimal in a few places.

If you are extending the project, the most useful first question is usually whether the change belongs in the UI, the API client, or the launcher. For most new features, the answer will likely be the UI plus a small update to the API client if the data shape changes.
