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

  1. Runner (entrypoint) → instantiates the concrete adapter, repository, use case, and presentation classes, then calls the presentation.

  2. Presentation → receives input, builds filters/schemas as needed.

  3. Use Case (Application) → calls a Repository, applying any orchestration logic.

  4. Repository (Application) → sends the domain model or filters to a Port.

  5. Adapter (Infrastructure) → the concrete implementation of that Port — interacts with the actual database/service and returns a domain model.

4.6.2. Response Flow

  1. Adapter (Infrastructure) → returns the domain model (or a list of them).

  2. Repository (Application) → returns it to the Use Case, unchanged.

  3. Mapper (Application) → converts the domain model to a Schema.

  4. Use Case (Application) → returns the schema.

  5. 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.