4.6. Application Flow
This page describes the request and response flow through the layers, tying together the Domain, Application, Infrastructure, Presentation, and Runner pages into one end-to-end picture.
4.6.1. Request Flow
Runner (entrypoint) → instantiates the concrete adapter, repository, use case, and presentation classes, then calls the presentation.
Presentation → receives input, builds filters/schemas as needed.
Use Case (Application) → calls a Repository, applying any orchestration logic.
Repository (Application) → sends the domain model or filters to a Port.
Adapter (Infrastructure) → the concrete implementation of that Port — interacts with the actual database/service and returns a domain model.
4.6.2. Response Flow
Adapter (Infrastructure) → returns the domain model (or a list of them).
Repository (Application) → returns it to the Use Case, unchanged.
Mapper (Application) → converts the domain model to a Schema.
Use Case (Application) → returns the schema.
Presentation → formats it for output (CLI printing, an HTTP response, …).
This keeps every layer decoupled from the ones it doesn’t directly depend on: swapping a database engine only touches the Adapter, and changing how output is formatted only touches Presentation — the Use Case in between doesn’t need to change for either.