Skip to content

Repository files navigation

Demo of user registration API

The API use the Hexagonal Architecture pattern that I have explained in my blog (Ranked high in Google for hexagonal architecture in python keywords)

https://www.workflows.guru/blogs/hexagonal-architecture-implemented-in-python

Using Hexagonal Architecture in this API have many benefits:

  • Separation between domain logic and external dependencies
  • Easy testing: In memory classes to mock external dependencies
  • Easy swapping of dependencies: Switching DB or switching Email providers requires zero domain changes

Run the app

docker-compose up --build

You could visit the swagger at: http://localhost:8000/docs#

This app was tested with Python 3.13.0

Tests

To run test in docker:

docker-compose run --rm api pytest

Or in your local env

Install uv if it's not installed:

curl -LsSf https://astral.sh/uv/install.sh | sh

Run pytest

 uv run pytest

or

uv venv
uv sync
uv run pytest

TODO

A lot of cool feature and enhancement could be done to make this little app production ready (list not exhaustive and some of this feature could be handled by external component like proxies, side cars ...):

  • Add migration strategy
  • Add Rate limiting
  • Brute-force protection
  • Add Observability (instrumentation for tracing and monitoring)
  • Enhance logging
  • Add health check

About

User registration Demo API

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages