# markharrison/colorsweb architecture

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

- Interactive diagram: https://gitdiagram.com/markharrison/colorsweb
- Repository: https://github.com/markharrison/colorsweb

## Overview

##### Project Type & Purpose
– Full-stack web application using ASP.NET Core Razor Pages (.NET 9.0).
– Built and deployed as a Docker container via GitHub Actions into Azure.

##### File Structure
– Top level:
- Program.cs, Pages/, Models/, appsettings.json → core ASP.NET app
- site/ + Gruntfile.js + package.json → front-end assets (LESS, JS) build
- Dockerfile, .devcontainer/ → containerization and dev environment
- .github/workflows/containerbuildpush.yml → CI/CD pipeline
- infra/ → infrastructure‐as‐code for Azure deployment
– Pages/ follows Razor-Pages pattern (Views + PageModels).
– Models/ holds domain objects (ColorsItem).
– static assets compiled into wwwroot/ by Grunt.

##### Extract Additional Insights from README
– Environment variable ASPNETCORE_HTTP_PORTS configures container ports.
– Hosted as a container on Azure Web Apps (demo URL provided).
– Related API service lives in a separate repo (ColorsAPI).

##### Main Components & Their Interactions
a. Components
1. Client Browser
2. ASP.NET Core Razor Pages App (server-side)
– Pages + PageModels
– Models layer
– Configuration subsystem (appsettings.json + env vars)
3. Front-end build pipeline (Node.js + Grunt → LESS, JS → wwwroot/)
4. Docker container image
5. GitHub Actions CI/CD
– Builds .NET app + front-end assets
– Builds and pushes container to GitHub Container Registry
6. Infra as Code (infra/)
– Deploys container to Azure Web App
7. (Optional) External ColorsAPI service
b. Interactions
– Developer commits → GitHub Actions triggered →
- npm/Grunt task → compiles LESS & JS → copies to wwwroot/
- dotnet build/publish → produces site artifacts
- docker build → container image → push to GHCR
- infra IaC deploy step → update Azure Web App with new image
– Client → HTTPS → Azure Web App → container → Razor Pages render HTML → client.
c. Architectural Patterns & Principles
– Layered separation: Presentation (Razor Views) / Domain (Models) / Config
– Server-side rendering (Razor Pages)
– Static asset pipeline (LESS → CSS, JS bundling)
– Containerization for consistency across envs
– GitOps/CI-driven deployments (GitHub Actions + IaC)
d. Key Technologies & Frameworks
– ASP.NET Core 9.0 (Razor Pages)
– .NET CLI & MSBuild
– Node.js + npm + Grunt
– Docker
– GitHub Actions
– Azure Web Apps (container host)
– Infra folder (ARM/Bicep/Terraform – check infra/README)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client Layer"
        Browser["Client Browser"]:::frontend
    end

    %% Server Layer
    subgraph "Server Layer"
        WebApp["ASP.NET Core Razor Pages App"]:::appComp
        subgraph "Web App Components"
            RazorUI["Razor Pages UI"]:::appComp
            ModelsComp["ColorsItem Model"]:::appComp
            ConfigComp["Configuration (appsettings.json + env vars)"]:::appComp
            StaticComp["Static Asset Server (wwwroot)"]:::appComp
        end
    end

    %% External Services
    ColorsAPI["External ColorsAPI Service"]:::external

    %% Build & Deploy Pipeline
    subgraph "Build & Deploy Pipeline"
        GHRepo["GitHub Repository"]:::infra
        GitHubActions["GitHub Actions CI/CD"]:::infra
        GruntTask["Node.js + Grunt Build"]:::infra
        DotNetBuild[".NET Build & Publish"]:::infra
        DockerBuild["Docker Build"]:::infra
        GHCR["GitHub Container Registry"]:::infra
        IaC["Infra as Code (infra/)"]:::infra
        AzureApp["Azure Web App"]:::infra
    end

    %% Solution & Project Files
    Solution["Solution & Project Files"]:::infra

    %% Connections
    Browser -->|"HTTPS"| AzureApp
    AzureApp -->|"Hosts Container"| WebApp
    WebApp -->|"Renders HTML"| Browser
    WebApp -->|"Calls HTTP"| ColorsAPI

    GHRepo -->|commits trigger| GitHubActions
    GitHubActions -->|runs| GruntTask
    GruntTask -->|compiles→wwwroot| StaticComp
    GitHubActions -->|runs| DotNetBuild
    DotNetBuild -->|outputs| WebApp
    GitHubActions -->|runs| DockerBuild
    DockerBuild -->|push image| GHCR
    GitHubActions -->|runs| IaC
    IaC -->|deploys| AzureApp

    Solution -->|includes| WebApp
    Solution -->|includes| IaC
    Solution -->|includes| GitHubActions

    %% Click Events
    click Solution "https://github.com/markharrison/colorsweb/blob/main/ColorsWeb.sln"
    click RazorUI "https://github.com/markharrison/colorsweb/tree/main/Pages/"
    click ModelsComp "https://github.com/markharrison/colorsweb/tree/main/Models/"
    click ConfigComp "https://github.com/markharrison/colorsweb/blob/main/appsettings.json"
    click StaticComp "https://github.com/markharrison/colorsweb/tree/main/wwwroot/"
    click GruntTask "https://github.com/markharrison/colorsweb/blob/main/Gruntfile.js"
    click GruntTask "https://github.com/markharrison/colorsweb/blob/main/package.json"
    click GruntTask "https://github.com/markharrison/colorsweb/tree/main/site/"
    click DockerBuild "https://github.com/markharrison/colorsweb/tree/main/Dockerfile"
    click DockerBuild "https://github.com/markharrison/colorsweb/blob/main/.dockerignore"
    click GitHubActions "https://github.com/markharrison/colorsweb/blob/main/.github/workflows/containerbuildpush.yml"
    click IaC "https://github.com/markharrison/colorsweb/tree/main/infra/"
    click Solution "https://github.com/markharrison/colorsweb/blob/main/ColorsWeb.csproj"
    click Solution "https://github.com/markharrison/colorsweb/blob/main/.gitignore"
    click Solution "https://github.com/markharrison/colorsweb/blob/main/README.md"
    click Solution "https://github.com/markharrison/colorsweb/tree/main/LICENSE"

    %% Classes
    classDef frontend fill:#AED6F1,stroke:#21618C,color:#1B4F72
    classDef appComp fill:#D6EAF8,stroke:#2874A6,color:#1B2631
    classDef infra fill:#D5F5E3,stroke:#1D8348,color:#145A32
    classDef external fill:#F9E79F,stroke:#B7950B,color:#7D6608
```
