You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the structure of the project there are three main layers following the Hexagonal Architecture or Clean Architecture approach:
User interface (UI) layer or external environment adapters:
Location: app
Responsibility: Contains the UI, such as FastAPI routers, HTTP request and response handling in main.py, and other
UI-related elements.
Business logic layer or use cases:
Location: core
Responsibility: Contains business logic, including entities, services, and other components that implement
the application's business rules.
Infrastructure or internal environment layer adapters:
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.
Running with docker
Pre-requisites:
docker
docker compose
Steps:
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 migrations docker compose exec character alembic upgrade head.
6Run test with docker compose exec character pytest -vv.
How to use:
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.