Sample of TO-DO List Application using Hexagonal Architecture.
- Infrastructure: Database specific connectors all 3rd part dependant goes here.
- Application: Main use cases.
- Domain: All the business logic goes here.
to_do_list
├── shared
│ └── domain
│ └── models.py
└── tasks
├── application
│ ├── services.py
│ └── sources.py
├── domain
│ ├── contracts.py
│ ├── exceptions.py
│ ├── models.py
│ └── services.py
└── infrastructure
└── persistence
└── relational.py
app
├── configuration.py
├── console.py
└── providers.py
Just run poetry to install the dependencies.
poetry install
Next, you need to create and configure the .env
file.
# create .env file
cp example.env .env
# create the database file.
touch to_do_list.db
Once the dependencies are installed, you can run the application using the following command.
# initialize the database.
poetry run python todo.py init
# use the application.
poetry run python todo.py
- Unit: tests the domain and application layer.
- Integration: tests the infrastructure layer.
To run test you can use the following command.
poetry run pytest
tests
├── conftest.py
├── integration
│ └── test_infrastructure_persistence.py
└── unit
└── test_application_services.py