# mehmetozkaya/adrwriteragent architecture

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

- Interactive diagram: https://gitdiagram.com/mehmetozkaya/adrwriteragent
- Repository: https://github.com/mehmetozkaya/adrwriteragent

## Overview

#### Purpose and entry points
ADR Writer Agent converts free-form technical meeting notes into standardized Markdown Architecture Decision Records using Azure OpenAI. The Aspire host is the intended startup boundary: `src/ADRWriter.AppHost/AppHost.cs`. It composes the Blazor frontend and ASP.NET Core API. Individual service entry points are `src/ADRWriter.Web/Program.cs` and `src/ADRWriter.ApiService/Program.cs`.

#### Aspire composition and service boundary
`ADRWriter.AppHost` is the deployment/dev orchestration layer, responsible for launching and wiring services through Aspire service discovery. Shared cross-cutting defaults—telemetry, HTTP resilience, health-related conventions—belong in `src/ADRWriter.ServiceDefaults/Extensions.cs` and are consumed by the API and web projects. Azure OpenAI endpoint and API key are externalized through configuration/user secrets rather than embedded in application code.

Paths:
- `src/ADRWriter.AppHost/AppHost.cs`
- `src/ADRWriter.ServiceDefaults/Extensions.cs`
- `src/ADRWriter.AppHost/appsettings.json`

#### Blazor user workflow
The Blazor Web application presents the ADR authoring experience. Its route/component structure establishes the UI shell, while the ADR page accepts raw notes, submits them, and displays the returned ADR for review. The UI should remain a client boundary: it delegates generation rather than directly accessing Azure OpenAI.

Paths:
- `src/ADRWriter.Web/Components/Pages/AdrWriterPage.razor`
- `src/ADRWriter.Web/Components/App.razor`
- `src/ADRWriter.Web/Components/Routes.razor`

#### Frontend-to-API integration
`ADRWriterApiClient` encapsulates calls from Blazor to the API, isolating endpoint addressing, request serialization, and response handling from Razor components. This is the principal browser/server application boundary and relies on Aspire-provided discovery/configuration rather than a hard-coded service topology.

Paths:
- `src/ADRWriter.Web/ApiClients/ADRWriterApiClient.cs`
- `src/ADRWriter.Web/Program.cs`
- `src/ADRWriter.ApiService/Endpoints/ADRWriterEndpoints.cs`

#### API request and agent orchestration
The ASP.NET Core API exposes the ADR-generation HTTP endpoint and routes each request into the domain service. `ADRWriterEndpoints` is the transport boundary; `ADRWriterService` owns the agent execution flow: turning supplied notes into a prompt, invoking the Microsoft Agent Framework/Azure OpenAI-backed agent, applying ADR templating behavior, and returning Markdown. This separation keeps HTTP concerns out of AI orchestration.

Paths:
- `src/ADRWriter.ApiService/Program.cs`
- `src/ADRWriter.ApiService/Endpoints/ADRWriterEndpoints.cs`
- `src/ADRWriter.ApiService/Services/ADRWriterService.cs`

#### External AI and output boundary
Azure OpenAI is the system’s reasoning provider, accessed from the API via Azure AI OpenAI and Microsoft Agent Framework integration. The primary output contract is generated Markdown, which flows API → API client → Blazor page. Markdig is the material rendering dependency for presenting Markdown safely/formatted in the UI. No persistence layer or message broker is represented in this repository.

#### Runtime and operational model
All projects target the .NET ecosystem (README specifies .NET 10). ASP.NET Core hosts the API; Blazor hosts the user-facing application; .NET Aspire coordinates local/service execution and exposes its dashboard. OpenTelemetry instrumentation and resilient HTTP behavior are centralized through ServiceDefaults, covering the important API-to-Azure-OpenAI dependency boundary.

Paths:
- `src/ADRWriter.ApiService/ADRWriter.ApiService.csproj`
- `src/ADRWriter.Web/ADRWriter.Web.csproj`
- `src/ADRWriter.ServiceDefaults/ADRWriter.ServiceDefaults.csproj`

Main entry points: [`src/ADRWriter.AppHost/AppHost.cs`](https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.AppHost/AppHost.cs) (Aspire AppHost), [`src/ADRWriter.Web/Components/Pages/AdrWriterPage.razor`](https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.Web/Components/Pages/AdrWriterPage.razor) (ADR writer page), [`src/ADRWriter.Web/ApiClients/ADRWriterApiClient.cs`](https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.Web/ApiClients/ADRWriterApiClient.cs) (ADR Writer API client), [`src/ADRWriter.ServiceDefaults/Extensions.cs`](https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.ServiceDefaults/Extensions.cs) (Service defaults)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Aspire orchestration"]
  node_apphost{{"Aspire AppHost<br/>orchestrator<br/>[AppHost.cs]"}}
  node_apphost_config["AppHost configuration<br/>[appsettings.json]"]
  node_service_defaults["Service defaults<br/>cross-cutting defaults<br/>[Extensions.cs]"]
  node_aspire_dashboard["Aspire dashboard<br/>operations UI"]
end

subgraph group_web["Blazor web"]
  node_web_host["Blazor host<br/>web runtime<br/>[Program.cs]"]
  node_ui_shell["UI shell and routes<br/>Blazor components<br/>[App.razor]"]
  node_adr_page["ADR writer page<br/>Blazor page"]
  node_api_client["ADR Writer API client<br/>HTTP client"]
  node_markdown_renderer["Markdig renderer<br/>Markdown rendering"]
end

subgraph group_api["API and agent"]
  node_api_host["API host<br/>ASP.NET Core runtime<br/>[Program.cs]"]
  node_adr_endpoints["ADR generation endpoint<br/>HTTP transport"]
  node_adr_service["ADR writer service<br/>agent orchestration"]
  node_agent_framework["Microsoft Agent Framework<br/>AI integration"]
end

subgraph group_external["External services"]
  node_azure_openai{{"Azure OpenAI<br/>reasoning provider"}}
  node_secrets["Endpoint and API key<br/>external configuration"]
end

node_apphost -->|"launches"| node_web_host
node_apphost -->|"launches"| node_api_host
node_apphost_config -->|"configures"| node_apphost
node_apphost -->|"exposes"| node_aspire_dashboard
node_service_defaults -->|"applies defaults"| node_web_host
node_service_defaults -->|"applies defaults"| node_api_host
node_web_host -->|"hosts"| node_ui_shell
node_ui_shell -->|"routes to"| node_adr_page
node_adr_page -->|"submits notes"| node_api_client
node_api_client -->|"generation request"| node_adr_endpoints
node_api_host -->|"maps"| node_adr_endpoints
node_adr_endpoints -->|"delegates"| node_adr_service
node_adr_service -->|"invokes"| node_agent_framework
node_agent_framework -->|"uses"| node_azure_openai
node_secrets -.->|"configures access"| node_azure_openai
node_service_defaults -.->|"telemetry and resilient HTTP"| node_azure_openai
node_adr_service -->|"ADR Markdown response"| node_api_client
node_api_client -->|"returns Markdown"| node_adr_page
node_adr_page -->|"renders"| node_markdown_renderer

click node_apphost "https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.AppHost/AppHost.cs"
click node_apphost_config "https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.AppHost/appsettings.json"
click node_service_defaults "https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.ServiceDefaults/Extensions.cs"
click node_web_host "https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.Web/Program.cs"
click node_ui_shell "https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.Web/Components/App.razor"
click node_adr_page "https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.Web/Components/Pages/AdrWriterPage.razor"
click node_api_client "https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.Web/ApiClients/ADRWriterApiClient.cs"
click node_api_host "https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.ApiService/Program.cs"
click node_adr_endpoints "https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.ApiService/Endpoints/ADRWriterEndpoints.cs"
click node_adr_service "https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.ApiService/Services/ADRWriterService.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_apphost,node_apphost_config,node_service_defaults,node_aspire_dashboard toneBlue
class node_web_host,node_ui_shell,node_adr_page,node_api_client,node_markdown_renderer toneAmber
class node_api_host,node_adr_endpoints,node_adr_service,node_agent_framework toneMint
class node_azure_openai,node_secrets toneRose
```

## Components

### Aspire orchestration

- [Aspire AppHost](https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.AppHost/AppHost.cs): orchestrator · Composes and launches the web and API services. · `src/ADRWriter.AppHost/AppHost.cs`
- [AppHost configuration](https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.AppHost/appsettings.json): configuration · Provides orchestration-time settings. · `src/ADRWriter.AppHost/appsettings.json`
- [Service defaults](https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.ServiceDefaults/Extensions.cs): cross-cutting defaults · Centralizes telemetry, resilience, and health conventions. · `src/ADRWriter.ServiceDefaults/Extensions.cs`
- **Aspire dashboard**: operations UI · Observes composed local services and telemetry.

### Blazor web

- [Blazor host](https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.Web/Program.cs): web runtime · `src/ADRWriter.Web/Program.cs`
- [UI shell and routes](https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.Web/Components/App.razor): Blazor components · `src/ADRWriter.Web/Components/App.razor`
- [ADR writer page](https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.Web/Components/Pages/AdrWriterPage.razor): Blazor page · Accepts meeting notes and presents the generated ADR. · `src/ADRWriter.Web/Components/Pages/AdrWriterPage.razor`
- [ADR Writer API client](https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.Web/ApiClients/ADRWriterApiClient.cs): HTTP client · Encapsulates API addressing, serialization, and response handling. · `src/ADRWriter.Web/ApiClients/ADRWriterApiClient.cs`
- **Markdig renderer**: Markdown rendering · Formats generated Markdown for review in the UI.

### API and agent

- [API host](https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.ApiService/Program.cs): ASP.NET Core runtime · `src/ADRWriter.ApiService/Program.cs`
- [ADR generation endpoint](https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.ApiService/Endpoints/ADRWriterEndpoints.cs): HTTP transport · Receives generation requests and delegates to the domain service. · `src/ADRWriter.ApiService/Endpoints/ADRWriterEndpoints.cs`
- [ADR writer service](https://github.com/mehmetozkaya/adrwriteragent/blob/main/src/ADRWriter.ApiService/Services/ADRWriterService.cs): agent orchestration · Builds prompts, executes the agent, and returns templated ADR Markdown. · `src/ADRWriter.ApiService/Services/ADRWriterService.cs`
- **Microsoft Agent Framework**: AI integration · Connects agent execution to the Azure OpenAI provider.

### External services

- **Azure OpenAI**: reasoning provider · External AI service used to generate ADR content.
- **Endpoint and API key**: external configuration · Azure OpenAI credentials are supplied through configuration or user secrets.

## Connections

- Aspire AppHost → Blazor host: launches
- Aspire AppHost → API host: launches
- AppHost configuration → Aspire AppHost: configures
- Aspire AppHost → Aspire dashboard: exposes
- Service defaults → Blazor host: applies defaults
- Service defaults → API host: applies defaults
- Blazor host → UI shell and routes: hosts
- UI shell and routes → ADR writer page: routes to
- ADR writer page → ADR Writer API client: submits notes
- ADR Writer API client → ADR generation endpoint: generation request · Uses Aspire service discovery.
- API host → ADR generation endpoint: maps
- ADR generation endpoint → ADR writer service: delegates
- ADR writer service → Microsoft Agent Framework: invokes
- Microsoft Agent Framework → Azure OpenAI: uses
- Endpoint and API key → Azure OpenAI: configures access
- Service defaults → Azure OpenAI: telemetry and resilient HTTP
- ADR writer service → ADR Writer API client: ADR Markdown response
- ADR Writer API client → ADR writer page: returns Markdown
- ADR writer page → Markdig renderer: renders
