How gopal092003/currency-converter-api works
This is a FastAPI currency-conversion service. Its public workflow accepts conversion or rate queries, retrieves reference rates from Frankfurter, validates and normalizes provider data, and returns converted amounts or rate results. The README also documents historical, time-series, currency-listing, and liveness capabilities. Database, API-key, usage, rate-limit, cache, worker, and observability modules exist, but the README says several are not connected to public routes or middleware; those are shown as supporting, optional subsystems. Some internal wiring is omitted where source was not sampled.
Main entry points: router.py V1 routes · currency/service.py Conversion service · rates/service.py Rate service · base.py Provider interface
Components 23
Public API
- V1 routes
app/api/v1/router.py - Convert endpoint
app/api/v1/endpoints/convert.py - Rates endpoints
app/api/v1/endpoints/rates.py - Currencies endpoint
app/api/v1/endpoints/currencies.py - Liveness check
app/observability/health.py - Error envelopes
app/core/error_handlers.py
Currency and Rates
- Rate service
app/modules/rates/service.py - Conversion service
app/modules/currency/service.py - Decimal rounding
app/modules/currency/rounding.py - Rate validation
app/modules/rates/schemas.py - Currency validation
app/modules/currency/schemas.py
Rate Providers
- Provider interface
app/modules/providers/base.py - Provider selection
app/modules/providers/factory.py - Frankfurter client
app/modules/providers/frankfurter.py
Supporting Modules
- API-key management
app/modules/auth/service.py - API-key repository
app/modules/auth/repository.py - Database
app/db/session.py - Usage and quota
app/modules/usage/service.py - Rate limiting
app/modules/rate_limiting/middleware.py - Rate cache
app/modules/rates/cache.py - Rate refresh worker
app/workers/rate_refresh.py - Metrics
app/observability/metrics.py
Other components
- API client
Connections 22
- API client → V1 routes: requests API
README.md - V1 routes → Convert endpoint: routes to
app/api/v1/router.py - V1 routes → Rates endpoints: routes to
app/api/v1/router.py - V1 routes → Currencies endpoint: routes to
app/api/v1/router.py - API client → Liveness check: checks liveness
README.md - Rates endpoints → Rate service: retrieves rates
- Currencies endpoint → Rate service: retrieves latest rates
- Convert endpoint → Conversion service: converts amount
- Rate service → Provider interface: requests rate data
app/modules/rates/service.py - Conversion service → Provider interface: requests latest rate
app/modules/currency/service.py - Conversion service → Decimal rounding: rounds result
app/modules/currency/service.py - Rate service → Rate validation: validates data
app/modules/rates/service.py - Conversion service → Currency validation: uses request and result
app/modules/currency/service.py - Provider selection → Frankfurter client: selects provider
- Frankfurter client → Provider interface: implements
- API-key management → API-key repository: persists keys
app/modules/auth/service.py - API-key management → Database: uses session
app/modules/auth/router.py - Usage and quota → Database: stores usage
- Rate limiting → Rate cache: uses storage
- Rate refresh worker → Provider interface: fetches rates
app/workers/rate_refresh.py - Rate refresh worker → Rate cache: writes refreshed rates
app/workers/rate_refresh.py - Rate refresh worker → Metrics: records outcomes
app/workers/rate_refresh.py