[feat] setup master from fork with fastapi + otel

This commit is contained in:
Azamat 2026-03-26 21:29:41 +03:00
parent 597eae9b97
commit 1fbf77f879
8 changed files with 310 additions and 1 deletions

View file

@ -0,0 +1,16 @@
# 001 Composition Root and Lifetimes
Context
- The template must initialize repository and usecase objects once and reuse them across requests.
- FastAPI integration must not leak framework concerns into inner layers.
Decision
- Keep a single composition root in `adapter/di/container.py`.
- Build repositories, usecases, config, and observability adapters during application startup.
- Store the container in application state and expose instances through thin HTTP dependencies.
- Do not create repository or usecase objects per request.
Consequences
- Object lifetimes stay explicit and testable.
- Replacing the web framework affects only the HTTP adapter layer.
- Startup failures surface early instead of during request handling.