docs: Define explicit DI container strategy for backend service graph
- Add comprehensive 'Dependency Wiring and Service Composition' section to Architekture.md (§ 2.3) documenting: * The lightweight FastAPI Depends() pattern used as composition root * Service composition through explicit parameter passing * Service context dependencies pattern (SessionServiceContext, etc.) * Repository boundary enforcement * Lifecycle and scope management * Checklist for adding new services - Update Backend-Development.md to reference the new Architecture section from the 'Dependency Layering' section - Enhance dependencies.py module docstring with clear explanation of: * Composition root pattern * Explicit over implicit principles * Service context dependencies * Repository boundary enforcement This resolves issue #39 by providing clear guidance on dependency wiring without over-engineering. The pattern uses FastAPI's built-in Depends() framework and avoids heavyweight container libraries, keeping the solution lightweight and maintainable. Fixes: #39 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -312,7 +312,9 @@ async def list_jails(service: JailService = Depends()) -> JailListResponse:
|
||||
|
||||
### Dependency Layering: Enforcing the Repository Boundary
|
||||
|
||||
The **repository boundary** separates database-aware code from application logic. This is enforced through dependency injection:
|
||||
The **repository boundary** separates database-aware code from application logic. This is enforced through dependency injection.
|
||||
|
||||
For a complete overview of BanGUI's DI pattern, including the composition root, service wiring, and lifecycle management, see [Architekture.md § 2.3 Dependency Wiring and Service Composition](Architekture.md#23-dependency-wiring-and-service-composition).
|
||||
|
||||
| Layer | Responsibilities | Dependencies |
|
||||
|---|---|---|
|
||||
|
||||
Reference in New Issue
Block a user