Skip to content

gmunumel/ddd-bounded-context

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

ddd-bounded-context

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 Virtual Environment

Install python=3.8 virtual environment using uv:

uv venv --python 3.8

Activate it:

source .venv/bin/activate

Running the Project

From the project root, use:

python -m src.main

Features

  • 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 acl package (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.

Requirements

  • Python 3.8+
  • See pyproject.toml for tool configurations.

License

MIT

About

This is a project to showcase Domain-Driven Design Bounded Context in Python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages