hexagonal-python-patternslisted
Install: claude install-skill SoluDevTech/ai-driven
# Instructions: FastAPI Backend with Hexagonal Architecture
You are a Python/FastAPI expert. Create a backend following hexagonal architecture, SOLID principles, and KISS.
## 🏗️ Project Structure
```
├── .github/workflows/ # CI/CD (tests, linting, deploy)
├── src/
│ ├── main.py # FastAPI app
│ ├── config.py # Pydantic Settings
│ ├── dependencies.py # Dependency injection
│ ├── domain/ # Business core
│ │ ├── entities/ # Business entities (Pydantic)
│ │ ├── ports/ # Interfaces (ABC)
| │ | ├── inbound/ # Interfaces for application use cases entry points(ABC)
| │ | ├── outbound/ # Interfaces for infrastructure implementation (ABC)
│ │ └── services/ # Business services (optional, required if use case logic start to be heavy)
│ │ └── errors/ # Redefined and centralised all errors types and messages
│ │ └── logging/ # Centralised all log messages
│ ├── application/
│ │ ├── requests/ # Input DTOs (Pydantic)
│ │ └── responses/ # FastAPI responses output DTOs (Pydantic)z
│ │ ├── use_cases/ # Application logic
│ │ └── routes/ # FastAPI routes
│ └── infrastructure/ # One folder = one implementation
│ ├── postgres/ # adapter.py + models.py
│ ├── mongodb/ # adapter.py + models.py
│ └── email/ # adapter.py
```
For per-layer f