# teo-space/webapitemplate architecture

> Architecture diagram of the GitHub repository teo-space/webapitemplate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/teo-space/webapitemplate
- Repository: https://github.com/teo-space/webapitemplate

## Overview

This repository is a clean-architecture Web API template, with an example workflow for retrieving a user’s orders. The documented flow runs from REST API to application service, repository, and persistence, then maps domain orders into an API output model. The README also describes external-service integrations; the sampled implementation is a stub. Relationships involving the controller are supported by the source index and README, while persistence and mapping calls are visible in excerpts. Unsampled wiring is included only where the source index supports it.

Main entry points: [`Core/WebApiTemplate.Core.Services/Implementations/OrderService.cs`](https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Services/Implementations/OrderService.cs) (Order Service), [`WebApiTemplate.Api/Controllers/OrderController.cs`](https://github.com/teo-space/webapitemplate/blob/main/WebApiTemplate.Api/Controllers/OrderController.cs) (Order Controller), [`Core/WebApiTemplate.Core.Services/Mappers/OrderServiceMapper.cs`](https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Services/Mappers/OrderServiceMapper.cs) (Order Mapper), [`Infrastructure/WebApiTemplate.Infrastructure.Persistence/Repositories/OrderServiceRepository.cs`](https://github.com/teo-space/webapitemplate/blob/main/Infrastructure/WebApiTemplate.Infrastructure.Persistence/Repositories/OrderServiceRepository.cs) (Order Repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API"]
  node_order_controller["Order Controller<br/>[OrderController.cs]"]
end

subgraph group_core["Core"]
  node_get_orders_input["Orders Input<br/>[GetOrdersInput.cs]"]
  node_order_service_contract["Order Service Contract<br/>[IOrderService.cs]"]
  node_order_service["Order Service<br/>[OrderService.cs]"]
  node_order_repository_contract["Repository Contract"]
  node_order_entity["Order Entity<br/>[Order.cs]"]
  node_delivery_type["Delivery Type<br/>[DeliveryType.cs]"]
  node_order_mapper["Order Mapper"]
  node_orders_list["Orders List<br/>[OrdersListModel.cs]"]
  node_order_model["Order Output<br/>[OrderModel.cs]"]
  node_service_registration["Service Registration"]
end

subgraph group_persistence["Persistence"]
  node_order_repository["Order Repository"]
  node_store_db_context["Store Context<br/>[StoreDbContext.cs]"]
  node_orders_database[("Orders Database")]
  node_persistence_registration["Persistence Registration"]
end

subgraph group_external["External Services"]
  node_some_service_contract["External Service Contract"]
  node_some_service_model["External Result Model"]
  node_some_service_impl["External Service Stub"]
  node_external_registration["External Registration"]
end

node_client(("API Client"))

node_client -->|"requests orders"| node_order_controller
node_order_controller -->|"accepts input"| node_get_orders_input
node_order_controller -->|"calls service"| node_order_service_contract
node_service_registration -->|"registers implementation"| node_order_service_contract
node_service_registration -->|"registers implementation"| node_order_service
node_order_service -->|"fetches orders"| node_order_repository_contract
node_order_service -->|"maps orders"| node_order_mapper
node_order_service -->|"builds response"| node_orders_list
node_order_repository -->|"queries orders"| node_store_db_context
node_store_db_context -.->|"reads orders"| node_orders_database
node_persistence_registration -->|"registers implementation"| node_order_repository_contract
node_persistence_registration -->|"registers implementation"| node_order_repository
node_order_repository -->|"returns entities"| node_order_entity
node_order_mapper -->|"maps from"| node_order_entity
node_order_mapper -->|"maps to"| node_order_model
node_order_model -->|"uses enum"| node_delivery_type
node_orders_list -->|"contains models"| node_order_model
node_order_entity -->|"uses enum"| node_delivery_type
node_external_registration -->|"registers implementation"| node_some_service_contract
node_external_registration -->|"registers implementation"| node_some_service_impl
node_some_service_impl -->|"implements contract"| node_some_service_contract
node_some_service_impl -->|"returns model"| node_some_service_model
node_some_service_contract -->|"returns model"| node_some_service_model

click node_order_controller "https://github.com/teo-space/webapitemplate/blob/main/WebApiTemplate.Api/Controllers/OrderController.cs"
click node_get_orders_input "https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Input/Models/Orders/GetOrdersInput.cs"
click node_order_service_contract "https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Interfaces/Services/IOrderService.cs"
click node_order_service "https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Services/Implementations/OrderService.cs"
click node_order_repository_contract "https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Interfaces/Infrastructure/Repositories/IOrderServiceRepository.cs"
click node_order_repository "https://github.com/teo-space/webapitemplate/blob/main/Infrastructure/WebApiTemplate.Infrastructure.Persistence/Repositories/OrderServiceRepository.cs"
click node_store_db_context "https://github.com/teo-space/webapitemplate/blob/main/Infrastructure/WebApiTemplate.Infrastructure.Persistence/EntityFramework/DbContexts/StoreDbContext.cs"
click node_order_entity "https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Domain/Models/Store/Order.cs"
click node_delivery_type "https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Domain/Enums/DeliveryType.cs"
click node_order_mapper "https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Services/Mappers/OrderServiceMapper.cs"
click node_orders_list "https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Output/Models/Orders/OrdersListModel.cs"
click node_order_model "https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Output/Models/Orders/OrderModel.cs"
click node_some_service_contract "https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Interfaces/Infrastructure/Services/ISomeInfrastructureService.cs"
click node_some_service_model "https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Interfaces/Infrastructure/Services/Models/SomeExternalModel.cs"
click node_some_service_impl "https://github.com/teo-space/webapitemplate/blob/main/Infrastructure/WebApiTemplate.Infrastructure.Services/Implementations/SomeInfrastructureService.cs"
click node_persistence_registration "https://github.com/teo-space/webapitemplate/blob/main/Infrastructure/WebApiTemplate.Infrastructure.Persistence/DependencyInjection.cs"
click node_service_registration "https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Services/DependencyInjection.cs"
click node_external_registration "https://github.com/teo-space/webapitemplate/blob/main/Infrastructure/WebApiTemplate.Infrastructure.Services/DependencyInjection.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_order_controller,node_client toneBlue
class node_get_orders_input,node_order_service_contract,node_order_service,node_order_repository_contract,node_order_entity,node_delivery_type,node_order_mapper,node_orders_list,node_order_model,node_service_registration toneAmber
class node_order_repository,node_store_db_context,node_orders_database,node_persistence_registration toneMint
class node_some_service_contract,node_some_service_model,node_some_service_impl,node_external_registration toneRose
```

## Components

### API

- [Order Controller](https://github.com/teo-space/webapitemplate/blob/main/WebApiTemplate.Api/Controllers/OrderController.cs): `WebApiTemplate.Api/Controllers/OrderController.cs`

### Core

- [Orders Input](https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Input/Models/Orders/GetOrdersInput.cs): `Core/WebApiTemplate.Core.Input/Models/Orders/GetOrdersInput.cs`
- [Order Service Contract](https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Interfaces/Services/IOrderService.cs): `Core/WebApiTemplate.Core.Interfaces/Services/IOrderService.cs`
- [Order Service](https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Services/Implementations/OrderService.cs): `Core/WebApiTemplate.Core.Services/Implementations/OrderService.cs`
- [Repository Contract](https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Interfaces/Infrastructure/Repositories/IOrderServiceRepository.cs): `Core/WebApiTemplate.Core.Interfaces/Infrastructure/Repositories/IOrderServiceRepository.cs`
- [Order Entity](https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Domain/Models/Store/Order.cs): `Core/WebApiTemplate.Core.Domain/Models/Store/Order.cs`
- [Delivery Type](https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Domain/Enums/DeliveryType.cs): `Core/WebApiTemplate.Core.Domain/Enums/DeliveryType.cs`
- [Order Mapper](https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Services/Mappers/OrderServiceMapper.cs): `Core/WebApiTemplate.Core.Services/Mappers/OrderServiceMapper.cs`
- [Orders List](https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Output/Models/Orders/OrdersListModel.cs): `Core/WebApiTemplate.Core.Output/Models/Orders/OrdersListModel.cs`
- [Order Output](https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Output/Models/Orders/OrderModel.cs): `Core/WebApiTemplate.Core.Output/Models/Orders/OrderModel.cs`
- [Service Registration](https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Services/DependencyInjection.cs): `Core/WebApiTemplate.Core.Services/DependencyInjection.cs`

### Persistence

- [Order Repository](https://github.com/teo-space/webapitemplate/blob/main/Infrastructure/WebApiTemplate.Infrastructure.Persistence/Repositories/OrderServiceRepository.cs): `Infrastructure/WebApiTemplate.Infrastructure.Persistence/Repositories/OrderServiceRepository.cs`
- [Store Context](https://github.com/teo-space/webapitemplate/blob/main/Infrastructure/WebApiTemplate.Infrastructure.Persistence/EntityFramework/DbContexts/StoreDbContext.cs): `Infrastructure/WebApiTemplate.Infrastructure.Persistence/EntityFramework/DbContexts/StoreDbContext.cs`
- **Orders Database**
- [Persistence Registration](https://github.com/teo-space/webapitemplate/blob/main/Infrastructure/WebApiTemplate.Infrastructure.Persistence/DependencyInjection.cs): `Infrastructure/WebApiTemplate.Infrastructure.Persistence/DependencyInjection.cs`

### External Services

- [External Service Contract](https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Interfaces/Infrastructure/Services/ISomeInfrastructureService.cs): `Core/WebApiTemplate.Core.Interfaces/Infrastructure/Services/ISomeInfrastructureService.cs`
- [External Result Model](https://github.com/teo-space/webapitemplate/blob/main/Core/WebApiTemplate.Core.Interfaces/Infrastructure/Services/Models/SomeExternalModel.cs): `Core/WebApiTemplate.Core.Interfaces/Infrastructure/Services/Models/SomeExternalModel.cs`
- [External Service Stub](https://github.com/teo-space/webapitemplate/blob/main/Infrastructure/WebApiTemplate.Infrastructure.Services/Implementations/SomeInfrastructureService.cs): `Infrastructure/WebApiTemplate.Infrastructure.Services/Implementations/SomeInfrastructureService.cs`
- [External Registration](https://github.com/teo-space/webapitemplate/blob/main/Infrastructure/WebApiTemplate.Infrastructure.Services/DependencyInjection.cs): `Infrastructure/WebApiTemplate.Infrastructure.Services/DependencyInjection.cs`

### Other components

- **API Client**

## Connections

- API Client → Order Controller: requests orders (evidence: `README.md`)
- Order Controller → Orders Input: accepts input (evidence: `WebApiTemplate.Api/Controllers/OrderController.cs`)
- Order Controller → Order Service Contract: calls service (evidence: `WebApiTemplate.Api/Controllers/OrderController.cs`)
- Service Registration → Order Service Contract: registers implementation (evidence: `Core/WebApiTemplate.Core.Services/DependencyInjection.cs`)
- Service Registration → Order Service: registers implementation (evidence: `Core/WebApiTemplate.Core.Services/DependencyInjection.cs`)
- Order Service → Repository Contract: fetches orders (evidence: `Core/WebApiTemplate.Core.Services/Implementations/OrderService.cs`)
- Order Service → Order Mapper: maps orders (evidence: `Core/WebApiTemplate.Core.Services/Implementations/OrderService.cs`)
- Order Service → Orders List: builds response (evidence: `Core/WebApiTemplate.Core.Services/Implementations/OrderService.cs`)
- Order Repository → Store Context: queries orders (evidence: `Infrastructure/WebApiTemplate.Infrastructure.Persistence/Repositories/OrderServiceRepository.cs`)
- Store Context → Orders Database: reads orders
- Persistence Registration → Repository Contract: registers implementation (evidence: `Infrastructure/WebApiTemplate.Infrastructure.Persistence/DependencyInjection.cs`)
- Persistence Registration → Order Repository: registers implementation (evidence: `Infrastructure/WebApiTemplate.Infrastructure.Persistence/DependencyInjection.cs`)
- Order Repository → Order Entity: returns entities (evidence: `Infrastructure/WebApiTemplate.Infrastructure.Persistence/Repositories/OrderServiceRepository.cs`)
- Order Mapper → Order Entity: maps from (evidence: `Core/WebApiTemplate.Core.Services/Mappers/OrderServiceMapper.cs`)
- Order Mapper → Order Output: maps to (evidence: `Core/WebApiTemplate.Core.Services/Mappers/OrderServiceMapper.cs`)
- Order Output → Delivery Type: uses enum (evidence: `Core/WebApiTemplate.Core.Output/Models/Orders/OrderModel.cs`)
- Orders List → Order Output: contains models (evidence: `Core/WebApiTemplate.Core.Output/Models/Orders/OrdersListModel.cs`)
- Order Entity → Delivery Type: uses enum (evidence: `Core/WebApiTemplate.Core.Domain/Models/Store/Order.cs`)
- External Registration → External Service Contract: registers implementation (evidence: `Infrastructure/WebApiTemplate.Infrastructure.Services/DependencyInjection.cs`)
- External Registration → External Service Stub: registers implementation (evidence: `Infrastructure/WebApiTemplate.Infrastructure.Services/DependencyInjection.cs`)
- External Service Stub → External Service Contract: implements contract (evidence: `Infrastructure/WebApiTemplate.Infrastructure.Services/Implementations/SomeInfrastructureService.cs`)
- External Service Stub → External Result Model: returns model (evidence: `Infrastructure/WebApiTemplate.Infrastructure.Services/Implementations/SomeInfrastructureService.cs`)
- External Service Contract → External Result Model: returns model (evidence: `Core/WebApiTemplate.Core.Interfaces/Infrastructure/Services/ISomeInfrastructureService.cs`)
