# fullstackhero/blazor-starter-kit architecture

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

- Interactive diagram: https://gitdiagram.com/fullstackhero/blazor-starter-kit
- Repository: https://github.com/fullstackhero/blazor-starter-kit

## Overview

##### Project Type and Purpose
This is a full-stack Blazor WebAssembly 6.0 application following Clean Architecture principles, built with MudBlazor Components. It's an enterprise-level boilerplate with features like authentication, authorization, and multi-language support.

##### Main Architectural Components
The system should be represented in layers according to Clean Architecture, with the following key components:

a. Client Layer (Presentation)
- Blazor WebAssembly Frontend
- MudBlazor UI Components
- Client-side Services and State Management

b. Application Layer
- Features (Commands/Queries following CQRS)
- Interfaces
- Validators
- Mappings

c. Infrastructure Layer
- Database Context
- Identity Services
- External Services Integration
- Repository Implementations

d. Domain Layer
- Entities
- Contracts
- Business Logic

**[Client Layer]**

- v
**[API Layer (Server)]**

- v
**[Application Layer]**

- v
**[Infrastructure Layer]**

- v
**[Domain Layer]**

##### Client-Side Components
**[Blazor WebAssembly UI]**

**[MudBlazor Components]**

**[Client Services]**
- Authentication
- State Management
- API Communication

##### Server-Side Components
**[API Controllers]**

**[SignalR Hubs]**

**[Middleware]**
- Error Handling
- Authentication
- Localization

##### Application Features
**[CQRS Pattern]**
- Commands
- Queries

**[Services]**
- Identity
- Document Management
- Catalog Management

##### Infrastructure Services
**[Data Access]**
- Entity Framework Core
- Repositories

**[External Services]**
- Email
- Storage

**[Identity]**
- Authentication
- Authorization

##### Cross-Cutting Concerns
**[Logging]**
**[Caching]**
**[Validation]**
**[Localization]**

Important Relationships to Show:

Additional Guidelines:
##### Database interactions

- Clean Architecture layers and dependencies
- CQRS pattern implementation
- Authentication and authorization flow
- Real-time communication via SignalR
- Multi-language support infrastructure
- Document and catalog management features

Remember to maintain the dependency rule of Clean Architecture: dependencies should only point inward, with the Domain layer at the center having no dependencies on outer layers.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef client fill:#3498db,color:white
    classDef api fill:#2ecc71,color:white
    classDef application fill:#f1c40f,color:black
    classDef infrastructure fill:#e67e22,color:white
    classDef domain fill:#e74c3c,color:white
    classDef crosscutting fill:#95a5a6,color:white

    %% Client Layer
    subgraph ClientLayer
        BF["Blazor Frontend"]
        CC["Client Components"]
        CP["Client Pages"]
        CI["Client Infrastructure"]
        BF --> CC & CP
        CC & CP --> CI
    end

    %% API Layer
    subgraph APILayer
        API["API Controllers"]
        SRH["SignalR Hub"]
        EHM["Error Handler Middleware"]
        API --> SRH
        API --> EHM
    end

    %% Application Layer
    subgraph ApplicationLayer
        CQRS["CQRS Features"]
        INT["Interfaces"]
        VAL["Validators"]
        MAP["Mappings"]
        CQRS --> INT
        CQRS --> VAL
        CQRS --> MAP
    end

    %% Infrastructure Layer
    subgraph InfrastructureLayer
        DBC["Database Context"]
        IDS["Identity Services"]
        REP["Repositories"]
        EXT["External Services"]
        DBC --> REP
        IDS --> REP
        REP --> EXT
    end

    %% Domain Layer
    subgraph DomainLayer
        ENT["Entities"]
        CON["Contracts"]
        ENUM["Domain Enums"]
        ENT --> CON
        ENT --> ENUM
    end

    %% Cross-cutting Concerns
    subgraph CrossCutting
        LOC["Localization"]
        AUTH["Authentication"]
        ERR["Error Handling"]
    end

    %% Layer Connections
    ClientLayer --> APILayer
    APILayer --> ApplicationLayer
    ApplicationLayer --> InfrastructureLayer
    InfrastructureLayer --> DomainLayer
    CrossCutting -.-> ClientLayer & APILayer & ApplicationLayer & InfrastructureLayer

    %% Styling
    class BF,CC,CP,CI client
    class API,SRH,EHM api
    class CQRS,INT,VAL,MAP application
    class DBC,IDS,REP,EXT infrastructure
    class ENT,CON,ENUM domain
    class LOC,AUTH,ERR crosscutting

    %% Click Events
    click BF "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Client/"
    click CC "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Client/Shared/Components/"
    click CP "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Client/Pages/"
    click CI "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Client.Infrastructure/"
    click API "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Server/Controllers/"
    click SRH "https://github.com/fullstackhero/blazor-starter-kit/blob/master/src/Server/Hubs/SignalRHub.cs"
    click EHM "https://github.com/fullstackhero/blazor-starter-kit/blob/master/src/Server/Middlewares/ErrorHandlerMiddleware.cs"
    click CQRS "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Application/Features/"
    click INT "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Application/Interfaces/"
    click VAL "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Application/Validators/"
    click MAP "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Application/Mappings/"
    click DBC "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Infrastructure/Contexts/"
    click IDS "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Infrastructure/Services/Identity/"
    click REP "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Infrastructure/Repositories/"
    click EXT "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Infrastructure.Shared/Services/"
    click ENT "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Domain/Entities/"
    click CON "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Domain/Contracts/"
    click ENUM "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Domain/Enums/"
    click LOC "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Server/Localization/"
    click AUTH "https://github.com/fullstackhero/blazor-starter-kit/tree/master/src/Client.Infrastructure/Authentication/"
```
