# pandugaluh/blog-azure-blob-storage architecture

> Architecture diagram of the GitHub repository pandugaluh/blog-azure-blob-storage, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pandugaluh/blog-azure-blob-storage
- Repository: https://github.com/pandugaluh/blog-azure-blob-storage

## Overview

- API Service (AzureBlobAPI) – This is the core component and contains:
- Entry point (Program.cs) where the application starts.
- Configuration and settings management (BlobSettings via appsettings.json files).
- Helper functions (under Helpers, such as FileExtentions.cs).
- Domain models (under Models folder: BlobDetail, BlobRequest).
- Presentation layer (under Presents, e.g., BlobPresents) which formats responses.
- Service layer (under Services: BlobStorage service and its interface IBlobStorage) implementing business logic.
- External Dependency – Azure Blob Storage itself should be represented as an external system. Mark it as a cloud resource that the API communicates with.
- Factory Extensions – The AzureClientFactoryBuilderExtensions in the project indicates a factory or extension pattern for constructing Azure client instances. Represent this as a supportive component that aids in initializing external service clients.

##### Component Relationships and Interactions
- API Service sending requests to the BlobStorage service located in the Services layer.
- The BlobStorage service will use the factory extension (AzureClientFactoryBuilderExtensions) possibly to build a proper client for connecting with Azure Blob Storage.
- Models and Present classes showing their roles in handling data (input/response shaping).
- Configuration management (Settings) feeding into the initialization and configuration of the API and its services.
– Data flow from client requests arriving at the API.
– Business logic applied by Services.
– External calls from the BlobStorage service to the Azure Blob Storage.
– Responses flowing back through the presentation layer (Presents) to the client.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Distinct modules for handling logic (Services), data (Models), utility functions (Helpers), and presentation (Presents).
- Dependency Injection / Factory Pattern: Use of client factory extension patterns for creating Azure clients.
- Configuration-Driven Behavior: Manage settings centrally via appsettings.json, indicating adherence to configurable and environment-based deployments.

##### Incorporating Technologies and Frameworks
- .NET Framework/Core is the underlying technology.
- Azure Blob Storage acts as the external cloud datastore.
- The specific extension methods and configurations point towards a modular and testable architecture.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% API Service Subgraph
    subgraph "API Service"
        A1["Program.cs (Entry Point)"]:::entry
        settings["BlobSettings (Configuration)"]:::config
        appsettings["appsettings.json"]:::config
        appsettingsDev["appsettings.Development.json"]:::config
        helper["FileExtentions (Helper)"]:::helper
        factory["AzureClientFactoryBuilderExtensions"]:::factory
    end

    %% Domain Models Subgraph
    subgraph "Domain Models"
        modelDetail["Model: BlobDetail"]:::model
        modelRequest["Model: BlobRequest"]:::model
    end

    %% Presentation Layer Subgraph
    subgraph "Presentation Layer"
        presents["BlobPresents"]:::presentation
    end

    %% Service Layer Subgraph
    subgraph "Service Layer"
        service["BlobStorage Service"]:::service
        iblob["IBlobStorage Interface"]:::service
    end

    %% External Dependency and Client
    external["Azure Blob Storage (External)"]:::external
    client["Client Request"]:::client

    %% Data Flow
    client -->|"sendsRequest"| A1
    A1 -->|"readsConfig"| settings
    A1 -->|"readsConfig"| appsettings
    A1 -->|"readsConfig"| appsettingsDev
    A1 -->|"uses"| helper
    A1 -->|"initializes"| factory
    A1 -->|"invokesLogic"| service
    settings -->|"configures"| service
    appsettings -->|"configures"| service
    appsettingsDev -->|"configures"| service
    helper -->|"supports"| service
    factory -->|"buildsClient"| service
    service -->|"implements"| iblob
    service -->|"processesDataWith"| modelDetail
    service -->|"processesDataWith"| modelRequest
    service -->|"calls"| external
    service -->|"formatsResponse"| presents
    presents -->|"sendsResponse"| client

    %% Click Events
    click A1 "https://github.com/pandugaluh/blog-azure-blob-storage/blob/main/src/AzureBlobAPI/Program.cs"
    click settings "https://github.com/pandugaluh/blog-azure-blob-storage/blob/main/src/AzureBlobAPI/Settings/BlobSettings.cs"
    click appsettings "https://github.com/pandugaluh/blog-azure-blob-storage/blob/main/src/AzureBlobAPI/appsettings.json"
    click appsettingsDev "https://github.com/pandugaluh/blog-azure-blob-storage/blob/main/src/AzureBlobAPI/appsettings.Development.json"
    click helper "https://github.com/pandugaluh/blog-azure-blob-storage/blob/main/src/AzureBlobAPI/Helpers/FileExtentions.cs"
    click modelDetail "https://github.com/pandugaluh/blog-azure-blob-storage/blob/main/src/AzureBlobAPI/Models/BlobDetail.cs"
    click modelRequest "https://github.com/pandugaluh/blog-azure-blob-storage/blob/main/src/AzureBlobAPI/Models/BlobRequest.cs"
    click presents "https://github.com/pandugaluh/blog-azure-blob-storage/blob/main/src/AzureBlobAPI/Presents/BlobPresents.cs"
    click service "https://github.com/pandugaluh/blog-azure-blob-storage/blob/main/src/AzureBlobAPI/Services/BlobStorage.cs"
    click iblob "https://github.com/pandugaluh/blog-azure-blob-storage/blob/main/src/AzureBlobAPI/Services/IBlobStorage.cs"
    click factory "https://github.com/pandugaluh/blog-azure-blob-storage/blob/main/src/AzureBlobAPI/AzureClientFactoryBuilderExtensions.cs"

    %% Style Classes
    classDef entry fill:#f9d5e5,stroke:#333,stroke-width:2px;
    classDef config fill:#fff2cc,stroke:#333,stroke-width:2px;
    classDef helper fill:#d9ead3,stroke:#333,stroke-width:2px;
    classDef factory fill:#ead1dc,stroke:#333,stroke-width:2px;
    classDef model fill:#cfe2f3,stroke:#333,stroke-width:2px;
    classDef presentation fill:#ffe599,stroke:#333,stroke-width:2px;
    classDef service fill:#c6efce,stroke:#333,stroke-width:2px;
    classDef external fill:#d9d2e9,stroke:#333,stroke-width:2px;
    classDef client fill:#f4cccc,stroke:#333,stroke-width:2px;
```
