# vishwasure555/newrepo-dotnet architecture

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

- Interactive diagram: https://gitdiagram.com/vishwasure555/newrepo-dotnet
- Repository: https://github.com/vishwasure555/newrepo-dotnet

## Overview

##### Project type & purpose (from tree + README)
This repo is a **single-service ASP.NET Core (.NET 6) Razor Pages web application** (“dotnet-folder”), packaged and deployed as a **container** into **Kubernetes**, with **CI/CD** via **GitHub Actions** and/or **Azure Pipelines**. It includes:
- UI layer: Razor Pages (`Pages/**`) + static assets (`wwwroot/**`)
- App host: `Program.cs`, `dotnet-folder.csproj`, `appsettings*.json`
- Containerization: `Dockerfile`, `entrypoint.sh`, `backendentrypoint.sh`
- K8s deployment manifests: `k8s/**` (Deployment/Service/Ingress/Namespace/etc.)
- Helm values for monitoring: `helm/monitoring-values.yaml`
- Observability: `k8s/servicemonitor.yaml`, `monitoring/grafana-ingress.yaml`
- Secrets integration: `k8s/secretproviderclass.yaml` strongly suggests **Secrets Store CSI Driver** (often Azure Key Vault)

The README is minimal, so the architecture must be inferred from these operational/deployment artifacts.

##### System Context (C4 L1) – who uses it and what external platforms it depends on
2) **Container / Runtime Topology (C4 L2)** – browser → ingress → service → pod/app, plus secrets + monitoring
3) **Deployment (Kubernetes-focused)** – namespace, deployment, service, ingress, service monitor, secret provider
4) **CI/CD Pipeline** – GitHub Actions / Azure Pipelines → build image → push registry → deploy manifests/helm

##### Application (code/runtime)
- **ASP.NET Core Razor Pages App**
- Entry point: `Program.cs`
- UI Pages: `Pages/Index.cshtml`, `Pages/Privacy.cshtml`, shared layout `Pages/Shared/_Layout.cshtml`
- Static assets: `wwwroot/css/site.css`, `wwwroot/js/site.js`, plus vendor libs (Bootstrap, jQuery)
- **Configuration**
- `appsettings.json`, `appsettings.Development.json`
- Additional environment config files: `dev-settings.json`, `qa-settings.json`, `settings.json`, `appconfig.json`
- Token replacement script suggests env-specific substitution: `replace_token.sh`

##### Containerization
- **Docker image build**: `Dockerfile`
- **Runtime entrypoint**: `entrypoint.sh` / `backendentrypoint.sh`
- Potential SSH capability/config (if actually used in container): `sshd_config`
(Call this out as “optional/ops” unless proven required.)

##### Kubernetes resources (deployment topology)
From `k8s/**`:
- `namespace.yaml` → **Namespace**
- `deployment.yaml` → **Deployment** (replicas, container image, env vars, probes, volumes)
- `service.yaml` → **Service** (cluster networking to pods)
- `ingress.yaml` → **Ingress** (external HTTP entry, likely via NGINX or cloud ingress controller)
- `secretproviderclass.yaml` → **SecretProviderClass** (CSI secret integration; often Key Vault)
- `servicemonitor.yaml` → **ServiceMonitor** (Prometheus Operator scrape config)

##### Observability / monitoring
- `monitoring/grafana-ingress.yaml` → Grafana exposed via ingress
- `helm/monitoring-values.yaml` → suggests monitoring stack installed/configured via Helm (Prometheus/Grafana stack)

##### CI/CD & automation
- GitHub Actions workflows under `.github/workflows/**` (multiple CI/CD variants)
- `azure-pipelines.yml` (Azure DevOps pipeline alternative or legacy)
- `deploy.sh` (manual/automated deploy helper)
- `container.yml`, `cd.yml`, `ci.yaml`, etc. indicate: build/test → containerize → publish → deploy

##### User Browser
→ (HTTPS)
##### Kubernetes Ingress
→ (HTTP to cluster service)
##### Kubernetes Service
→ (load-balances)
##### Pod(s): ASP.NET Core Razor Pages container
→ returns HTML/CSS/JS to browser

Runtime side flows:
- **App → Configuration**
App reads `appsettings*.json` + environment variables injected by Deployment.
- **Pod → Secrets Store CSI Driver → External Secret Store (likely Azure Key Vault)**
- **Prometheus (via ServiceMonitor) → App metrics endpoint (if exposed)**
If the app doesn’t expose metrics, the presence of `servicemonitor.yaml` still implies an intent; annotate “metrics endpoint (if enabled)” rather than inventing specifics.
- **Grafana → Prometheus** for dashboards (from monitoring stack)

##### Build/deploy flow
- **Developer pushes to GitHub**
→ **GitHub Actions CI** (build/test)
→ **Docker Build** (Dockerfile)
→ **CD workflow** applies **K8s manifests / Helm** to cluster

If Azure Pipelines is active:
- **Azure DevOps Pipeline** can replace or coexist with GitHub Actions; show as two alternative lanes.

##### Architectural patterns/design principles used
For this repo, emphasize:
- **Monolithic web app** (single deployable unit) using **Razor Pages** (page-focused server-rendered MVC pattern)
- **Container-first deployment**
- **Declarative infrastructure** via K8s YAML + Helm values for monitoring
- **Separation of concerns operationally**:
- App code vs container vs cluster manifests vs monitoring vs pipeline automation
- **Environment-based configuration** (multiple settings files + token replacement scripts)

Examples:
- “ASP.NET Core (.NET 6) Razor Pages App — `Program.cs`, `Pages/**`, `wwwroot/**`”
- “K8s Deployment — `k8s/deployment.yaml`”
- “Ingress — `k8s/ingress.yaml`”
- “ServiceMonitor — `k8s/servicemonitor.yaml`”
- “Grafana Ingress — `monitoring/grafana-ingress.yaml`”
- “Docker Image — `Dockerfile`, `entrypoint.sh`”

- Browser → Ingress: **HTTPS**
- Ingress → Service: **HTTP**
- Service → Pod: **HTTP**
- Prometheus → Pod: **HTTP scrape**
- Pod → Secret Store: **CSI mount / secret fetch**
- CI → Registry: **push image**
- CD → K8s API Server: **kubectl/helm apply** (even if not explicitly shown, that is the operational mechanism)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% =========================
    %% Users
    %% =========================
    subgraph "Users"
        U["User (Browser)"]:::external
    end

    %% =========================
    %% CI/CD
    %% =========================
    subgraph "CI/CD Automation"
        DEV["Developer (Git push/PR)"]:::external

        subgraph "GitHub"
            GHA["GitHub Actions Workflows"]:::cicd
            WF_CI["CI Workflow (build/test)"]:::cicd
            WF_CONTAINER["Container Workflow (docker build)"]:::cicd
            WF_CD["CD Workflow (deploy)"]:::cicd
        end

        subgraph "Azure DevOps (Alternative)"
            ADO["Azure Pipelines"]:::cicd
        end

        REG[("Container Registry (ACR/DockerHub/GHCR - TBD)")]:::platform
        KAPI["Kubernetes API Server (kubectl/helm apply)"]:::platform
        DEPLOYSCRIPT["Deploy Helper Script"]:::cicd

        DOCKERFILE["Dockerfile (image build)"]:::artifact
        ENTRYPOINTS["Container Entrypoints"]:::artifact
    end

    %% =========================
    %% Kubernetes Cluster
    %% =========================
    subgraph "Kubernetes Cluster"
        subgraph "Namespace"
            NS["Namespace"]:::k8s

            ING["Ingress (HTTPS entry)"]:::k8s
            SVC["Service (ClusterIP)"]:::k8s
            DEP["Deployment (replicas, probes, env, volumes)"]:::k8s

            subgraph "Pod(s)"
                POD["ASP.NET Core (.NET 6) Razor Pages Container"]:::runtime

                subgraph "App (single deployable unit)"
                    APPHOST["App Host / Entry Point"]:::runtime
                    RAZOR["Razor Pages UI"]:::runtime
                    SHAREDUI["Shared Layout & Partials"]:::runtime
                    VIEWIMPORTS["Razor _ViewImports.cshtml"]:::runtime
                    VIEWSTART["Razor _ViewStart.cshtml"]:::runtime
                    STATIC["Static Files (CSS/JS/libs)"]:::runtime

                    subgraph "Configuration"
                        APPSET["appsettings*.json"]:::config
                        ENVCFG["env/app config files + token replacement"]:::config
                        LAUNCH["Local launchSettings.json"]:::config
                    end

                    METRICS["Metrics Endpoint (if enabled)"]:::runtime
                    SSHD["Optional SSHD config (ops)"]:::ops
                end
            end

            SPC["SecretProviderClass (Secrets Store CSI)"]:::k8s
            SM["ServiceMonitor (Prometheus Operator)"]:::k8s
        end
    end

    %% =========================
    %% External Platform Services
    %% =========================
    subgraph "Platform / External Services"
        EXTSECRETS[("External Secret Store (Key Vault/TBD)")]:::platform

        subgraph "Observability Stack"
            HELMVALS["Helm Monitoring Values (Prometheus/Grafana config)"]:::artifact
            PROM["Prometheus (Operator)"]:::platform
            GRAF["Grafana"]:::platform
            GRAFING["Grafana Ingress"]:::k8s
        end
    end

    %% =========================
    %% Runtime request flow
    %% =========================
    U -->|"HTTPS"| ING
    ING -->|"HTTP"| SVC
    SVC -->|"routes_to_pods"| DEP
    DEP -->|"creates"| POD
    POD -->|"HTML/CSS/JS"| U

    %% =========================
    %% App internal relations
    %% =========================
    POD -->|"starts"| APPHOST
    APPHOST -->|"renders"| RAZOR
    RAZOR -->|"uses"| SHAREDUI
    RAZOR -->|"uses"| VIEWIMPORTS
    RAZOR -->|"uses"| VIEWSTART
    APPHOST -->|"serves"| STATIC

    APPHOST -->|"reads"| APPSET
    APPHOST -->|"reads"| ENVCFG
    ENVCFG -->|"dev_only"| LAUNCH

    %% =========================
    %% Secrets flow (CSI)
    %% =========================
    SPC -->|"configures"| POD
    POD -->|"CSI_mount/secret_fetch"| EXTSECRETS

    %% =========================
    %% Monitoring flow
    %% =========================
    SM -->|"selects/scrapes"| SVC
    PROM -->|"HTTP_scrape"| METRICS
    METRICS -->|"exposed_by"| POD
    GRAF -->|"queries"| PROM
    GRAFING -->|"exposes"| GRAF
    HELMVALS -->|"configures"| PROM
    HELMVALS -->|"configures"| GRAF

    %% =========================
    %% CI/CD flows
    %% =========================
    DEV -->|"triggers"| GHA
    GHA -->|"runs"| WF_CI
    GHA -->|"runs"| WF_CONTAINER
    GHA -->|"runs"| WF_CD

    WF_CONTAINER -->|"docker_build"| DOCKERFILE
    DOCKERFILE -->|"uses"| ENTRYPOINTS
    WF_CONTAINER -->|"push_image"| REG

    WF_CD -->|"deploy_manifests/helm"| KAPI
    DEPLOYSCRIPT -->|"deploy_manifests/helm"| KAPI

    ADO -->|"build/test/push/deploy (alt)"| REG
    ADO -->|"deploy (alt)"| KAPI

    REG -->|"image_pull"| DEP

    %% =========================
    %% Click events (component mapping)
    %% =========================
    click APPHOST "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/Program.cs"
    click RAZOR "https://github.com/vishwasure555/newrepo-dotnet/tree/nonroot/Pages/"
    click SHAREDUI "https://github.com/vishwasure555/newrepo-dotnet/tree/nonroot/Pages/Shared/"
    click VIEWIMPORTS "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/Pages/_ViewImports.cshtml"
    click VIEWSTART "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/Pages/_ViewStart.cshtml"
    click STATIC "https://github.com/vishwasure555/newrepo-dotnet/tree/nonroot/wwwroot/"
    click APPSET "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/appsettings.json"
    click APPSET "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/appsettings.Development.json"
    click ENVCFG "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/appconfig.json"
    click ENVCFG "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/settings.json"
    click ENVCFG "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/dev-settings.json"
    click ENVCFG "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/qa-settings.json"
    click LAUNCH "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/Properties/launchSettings.json"
    click DOCKERFILE "https://github.com/vishwasure555/newrepo-dotnet/tree/nonroot/Dockerfile"
    click ENTRYPOINTS "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/entrypoint.sh"
    click ENTRYPOINTS "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/backendentrypoint.sh"
    click SSHD "https://github.com/vishwasure555/newrepo-dotnet/tree/nonroot/sshd_config"
    click ENVCFG "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/replace_token.sh"
    click NS "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/k8s/namespace.yaml"
    click DEP "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/k8s/deployment.yaml"
    click SVC "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/k8s/service.yaml"
    click ING "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/k8s/ingress.yaml"
    click SPC "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/k8s/secretproviderclass.yaml"
    click SM "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/k8s/servicemonitor.yaml"
    click HELMVALS "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/helm/monitoring-values.yaml"
    click GRAFING "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/monitoring/grafana-ingress.yaml"
    click GHA "https://github.com/vishwasure555/newrepo-dotnet/tree/nonroot/.github/workflows/"
    click ADO "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/azure-pipelines.yml"
    click DEPLOYSCRIPT "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/deploy.sh"
    click WF_CI "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/.github/workflows/ci.yaml"
    click WF_CD "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/.github/workflows/cd.yml"
    click WF_CONTAINER "https://github.com/vishwasure555/newrepo-dotnet/blob/nonroot/.github/workflows/container.yml"

    %% =========================
    %% Styles
    %% =========================
    classDef external fill:#EEF2FF,stroke:#3730A3,stroke-width:1.5px,color:#111827
    classDef runtime fill:#DBEAFE,stroke:#1D4ED8,stroke-width:1.5px,color:#0B1220
    classDef k8s fill:#E0F2FE,stroke:#0369A1,stroke-width:1.5px,color:#0B1220
    classDef platform fill:#DCFCE7,stroke:#166534,stroke-width:1.5px,color:#0B1220
    classDef cicd fill:#FFEDD5,stroke:#9A3412,stroke-width:1.5px,color:#0B1220
    classDef config fill:#F3F4F6,stroke:#6B7280,stroke-width:1.5px,color:#111827
    classDef artifact fill:#E5E7EB,stroke:#374151,stroke-width:1.5px,color:#111827
    classDef ops fill:#FCE7F3,stroke:#9D174D,stroke-width:1.5px,color:#111827
```
