How iktakahiro/dddpy works
Main Components
• Domain Layer: Represented by the dddpy/domain directory. This layer includes the core business logic, defining entities (e.g., the Todo entity in dddpy/domain/todo/entities/todo.py), value objects (todo_title, todo_description, etc.), repository interfaces, and domain-specific exceptions.
• Usecase Layer: Found under dddpy/usecase. Each use case (create, update, delete, start, complete, find) encapsulates a business rule and an execute() method. This layer orchestrates interactions between the domain layer and the external world.
• Infrastructure Layer: Located in dddpy/infrastructure. It implements persistence using SQLite (see dddpy/infrastructure/sqlite) and contains the dependency injection configuration (dddpy/infrastructure/di/injection.py). This layer provides concrete implementations of the repository interfaces.
• Presentation Layer: Found in dddpy/presentation/api. It consists of FastAPI route handlers, schemas, and error message definitions that expose a RESTful interface for the application.
• The Infrastructure layer should be depicted as an outer adapter that implements the abstractions defined in the Domain layer (especially repository interfaces). Indicate dependency injection where the Usecase layer receives concrete repository implementations from this layer.
• An external “Database” component (SQLite) that is used by the Infrastructure layer, along with the dependency injection container that binds the abstraction to its implementation.
Architectural Patterns and Design Principles
• Onion Architecture by showing how the domain (core business logic) is isolated from external concerns.
• Reliance on DDD principles, such as using value objects (immutable data structures) and clearly defined entity behavior.
• That error handling is domain-specific with custom exceptions and corresponding error messages in the API layer.
• The clear separation of concerns improves maintainability and testability; include the tests folder to represent integration and unit tests validating each layer.
Relevant Technologies
• FastAPI is used in the Presentation layer.
• SQLite is used for persistence (via SQLAlchemy patterns as suggested by the README).
• Docker is used (see .devcontainer) to standardize the development environment.
• The uv tool (from uv.lock and README instructions) is used for dependency management, and testing is supported by pytest (tests directory).
• Additionally, configuration files such as logging.conf, Makefile, and CI workflows in .github/workflows should be noted as they contribute to the deployment and quality assurance processes.