Skip to content

Clean Architecture approach for Django project code structure implementation.

License

Notifications You must be signed in to change notification settings

sdediego/django-clean-architecture

Repository files navigation

Forex - Django Clean Architecture

This repository contains the code for Forex API backend. The application aims to provide information for all currencies, latests and historical time series exchange rates for currency pairs, currency conversion and time weighted rates calculation.

Documentation

This project has been developed using Django and Django Rest Framework, with Celery as background tasks runner, Postgres as relational database and Redis as cache service.

Code structure implementation follows a Clean Architecture approach, emphasizing on code readability, responsibility decoupling and unit testing.

For API backend endpoints documentation refer to the forex yaml file in the docs directory.

Setup

Download source code cloning this repository:

git clone https://github.com/sdediego/django-clean-architecture.git

Get free API Key for the following exchange rate services:

  1. https://fixer.io/
  2. https://xchangeapi.com/
  3. https://www.exchangerate-api.com/

Later update database with each value for the corresponding provider api_key setting using the backend admin panel.

Run the API backend:

Create docker images and execute the containers for development. From the project directory:

docker-compose -f ./docker/docker-compose.yaml -f ./docker/docker-compose.dev.yaml up

Shutdown the application and remove network and containers gracefully:

docker-compose -f ./docker/docker-compose.yaml -f ./docker/docker-compose.dev.yaml down

Execute tests suite

  1. Execute the docker containers with environment variables setup for testing:
docker-compose -f ./docker/docker-compose.yaml -f ./docker/docker-compose.test.yaml up
  1. Access running api backend forex_api docker container shell:
docker exec -it forex_api bash
  1. Execute pytest command from project directory:
pytest

Releases

No releases published

Packages

No packages published

Languages