In the structure of the project there are three main layers following the Hexagonal Architecture or Clean Architecture approach:
Location: app
Responsibility: Contains the UI, such as FastAPI routers, HTTP request and response handling in main.py, and other
UI-related elements.
Location: core
Responsibility: Contains business logic, including entities, services, and other components that implement
the application's business rules.
Location: db
Responsibility: Contains the implementation of the infrastructure, such as the mock database.
This layer provides concrete implementations for data persistence, but the business logic does not directly
depend on the implementation details.
- docker
- docker compose
- Create a file called
.env
with environment variables in the root of the project. - Build with
docker compose build
. - Run with
docker compose up
. - Create migrations if necessary
alembic revision --autogenerate -m "Initial"
5In another terminal run the migrationsdocker compose exec character alembic upgrade head
. 6Run test withdocker compose exec character pytest -vv
.
- Go to
http://localhost:8000/docs
. - You can also test the endpoints with your preferred rest client. (Postman/Insomnia).
- Inside the tests directory in the dummy folder is a Postman collection with the endpoints and payload.
# SETTING
ENV=dev
SECRET_KEY=BoilerPlate2024
# POSTGRES
ENGINE=postgresql+psycopg2
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_PORT=5432
POSTGRES_DB=character
POSTGRES_HOST=db
PGTZ=America/Argentina/Buenos_Aires