Loading repository data…
Loading repository data…
rafaski / repository
A currency converter API built with FastAPI, mongoDB, redis and httpx
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
This application was built for educational purposes and is not intended for production use.
This is a subscription based currency converter API.
The main reason for creating this application was to learn new technologies and build a real-world application from scratch.
Main features:
httpx libraryRedis using aioredis libraryMongo DB with motorpydantic for data models and validationCurrency rates are provided by an external API https://www.fastforex.io/.
Supported operations are:
Each currency conversion operation is charged 1 credit.
The API offers several subscription plans:
| Subscription plan | Credits | Concurrency |
|---|---|---|
| Basic | 100 | 1 |
| Hobby | 500 | 3 |
| Pro | 10.000 | 10 |
| Enterprise | 50.000 | 15 |
Each user can subscribe to the service by providing a valid email address. After successful subscription the user receives an API key that is required to use the currency converter endpoints. API also provides several internal endpoints for subscription administration purposes.
Only subscribed users can use the API. To authenticate incoming requests, we
check the api_key header.
To run the API you will need an API key from https://www.fastforex.io/.
Create the .env file (use the .env.dist for reference) and add the
Fast Forex API key.
Dependency management is handled using requirements.txt file.
docker build -t currency_converter_api .docker-compose up -d --build --force-recreate currency_converter_apidocker run -p 80:80 currency_converter_apirequirements.txt fileuvicorn currency_converter_api.main:app --reloadOnce the application is up and running, you can access FastAPI automatic docs
at index page /.
| Method | Endpoint | Description |
|---|---|---|
| GET | /currencies | fetch a list of all supported currencies |
| GET | /convert | convert one currency into another currency |
| GET | /fetch_one | fetch a single exchange rate |
| GET | /fetch_all | fetch all available exchange rates |
| GET | /historical | get historical exchange rates |
| Method | Endpoint | Description |
|---|---|---|
| POST | /subscribe | create a new subscription |
| GET | /all_users | list all signed-up users |
| Status code | Description |
|---|---|
| 200 | success |
| 400 | bad request, please check your request |
| 401 | user unauthorized, check your API key |
| 424 | external dependency failed |
| 429 | rate limit violation |
| 500 | internal server error, application failed |
GET /convert?amount=1&from_curr=USD&to_curr=EUR
{
"base": "USD",
"amount": 1,
"result": {
"EUR": 0.94,
"rate": 0.9393
},
"ms": 1
}