This project demonstrates Domain-Driven Design (DDD) using a bounded context approach in Python. It features separate domains for Finance and HR, event dispatching, and a context map for translating between domain models.
Install python=3.8 virtual environment using uv:
uv venv --python 3.8
Activate it:
source .venv/bin/activate
From the project root, use:
python -m src.main
- Embrace Independence: Separate Finance and HR domains. Domain Events: Event dispatcher for cross-domain communication.
- Context Map: Translators for mapping between domain models.
- Shared Kernel: Common code and abstractions (such as record.py) shared between bounded contexts to avoid duplication and ensure consistency.
- Separate Context: Each domain (Finance, HR) is implemented in its own module, with its own models and logic, ensuring clear boundaries and independence.
- Anti Corruption Layer (ACL): The aclpackage (adapter, translator, facade) protects the HR domain from external models and protocols, translating and adapting data as it crosses context boundaries.
- Domain Event: Domain events (e.g., HrAccountCreatedEvent) are dispatched via a central dispatcher to enable decoupled communication between bounded contexts.
- Python 3.8+
- See pyproject.tomlfor tool configurations.
MIT