Home

Awesome

hexagonal-architecture-python

forthebadge made-with-python

This project was created as an example for my blog post https://blog.szymonmiks.pl/p/hexagonal-architecture-in-python/

I encourage you to read the article first before checking the code.

This is for educational purposes only and the code is not production-ready.

Intro

I created a project that uses FastAPI and follows the hexagonal architecture rules.

This project is a simplified gym management software. We have such functionalities like:

Project structure

project-structure

Stack

Prerequisites

Make sure you have installed all the following prerequisites on your development machine:

Setup

  1. Install dependencies:
$ poetry install
  1. Setup pre-commit hooks before committing:
$ poetry run pre-commit install

Running app locally

  1. In the main project's directory create a new .env file and copy all variables from example.env there.
  2. Run docker-compose up -d
  3. Go to src/app.py and run the app

Tests

$ poetry run pytest

or

$ make tests