Run artifact

build/FxRates/docs/ARCHITECTURE.md

Application Architecture

Module ownership

ModuleOwnsAllowed dependencies
cliThe fxrates executable, argument handling, command dispatch, and diagnostics.Feature services, configuration
app_serverFastAPI application factory and HTTP route registration.Feature services, configuration
servicesECB CSV validation and loading, fetching, store initialization, rate queries, and exact decimal calculations.persistence, configuration, standard library
persistenceGenerated relational layer and shipped database library.Database engine and schema
configResolving the database location.Standard library

HTTP handlers call services. CLI commands call services. Services call generated persistence operations through the shipped persistence library. Only the persistence boundary reaches the database; application modules do not open database drivers directly.

The load workflow validates the complete input file before its first write. Fetch extracts the archive CSV and uses the same validation and loading path. Rates remain ECB-published text in storage and responses; calculations use decimal.Decimal.

Technology roles

TechnologyRole
Python 3.11 or newerApplication, CLI, services, and tests
FastAPIJSON HTTP API
uvicornServes the API on 127.0.0.1
SQLiteLocal rates store, accessed only through the shipped persistence library
pytestOffline automated tests
FastAPI TestClientIn-process API checks

Database location precedence is DATABASE_URL, then DATABASE_PATH, then data/app.db.