How devbruce/fastapi-di-tpl works
Main Components
a. Application Layer
• FastAPI Application (Entry Point)
• Dependency Injection Container System
• Configuration Management
b. Core System Components
• Controllers Layer
• Services Layer
• Schemas Layer
• Interfaces Layer
c. Infrastructure Components
• Environment Configuration
• DI Configurations (dev/local/prd/stg/test)
Component Relationships
┌─────────────────────────────────────────────────────┐
• FastAPI Application │
• (main.py as the application entry point) │
• ┤
• Dependency Injection Layer │
• (containers.py managing dependency resolution) │
• ┬─────────────────┬──────────────┤
• Controllers │ Services │ Schemas │
• (API Routes) │ (Business Logic)│ (Data Models)│
• ┴─────────────────┴──────────────┤
• Configuration Management │
• (Environment-specific DI configs) │
• ┘
Important Elements to Highlight
• Blue: FastAPI Application Layer
• Green: Dependency Injection Container
• Yellow: Core Business Logic Components
• Gray: Configuration and Infrastructure
Specific Implementation Details
a. The DI Container Structure:
• How src/containers.py acts as the main container
• Relationship with core/system/containers.py
• How di_configs/*.yml files configure the container
b. Core System Organization:
• Relationship between controllers, services, and schemas
• Di_check module's role in dependency validation
• Utility layers (src/utils)
Testing Infrastructure
A separate section showing:
• Unit Tests relationship with components
• E2E Tests interaction with the system
• Test configuration management
Environment Configuration
How different environments are handled:
• Development (dev.yml)
• Production (prd.yml)
• Staging (stg.yml)
• Local (local.yml)
• Test (test.yml)