# umrikhin/book-blazor architecture

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

- Interactive diagram: https://gitdiagram.com/umrikhin/book-blazor
- Repository: https://github.com/umrikhin/book-blazor

## Overview

##### Major Components
- Presentation Layer: Representing the Blazor UI with client projects – these are the “RealtyWeb_Client” (or “AspNetBlazor” in some chapters) projects. Mark this layer as the interactive front-end running in the browser (either WebAssembly or server-hosted).
- Server/Backend Layer: Represented by “RealtyWeb_Server” projects. This layer encapsulates server-side logic, component rendering, API endpoint management, handling of routes, and integration with JavaScript.
- Business Logic Layer: Some chapters include a “Realty_Biz” project (or similar) where business logic and repository implementations reside.
- Domain/Models Layer: The “Realty_Models” projects hold the domain entities (for example, Phone, Tenant, Owner, House, Region, etc.). This layer is used by both the business logic and data access layers.
- Additional Components: For later chapters you might also see API projects (labeled “RealtyWeb_API”) and host apps (“Realty_HostApp”), which focus on exposing endpoints to external services and handling authentication and cross-cutting concerns. There are also InputboxComponents libraries (frequently found under chapters 10, 11, 12, 13, 14, and 15) that encapsulate reusable UI components.

##### Relationships and Data Flow
- The Client projects (UI) send user interactions and API requests toward the Server projects.
- The Server layer processes the incoming data, renders components (using its own sub-components like Layout, Pages, etc.), and interacts with the business logic.

##### Architectural Patterns and Technologies
- The separation into Client and Server projects shows a clear MVC/MVVM or component-based design pattern typical to Blazor.
- Dependency Injection is implied by the use of shared services across projects (e.g., ILocalStorageService, StateContainerService).
- The layered structure (Presentation → Business → Data Access) reinforces separation of concerns.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        A["RealtyWeb_Client"]:::frontend
        B["InputboxComponents"]:::reusable
    end

    %% Server/Backend Layer
    subgraph "Server/Backend Layer"
        C["RealtyWeb_Server"]:::backend
        D["RealtyWeb_API"]:::api
        E["Realty_HostApp"]:::api
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        F["Realty_Biz"]:::business
    end

    %% Domain/Models Layer
    subgraph "Domain/Models Layer"
        G["Realty_Models"]:::domain
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        H["Realty_Db"]:::dataAccess
    end

    %% External JavaScript Integration
    I["JS Integration"]:::external

    %% Relationships
    A -->|"UIRequest"| C
    A -->|"APICall"| D
    C -->|"Processes"| F
    F -->|"UsesModels"| G
    F -->|"DataAccess"| H
    D -->|"HostedBy"| E
    A -->|"Uses"| B
    A ---|"JSInterop"| I

    %% Click Events
    click A "https://github.com/umrikhin/book-blazor/tree/master/chapter 01/Realty/RealtyWeb_Client"
    click B "https://github.com/umrikhin/book-blazor/tree/master/chapter 10/Realty/InputboxComponents"
    click C "https://github.com/umrikhin/book-blazor/tree/master/chapter 01/Realty/RealtyWeb_Server"
    click F "https://github.com/umrikhin/book-blazor/tree/master/chapter 11/Realty/Realty_Biz"
    click G "https://github.com/umrikhin/book-blazor/tree/master/chapter 02/Realty/Realty_Models"
    click H "https://github.com/umrikhin/book-blazor/tree/master/chapter 14/Realty/Realty_Db"
    click D "https://github.com/umrikhin/book-blazor/tree/master/chapter 16/Realty/RealtyWeb_API"
    click E "https://github.com/umrikhin/book-blazor/tree/master/chapter 16/Realty/Realty_HostApp"

    %% Styles
    classDef frontend fill:#B3E5FC,stroke:#0288D1,stroke-width:2px;
    classDef backend fill:#C8E6C9,stroke:#388E3C,stroke-width:2px;
    classDef business fill:#FFECB3,stroke:#FBC02D,stroke-width:2px;
    classDef domain fill:#FFE0B2,stroke:#FB8C00,stroke-width:2px;
    classDef dataAccess fill:#FFCDD2,stroke:#D32F2F,stroke-width:2px;
    classDef api fill:#D1C4E9,stroke:#512DA8,stroke-width:2px;
    classDef reusable fill:#B2DFDB,stroke:#00796B,stroke-width:2px;
    classDef external fill:#E1BEE7,stroke:#8E24AA,stroke-width:2px,stroke-dasharray: 5 5;
```
