# teddyara/blazorstaticwebapptest architecture

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

- Interactive diagram: https://gitdiagram.com/teddyara/blazorstaticwebapptest
- Repository: https://github.com/teddyara/blazorstaticwebapptest

## Overview

##### Project type and purpose
- This is a full-stack .NET 8 Blazor WebAssembly application (Client) calling an Azure Functions API (Api), with a shared C# class library (Shared) for common models.
- The README describes it as a starter template: a Blazor WASM client (hosted via Azure Static Web Apps), a Functions-based backend, and shared types.

##### File structure
- Top-level solution: BlazorStaticWebApps.sln
- “Client” folder: Blazor WASM app, staticwebapp.config.json, wwwroot assets, pages/components/layouts.
- “Api” folder: Azure Functions project (.csproj), BitbucketWebhookFunction.cs, WeatherForecastFunction.cs.
- “Shared” folder: class library for shared DTOs (WeatherForecast.cs, WebhookLogStore.cs).
- Configuration files: host.json, local.settings.json (sample), launchSettings.json, serviceDependencies.json.
- No database folder, but WebhookLogStore suggests a storage abstraction—likely Azure Table/Cosmos/Blob.

##### README for additional insights
- It instructs how to run locally with Azure Static Web Apps CLI: runs Blazor app on port 5000, Functions on 7071, and swa start proxy on 4280.
- Describes deployments to Azure Static Web Apps.
- Confirms architectural roles: Client ←→ API ←→ Shared.

##### Detailed breakdown of components
- Frontend (Blazor WASM)
- App.razor, Pages (Home, Counter, FetchData)
- Layouts and NavMenu
- Static files (index.html, CSS, sample-data/weather.json)
- Backend (Azure Functions)
- WeatherForecastFunction (GET endpoint)
- BitbucketWebhookFunction (POST webhook)
- host.json, local.settings.json for config
- Shared (class library)
- WeatherForecast model (DTO)
- WebhookLogStore abstraction (data persistence)

##### Final advice
- Don’t forget to show how the Shared library ties the two projects together at compile time.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User ingress
    User["User Browser"]:::ext

    %% Local Development Environment
    subgraph "Local Development"
        SWA_CLI["SWA CLI Proxy (localhost:4280)"]:::ext

        subgraph "Blazor WASM Client (localhost:5000)"
            direction TB
            ClientApp["Client/Program.cs"]:::ui
            AppRazor["Client/App.razor"]:::ui
            HomePage["Client/Pages/Home.razor"]:::ui
            CounterPage["Client/Pages/Counter.razor"]:::ui
            FetchDataPage["Client/Pages/FetchData.razor"]:::ui
            MainLayout["Client/Layout/MainLayout.razor"]:::ui
            MainLayoutCss["Client/Layout/MainLayout.razor.css"]:::ui
            NavMenu["Client/Layout/NavMenu.razor"]:::ui
            NavMenuCss["Client/Layout/NavMenu.razor.css"]:::ui
            IndexHtml["Client/wwwroot/index.html"]:::ui
            AppCss["Client/wwwroot/css/app.css"]:::ui
            WeatherJson["Client/wwwroot/sample-data/weather.json"]:::ui
            StaticWebConfig["Client/staticwebapp.config.json"]:::ui
            LaunchSettingsClient["Client/Properties/launchSettings.json"]:::ui
        end

        subgraph "Azure Functions API (localhost:7071)"
            direction TB
            ApiProj["Api/Api.csproj"]:::api
            ApiProgram["Api/Program.cs"]:::api
            WeatherFunc["Api/WeatherForecastFunction.cs"]:::api
            WebhookFunc["Api/BitbucketWebhookFunction.cs"]:::api
            HostJson["Api/host.json"]:::api
            LocalSettings["Api/local.settings.example.json"]:::api
            LaunchSettingsApi["Api/Properties/launchSettings.json"]:::api
            ServiceDeps1["Api/Properties/serviceDependencies.json"]:::api
            ServiceDeps2["Api/Properties/serviceDependencies.local.json"]:::api
        end
    end

    %% Production Environment
    subgraph "Azure Static Web Apps (Production)"
        direction TB
        StaticHosting["Static Hosting"]:::ext
        FunctionsRuntime["Functions Runtime"]:::api
    end

    %% Shared Library
    subgraph "Shared Library"
        direction TB
        SharedProj["Shared/Shared.csproj"]:::shared
        WeatherModel["Shared/WeatherForecast.cs"]:::shared
        WebhookStore["Shared/WebhookLogStore.cs"]:::shared
    end

    %% Solution Orchestration
    Solution["BlazorStaticWebApps.sln"]:::ext

    %% Storage Service
    Storage["Storage Service (Azure Table/Cosmos)"]:::ext

    %% Connections - Local
    User -->|"HTTPS"| SWA_CLI
    SWA_CLI -->|"GET /"| ClientApp
    SWA_CLI -->|"GET /api/weatherforecast\nPOST /api/webhook"| WeatherFunc

    WeatherFunc -->|"Uses WebhookLogStore"| Storage

    %% Connections - Production
    User -->|"HTTPS"| StaticHosting
    StaticHosting -->|"Serves Client"| StaticHosting
    User -->|"HTTPS /api"| FunctionsRuntime
    FunctionsRuntime -->|"Executes Functions"| FunctionsRuntime
    FunctionsRuntime -->|"Persists via WebhookLogStore"| Storage

    %% Build-time Dependencies
    ClientApp -->|"Compile-time Reference"| SharedProj
    ApiProj -->|"Compile-time Reference"| SharedProj

    Solution --> ClientApp
    Solution --> ApiProj
    Solution --> SharedProj

    %% Click Events - Client
    click ClientApp "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Client/Program.cs"
    click AppRazor "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Client/App.razor"
    click HomePage "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Client/Pages/Home.razor"
    click CounterPage "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Client/Pages/Counter.razor"
    click FetchDataPage "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Client/Pages/FetchData.razor"
    click MainLayout "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Client/Layout/MainLayout.razor"
    click MainLayoutCss "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Client/Layout/MainLayout.razor.css"
    click NavMenu "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Client/Layout/NavMenu.razor"
    click NavMenuCss "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Client/Layout/NavMenu.razor.css"
    click IndexHtml "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Client/wwwroot/index.html"
    click AppCss "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Client/wwwroot/css/app.css"
    click WeatherJson "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Client/wwwroot/sample-data/weather.json"
    click StaticWebConfig "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Client/staticwebapp.config.json"
    click LaunchSettingsClient "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Client/Properties/launchSettings.json"

    %% Click Events - API
    click ApiProj "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Api/Api.csproj"
    click ApiProgram "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Api/Program.cs"
    click WeatherFunc "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Api/WeatherForecastFunction.cs"
    click WebhookFunc "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Api/BitbucketWebhookFunction.cs"
    click HostJson "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Api/host.json"
    click LocalSettings "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Api/local.settings.example.json"
    click LaunchSettingsApi "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Api/Properties/launchSettings.json"
    click ServiceDeps1 "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Api/Properties/serviceDependencies.json"
    click ServiceDeps2 "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Api/Properties/serviceDependencies.local.json"

    %% Click Events - Shared & Solution
    click SharedProj "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Shared/Shared.csproj"
    click WeatherModel "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Shared/WeatherForecast.cs"
    click WebhookStore "https://github.com/teddyara/blazorstaticwebapptest/blob/master/Shared/WebhookLogStore.cs"
    click Solution "https://github.com/teddyara/blazorstaticwebapptest/blob/master/BlazorStaticWebApps.sln"

    %% Styles
    classDef ui fill:#D0E7FF,stroke:#3B85C3,color:#000
    classDef api fill:#DFF7D0,stroke:#6CA623,color:#000
    classDef shared fill:#F0F0F0,stroke:#999,color:#000
    classDef ext fill:#FFE4B5,stroke:#DD9427,color:#000
```
