# loulakisioannis/dotnethub architecture

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

- Interactive diagram: https://gitdiagram.com/loulakisioannis/dotnethub
- Repository: https://github.com/loulakisioannis/dotnethub

## Overview

DotNetHub is an authenticated ASP.NET Core search API that concurrently queries NuGet, GitHub, and Stack Overflow, then filters, sorts, and pages a merged response. A per-source cache provides fresh and stale fallback results; outbound HTTP calls are protected by resilience policies and measured for API statistics. Statistics also feed an optional background anomaly check. The main search and instrumentation paths are shown from excerpts and README statements; unsampled registration and provider wiring is included only where documented.

Main entry points: [`src/DotNetHub.Api/Search/SearchController.cs`](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Search/SearchController.cs) (Search endpoint), [`src/DotNetHub.Api/Caching/CachingSearchProvider.cs`](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Caching/CachingSearchProvider.cs) (Fresh and stale cache), [`src/DotNetHub.Api/Providers/SearchProviderRegistration.cs`](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Providers/SearchProviderRegistration.cs) (Provider registration), [`src/DotNetHub.Api/Program.cs`](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Program.cs) (Application setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_search["Search workflow"]
  node_search_controller["Search endpoint"]
  node_aggregator["Search aggregator"]
  node_merger["Filter and merge<br/>[ResultMerger.cs]"]
  node_search_response["Search response<br/>[SearchResponse.cs]"]
  node_source_summary["Source summaries<br/>[SourceSummary.cs]"]
end

subgraph group_sources["Search sources"]
  node_cache[("Fresh and stale cache")]
  node_nuget["NuGet provider<br/>[NuGetProvider.cs]"]
  node_github["GitHub provider<br/>[GitHubProvider.cs]"]
  node_stackoverflow["Stack Overflow provider"]
  node_nuget_api{{"NuGet API"}}
  node_github_api{{"GitHub API"}}
  node_stack_api{{"Stack Exchange API"}}
  node_registration["Provider registration"]
end

subgraph group_operations["Reliability and metrics"]
  node_resilience["HTTP resilience"]
  node_statistics_handler["HTTP statistics handler"]
  node_statistics_store[("Statistics store")]
  node_statistics_endpoint["Statistics endpoint"]
  node_anomaly_service["Anomaly background service"]
  node_anomaly_detector["Performance detector"]
end

subgraph group_hosting["API hosting"]
  node_host["Application setup<br/>[Program.cs]"]
  node_auth["Bearer authentication"]
end

node_client(("API client"))

node_client -->|"requests search"| node_search_controller
node_search_controller -->|"fetches sources"| node_aggregator
node_search_controller -->|"filters and sorts"| node_merger
node_search_controller -->|"constructs response"| node_search_response
node_search_controller -->|"summarizes sources"| node_source_summary
node_aggregator -->|"queries selected sources"| node_cache
node_cache -->|"delegates on miss"| node_nuget
node_cache -->|"delegates on miss"| node_github
node_cache -->|"delegates on miss"| node_stackoverflow
node_nuget -->|"searches packages"| node_nuget_api
node_github -->|"searches repositories"| node_github_api
node_stackoverflow -->|"searches questions"| node_stack_api
node_host -->|"registers providers"| node_registration
node_registration -->|"wraps providers"| node_cache
node_registration -->|"configures policies"| node_resilience
node_registration -->|"adds handler"| node_statistics_handler
node_statistics_handler -->|"records duration"| node_statistics_store
node_client -->|"requests statistics"| node_statistics_endpoint
node_statistics_endpoint -->|"reads snapshot"| node_statistics_store
node_host -->|"starts background check"| node_anomaly_service
node_anomaly_service -->|"reads totals"| node_statistics_store
node_anomaly_service -->|"checks performance"| node_anomaly_detector
node_host -->|"configures bearer scheme"| node_auth
node_auth -->|"documents bearer auth"| node_search_controller

click node_search_controller "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Search/SearchController.cs"
click node_aggregator "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Aggregation/SearchAggregator.cs"
click node_merger "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Aggregation/ResultMerger.cs"
click node_search_response "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Search/SearchResponse.cs"
click node_source_summary "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Search/SourceSummary.cs"
click node_cache "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Caching/CachingSearchProvider.cs"
click node_nuget "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Providers/NuGet/NuGetProvider.cs"
click node_github "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Providers/GitHub/GitHubProvider.cs"
click node_stackoverflow "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Providers/StackExchange/StackExchangeProvider.cs"
click node_registration "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Providers/SearchProviderRegistration.cs"
click node_resilience "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Providers/SearchProviderResilience.cs"
click node_statistics_handler "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Statistics/StatisticsHandler.cs"
click node_statistics_store "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Statistics/RequestStatisticsStore.cs"
click node_statistics_endpoint "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Statistics/StatisticsController.cs"
click node_anomaly_service "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/AnomalyDetection/AnomalyDetectionService.cs"
click node_anomaly_detector "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/AnomalyDetection/PerformanceAnomalyDetector.cs"
click node_host "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Program.cs"
click node_auth "https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Authentication/BearerSecuritySchemeTransformer.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_search_controller,node_aggregator,node_merger,node_search_response,node_source_summary,node_client toneBlue
class node_cache,node_nuget,node_github,node_stackoverflow,node_nuget_api,node_github_api,node_stack_api,node_registration toneAmber
class node_resilience,node_statistics_handler,node_statistics_store,node_statistics_endpoint,node_anomaly_service,node_anomaly_detector toneMint
class node_host,node_auth toneRose
```

## Components

### Search workflow

- [Search endpoint](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Search/SearchController.cs): `src/DotNetHub.Api/Search/SearchController.cs`
- [Search aggregator](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Aggregation/SearchAggregator.cs): `src/DotNetHub.Api/Aggregation/SearchAggregator.cs`
- [Filter and merge](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Aggregation/ResultMerger.cs): `src/DotNetHub.Api/Aggregation/ResultMerger.cs`
- [Search response](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Search/SearchResponse.cs): `src/DotNetHub.Api/Search/SearchResponse.cs`
- [Source summaries](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Search/SourceSummary.cs): `src/DotNetHub.Api/Search/SourceSummary.cs`

### Search sources

- [Fresh and stale cache](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Caching/CachingSearchProvider.cs): `src/DotNetHub.Api/Caching/CachingSearchProvider.cs`
- [NuGet provider](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Providers/NuGet/NuGetProvider.cs): `src/DotNetHub.Api/Providers/NuGet/NuGetProvider.cs`
- [GitHub provider](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Providers/GitHub/GitHubProvider.cs): `src/DotNetHub.Api/Providers/GitHub/GitHubProvider.cs`
- [Stack Overflow provider](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Providers/StackExchange/StackExchangeProvider.cs): `src/DotNetHub.Api/Providers/StackExchange/StackExchangeProvider.cs`
- **NuGet API**
- **GitHub API**
- **Stack Exchange API**
- [Provider registration](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Providers/SearchProviderRegistration.cs): `src/DotNetHub.Api/Providers/SearchProviderRegistration.cs`

### Reliability and metrics

- [HTTP resilience](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Providers/SearchProviderResilience.cs): `src/DotNetHub.Api/Providers/SearchProviderResilience.cs`
- [HTTP statistics handler](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Statistics/StatisticsHandler.cs): `src/DotNetHub.Api/Statistics/StatisticsHandler.cs`
- [Statistics store](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Statistics/RequestStatisticsStore.cs): `src/DotNetHub.Api/Statistics/RequestStatisticsStore.cs`
- [Statistics endpoint](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Statistics/StatisticsController.cs): `src/DotNetHub.Api/Statistics/StatisticsController.cs`
- [Anomaly background service](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/AnomalyDetection/AnomalyDetectionService.cs): `src/DotNetHub.Api/AnomalyDetection/AnomalyDetectionService.cs`
- [Performance detector](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/AnomalyDetection/PerformanceAnomalyDetector.cs): `src/DotNetHub.Api/AnomalyDetection/PerformanceAnomalyDetector.cs`

### API hosting

- [Application setup](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Program.cs): `src/DotNetHub.Api/Program.cs`
- [Bearer authentication](https://github.com/loulakisioannis/dotnethub/blob/main/src/DotNetHub.Api/Authentication/BearerSecuritySchemeTransformer.cs): `src/DotNetHub.Api/Authentication/BearerSecuritySchemeTransformer.cs`

### Other components

- **API client**

## Connections

- API client → Search endpoint: requests search (evidence: `src/DotNetHub.Api/Search/SearchController.cs`)
- Search endpoint → Search aggregator: fetches sources (evidence: `src/DotNetHub.Api/Search/SearchController.cs`)
- Search endpoint → Filter and merge: filters and sorts (evidence: `src/DotNetHub.Api/Search/SearchController.cs`)
- Search endpoint → Search response: constructs response (evidence: `src/DotNetHub.Api/Search/SearchController.cs`)
- Search endpoint → Source summaries: summarizes sources (evidence: `src/DotNetHub.Api/Search/SearchController.cs`)
- Search aggregator → Fresh and stale cache: queries selected sources
- Fresh and stale cache → NuGet provider: delegates on miss (evidence: `src/DotNetHub.Api/Caching/CachingSearchProvider.cs`)
- Fresh and stale cache → GitHub provider: delegates on miss (evidence: `src/DotNetHub.Api/Caching/CachingSearchProvider.cs`)
- Fresh and stale cache → Stack Overflow provider: delegates on miss (evidence: `src/DotNetHub.Api/Caching/CachingSearchProvider.cs`)
- NuGet provider → NuGet API: searches packages
- GitHub provider → GitHub API: searches repositories
- Stack Overflow provider → Stack Exchange API: searches questions
- Application setup → Provider registration: registers providers (evidence: `src/DotNetHub.Api/Program.cs`)
- Provider registration → Fresh and stale cache: wraps providers (evidence: `src/DotNetHub.Api/Providers/SearchProviderRegistration.cs`)
- Provider registration → HTTP resilience: configures policies
- Provider registration → HTTP statistics handler: adds handler (evidence: `src/DotNetHub.Api/Providers/SearchProviderRegistration.cs`)
- HTTP statistics handler → Statistics store: records duration (evidence: `src/DotNetHub.Api/Statistics/StatisticsHandler.cs`)
- API client → Statistics endpoint: requests statistics
- Statistics endpoint → Statistics store: reads snapshot (evidence: `src/DotNetHub.Api/Statistics/StatisticsController.cs`)
- Application setup → Anomaly background service: starts background check (evidence: `src/DotNetHub.Api/Program.cs`)
- Anomaly background service → Statistics store: reads totals (evidence: `src/DotNetHub.Api/AnomalyDetection/AnomalyDetectionService.cs`)
- Anomaly background service → Performance detector: checks performance (evidence: `src/DotNetHub.Api/AnomalyDetection/AnomalyDetectionService.cs`)
- Application setup → Bearer authentication: configures bearer scheme (evidence: `src/DotNetHub.Api/Program.cs`)
- Bearer authentication → Search endpoint: documents bearer auth
