A REST API built with Flask for converting currencies using real-time exchange rates from the Frankfurter Exchange Rates API. The project follows a modular architecture with separate layers for routing, business logic, configuration, and external API integration, making it easy to maintain and extend.
- Convert between supported currencies using live exchange rates
- Real-time data powered by the Frankfurter API
- Modular and maintainable project structure
- Input validation and error handling
- Lightweight and easy to extend
- Flask
- Requests
- Frankfurter Exchange Rates API
currency-converter-api/
│
├── app/
│ ├── config/ # Application configuration
│ ├── routes/ # API endpoints
│ ├── services/ # Business logic
│ └── utils/ # External API integration
│
├── tests/ # Unit tests
├── documentation.md
├── requirements.txt
├── run.py
└── README.md
git clone https://github.com/gopal092003/currency-converter-API.git
cd currency-converter-API
python -m venv venv
Activate the environment:
Windows
venv\Scripts\activate
Linux / macOS
source venv/bin/activate
pip install -r requirements.txt
Start the development server:
python run.py
The API will be available at:
http://127.0.0.1:5000
GET /convertExample request:
GET /convert?amount=100&from=USD&to=INR{
"from": "USD",
"to": "INR",
"amount": 100,
"rate": 93.43,
"converted": 9343
}- The client sends a currency conversion request with the amount, source currency, and target currency.
- The application fetches the latest exchange rate from the Frankfurter API.
- The converted amount is calculated and returned in a structured JSON response.
| Status Code | Description |
|---|---|
| 200 | Request completed successfully |
| 400 | Invalid amount or unsupported currency |
| 500 | Internal server error |
python -m unittest discover tests
This project uses the Frankfurter Exchange Rates API to retrieve live currency exchange rates.
- Add an endpoint to list supported currencies
- Support batch currency conversion
- Add caching for frequently requested exchange rates
- Dockerize the application
- Deploy to a cloud platform
- Add request rate limiting
Gopal Gupta
GitHub: https://github.com/gopal092003
This project is licensed under the MIT License.