Skip to main content

Currency Converter API

Production-ready currency conversion service that aggregates exchange rates from multiple providers to ensure reliability and accuracy.

Multi-Provider
3 Aggregated Sources
Smart Caching
5-Minute TTL
Reliability
Automatic Fallback

Quick start

Get up and running with the Currency Converter API in minutes

1

Set up with Docker Compose

Clone the repository and configure your environment variables with API keys from your chosen providers.
git clone https://github.com/DanielPopoola/currency_converter.git
cd currency_converter
cp docker/.env.example docker/.env
Edit docker/.env and add your API keys:
FIXERIO_API_KEY=your_fixer_key_here
OPENEXCHANGE_APP_ID=your_openexchange_key_here
CURRENCYAPI_KEY=your_currencyapi_key_here
2

Start the services

Launch PostgreSQL, Redis, and the FastAPI server using Docker Compose.
docker-compose -f docker/docker-compose.yml up --build
The API will be available at http://localhost:8000 with automatic database migrations and currency initialization.
3

Make your first conversion

Convert 100 USD to EUR using the conversion endpoint.
cURL
curl -X GET "http://localhost:8000/api/convert/USD/EUR/100"
{
  "from_currency": "USD",
  "to_currency": "EUR",
  "original_amount": 100.00,
  "converted_amount": 92.50,
  "exchange_rate": 0.925,
  "timestamp": "2025-03-04T10:30:00Z",
  "source": "averaged"
}
4

Explore the API

Access the interactive API documentation at http://localhost:8000/docs to explore all available endpoints and test them directly in your browser.

Key features

Built for reliability, accuracy, and developer experience

Multi-provider aggregation

Fetches rates from Fixer.io, OpenExchange, and CurrencyAPI in parallel, then averages results for maximum accuracy.

Smart caching

Redis cache with 5-minute TTL minimizes API calls and ensures fast response times for repeated requests.

Clean architecture

4-layer design (API, Application, Domain, Infrastructure) keeps code maintainable and testable.

Automatic fallback

If one provider fails, the service seamlessly falls back to others to ensure uninterrupted availability.

Historical tracking

PostgreSQL stores all fetched rates for historical analysis and audit trails.

Type safety

Full type hints with Pydantic validation ensure data integrity across all layers.

Ready to get started?

Set up the Currency Converter API in minutes with Docker Compose, or dive into the architecture to understand how multi-provider aggregation works.