# batman5227/todoapihexagonal architecture

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

- Interactive diagram: https://gitdiagram.com/batman5227/todoapihexagonal
- Repository: https://github.com/batman5227/todoapihexagonal

## Overview

TodoApi is an ASP.NET Core service for managing todo items. An API client sends requests to the todos controller, which accepts request data and delegates operations through the todo-service interface to its implementation. The service reads and changes todo entities through Entity Framework Core, configured for the SQLite database `todo.db`. The API supports listing with a filter, create, update, mark done/undone, toggle all, and delete operations. Program.cs also registers OpenAPI and Scalar endpoints; the excerpts establish this wiring but do not show their detailed behavior.

Main entry points: [`Program.cs`](https://github.com/batman5227/todoapihexagonal/blob/main/Program.cs) (Application host), [`Controllers/TodosController.cs`](https://github.com/batman5227/todoapihexagonal/blob/main/Controllers/TodosController.cs) (Todos controller), [`Service/TodoService.cs`](https://github.com/batman5227/todoapihexagonal/blob/main/Service/TodoService.cs) (Todo operations), [`Data/TodoDbContext.cs`](https://github.com/batman5227/todoapihexagonal/blob/main/Data/TodoDbContext.cs) (EF data context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_controller["Todos controller<br/>[TodosController.cs]"]
  node_dto["Todo request DTO<br/>[TodoDto.cs]"]
  node_host["Application host<br/>[Program.cs]"]
  node_api_reference["API reference endpoints<br/>[Program.cs]"]
end

subgraph group_logic["Todo Logic"]
  node_service_contract["Todo service contract<br/>[ITodoService.cs]"]
  node_service["Todo operations<br/>[TodoService.cs]"]
end

subgraph group_storage["Persistence"]
  node_context["EF data context<br/>[TodoDbContext.cs]"]
  node_entity["Todo entity<br/>[TodoItem.cs]"]
  node_database[("SQLite database<br/>[todo.db]")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_controller
node_controller -->|"accepts body"| node_dto
node_controller -->|"calls operations"| node_service_contract
node_host -->|"maps controllers"| node_controller
node_host -->|"registers implementation"| node_service_contract
node_host -->|"registers implementation"| node_service
node_service -->|"queries and saves"| node_context
node_context -->|"maps entity"| node_entity
node_host -->|"configures SQLite"| node_database
node_host -->|"maps OpenAPI UI"| node_api_reference

click node_controller "https://github.com/batman5227/todoapihexagonal/blob/main/Controllers/TodosController.cs"
click node_dto "https://github.com/batman5227/todoapihexagonal/blob/main/DTOs/TodoDto.cs"
click node_host "https://github.com/batman5227/todoapihexagonal/blob/main/Program.cs"
click node_service_contract "https://github.com/batman5227/todoapihexagonal/blob/main/ITodoService.cs"
click node_service "https://github.com/batman5227/todoapihexagonal/blob/main/Service/TodoService.cs"
click node_context "https://github.com/batman5227/todoapihexagonal/blob/main/Data/TodoDbContext.cs"
click node_entity "https://github.com/batman5227/todoapihexagonal/blob/main/Models/TodoItem.cs"
click node_database "https://github.com/batman5227/todoapihexagonal/blob/main/todo.db"
click node_api_reference "https://github.com/batman5227/todoapihexagonal/blob/main/Program.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_controller,node_dto,node_host,node_api_reference,node_client toneBlue
class node_service_contract,node_service toneAmber
class node_context,node_entity,node_database toneMint
```

## Components

### HTTP API

- [Todos controller](https://github.com/batman5227/todoapihexagonal/blob/main/Controllers/TodosController.cs): `Controllers/TodosController.cs`
- [Todo request DTO](https://github.com/batman5227/todoapihexagonal/blob/main/DTOs/TodoDto.cs): `DTOs/TodoDto.cs`
- [Application host](https://github.com/batman5227/todoapihexagonal/blob/main/Program.cs): `Program.cs`
- [API reference endpoints](https://github.com/batman5227/todoapihexagonal/blob/main/Program.cs): `Program.cs`

### Todo Logic

- [Todo service contract](https://github.com/batman5227/todoapihexagonal/blob/main/ITodoService.cs): `ITodoService.cs`
- [Todo operations](https://github.com/batman5227/todoapihexagonal/blob/main/Service/TodoService.cs): `Service/TodoService.cs`

### Persistence

- [EF data context](https://github.com/batman5227/todoapihexagonal/blob/main/Data/TodoDbContext.cs): `Data/TodoDbContext.cs`
- [Todo entity](https://github.com/batman5227/todoapihexagonal/blob/main/Models/TodoItem.cs): `Models/TodoItem.cs`
- [SQLite database](https://github.com/batman5227/todoapihexagonal/blob/main/todo.db): `todo.db`

### Other components

- **API client**

## Connections

- API client → Todos controller: sends requests (evidence: `Controllers/TodosController.cs`)
- Todos controller → Todo request DTO: accepts body (evidence: `Controllers/TodosController.cs`)
- Todos controller → Todo service contract: calls operations (evidence: `Controllers/TodosController.cs`)
- Application host → Todos controller: maps controllers (evidence: `Program.cs`)
- Application host → Todo service contract: registers implementation (evidence: `Program.cs`)
- Application host → Todo operations: registers implementation (evidence: `Program.cs`)
- Todo operations → EF data context: queries and saves (evidence: `Service/TodoService.cs`)
- EF data context → Todo entity: maps entity (evidence: `Data/TodoDbContext.cs`)
- Application host → SQLite database: configures SQLite (evidence: `Program.cs`)
- Application host → API reference endpoints: maps OpenAPI UI (evidence: `Program.cs`)
