# doddatpivotal/dotnet-hello-world architecture

> Architecture diagram of the GitHub repository doddatpivotal/dotnet-hello-world, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/doddatpivotal/dotnet-hello-world
- Repository: https://github.com/doddatpivotal/dotnet-hello-world

## Overview

##### Project type and purpose
- This is a single‑service .NET Core Web API (“hello-world-api”) whose sole responsibility is to respond to HTTP GET requests at /api/hello with a “Hello World” payload.
- It can run locally on Kestrel (via `dotnet run`) or be deployed to Cloud Foundry (manifest.yml).

##### File structure
- Top‑level solution file: dotnet-hello-world.sln
- Single project folder: hello-world-api
- Controllers/HelloController.cs – defines the API endpoint
- Program.cs – host bootstrapping (Kestrel)
- Startup.cs – middleware configuration, routing, DI
- appsettings.json & appsettings.Development.json – configuration sources
- Properties/launchSettings.json – local launch profiles
- hello-world-api.csproj – NuGet dependencies, target framework
- manifest.yml – Cloud Foundry deployment descriptor

##### Extract additional insights from the README
- Running locally binds to localhost:5000
- On Cloud Foundry, a Gorouter routes external HTTP traffic to the instance as defined in manifest.yml

a. Main components
- Client (e.g., Browser or HTTP client)
- HTTP Router/Load Balancer (Cloud Foundry Gorouter or local reverse proxy)
- hello‑world‑api Service
- Kestrel Web Server
- Startup + Middleware Pipeline
- HelloController
- Configuration store (appsettings.json + environment overrides)
- Cloud Foundry Platform (optional)

b. Relationships & interactions
1. Client issues HTTP GET to /api/hello
2. Request flows through the CF Gorouter (in CF deployment) or directly to Kestrel (local)
3. Kestrel invokes Startup middleware, then routes to HelloController
4. Controller returns “Hello World” response to client
5. Configuration values (ports, logs) are loaded from appsettings or CF environment variables

c. Architectural patterns & principles
- Single‑responsibility microservice
- Convention‑based routing in ASP.NET Core
- Externalized configuration (12‑factor app)
- Dependency injection via Startup.cs

d. Key technologies & frameworks
- .NET Core / ASP.NET Core
- Kestrel HTTP server
- ASP.NET Core MVC (Controller)
- JSON configuration providers
- Cloud Foundry buildpack & Gorouter

##### Detail
- That Startup.ConfigureServices sets up MVC services and DI
- That appsettings.Development.json is only used under the Development environment

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Entities
    Client["Browser or HTTP Client"]:::external
    CF["Cloud Foundry Platform<br/>(Gorouter & Diego)"]:::external

    %% Configuration Files
    ConfigJSON["appsettings.json"]:::config
    ConfigDev["appsettings.Development.json"]:::config
    Launch["launchSettings.json"]:::config

    %% Documentation & Deployment
    Sln["dotnet-hello-world.sln"]:::doc
    Manifest["manifest.yml"]:::doc
    Readme["Readme.md"]:::doc

    %% Service and Internal Components
    subgraph "hello-world-api Service" 
        direction TB
        Kestrel["Kestrel Web Server<br/>(listens on port 5000)"]:::service
        Startup["Startup + Middleware Pipeline<br/>(configures DI & MVC)"]:::service
        Controller["HelloController<br/>(handles /api/hello)"]:::service
    end

    %% Request Flows
    Client -->|HTTP GET /api/hello| CF
    CF -->|HTTP GET /api/hello| Kestrel
    Client -->|HTTP GET /api/hello| Kestrel

    Kestrel -->|invokes| Startup
    Startup -->|routes to| Controller
    Controller -->|HTTP 200 OK Hello World| Client

    %% Configuration Loading
    ConfigJSON --> Startup
    ConfigDev --> Startup
    Launch --> Startup

    %% Solution & Deployment Links
    Sln --> Kestrel
    Manifest --> CF
    Readme --> Sln

    %% Click Events
    click Kestrel "https://github.com/doddatpivotal/dotnet-hello-world/blob/master/hello-world-api/Program.cs"
    click Startup "https://github.com/doddatpivotal/dotnet-hello-world/blob/master/hello-world-api/Startup.cs"
    click Controller "https://github.com/doddatpivotal/dotnet-hello-world/blob/master/hello-world-api/Controllers/HelloController.cs"
    click ConfigJSON "https://github.com/doddatpivotal/dotnet-hello-world/blob/master/hello-world-api/appsettings.json"
    click ConfigDev "https://github.com/doddatpivotal/dotnet-hello-world/blob/master/hello-world-api/appsettings.Development.json"
    click Launch "https://github.com/doddatpivotal/dotnet-hello-world/blob/master/hello-world-api/Properties/launchSettings.json"
    click Sln "https://github.com/doddatpivotal/dotnet-hello-world/blob/master/dotnet-hello-world.sln"
    click Manifest "https://github.com/doddatpivotal/dotnet-hello-world/blob/master/manifest.yml"
    click Readme "https://github.com/doddatpivotal/dotnet-hello-world/blob/master/Readme.md"

    %% Styles
    classDef external fill:#c2f0c2,stroke:#2e7d32,color:#000
    classDef service fill:#aed6f1,stroke:#1b4f72,color:#000
    classDef config fill:#fcf3cf,stroke:#b7950b,color:#000
    classDef doc fill:#d5dbdb,stroke:#424949,color:#000
```
