# faliush/contactmanager architecture

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

- Interactive diagram: https://gitdiagram.com/faliush/contactmanager
- Repository: https://github.com/faliush/contactmanager

## Overview

##### Project type and purpose
- This is a full-stack, multi-service contact management application.
- BlazorClient – a Blazor WASM/Razor frontend
- IdentityServer – an OAuth2/OpenID Connect auth server (IdentityServer4)
- Faliush.ContactManager.Api – an ASP.NET Core Minimal API following Vertical Slice/CQRS
- Persistence – PostgreSQL via EF Core, plus Redis for caching and RabbitMQ for messaging
- Purpose: let users authenticate, view/create/update/delete “Person” and “Country” entities, with logging, validation, caching, paging.

##### File structure
- Top-level folders:
- BlazorClient/ – UI project (components, pages, DTOs, custom auth handler, Dockerfile, nginx.conf)
- IdentityServer/ – MVC/Razor auth server (Controllers, Data, ViewModels, Views, migrations, Dockerfile)
- Faliush.ContactManager.Api/ – Minimal API endpoints, Definitions folder for DI, CORS, Serilog, HealthChecks
- Faliush.ContactManager.Core/ – Business logic layer (Commands & Queries per entity, FluentValidation, AutoMapper, OperationResult, DI)
- Faliush.ContactManager.Infrastructure/ – Data access (DbContext, Repositories, UnitOfWork, Migrations, ModelConfiguration)
- Faliush.ContactManager.Models/ – Shared domain models
- Faliush.ContactManager.UnitTests & IntegrationTest – test projects
- docker-compose.yml & per-service Dockerfiles

##### README for additional insights
- Project Architecture: three services (Client, Auth Server, API)
- API: Vertical Slice, Minimal API, CQRS, Definitions for cross-cutting concerns
- Core: AutoMapper, FluentValidation, Serilog, Caching, OperationResult
- Infra: EF Core + Postgres, UnitOfWork, Pagination

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Zone
    subgraph "Client Zone"
        Browser["External Client\n(Web/Mobile)"]:::external
        BlazorClient["BlazorClient UI"]:::frontend
    end

    %% Auth Zone
    subgraph "Auth Zone"
        IdentityServer["IdentityServer Auth Service"]:::auth
    end

    %% API Zone
    subgraph "API Zone"
        subgraph "API Service"
            ApiService["ContactManager API Service"]:::api
            Definitions["Definitions"]:::config
            CountryEP["CountryEndpoints"]:::api
            PersonEP["PersonEndpoints"]:::api
        end

        subgraph "Core"
            CountryLogicQ["Country Queries"]:::core
            CountryLogicV["Country Validators"]:::core
            CountryLogicVM["Country ViewModels"]:::core
            PersonLogicQ["Person Queries"]:::core
            PersonLogicV["Person Validators"]:::core
            PersonLogicVM["Person ViewModels"]:::core
            Mappers["AutoMapper Configurations"]:::core
            Behaviors["ValidationBehavior & OperationResult"]:::core
            ServicesCore["Core Services"]:::core
        end

        subgraph "Infrastructure"
            DbContextBase["DbContextBase & ApplicationDbContext"]:::infra
            Repos["Repositories & UnitOfWork"]:::infra
            Pagination["Pagination Support"]:::infra
            ModelConfig["Entity Configurations"]:::infra
            Migrations["EF Core Migrations"]:::infra
            InfraDI["Infrastructure DI"]:::infra
        end
    end

    %% External Data Stores
    PostgreSQL["PostgreSQL DB"]:::db
    Redis["Redis Cache"]:::cache
    RabbitMQ["RabbitMQ Broker"]:::broker

    %% Connections
    Browser -->|HTTP/HTTPS| BlazorClient
    BlazorClient -->|OIDC Auth| IdentityServer
    BlazorClient -->|Bearer Token| ApiService
    ApiService -->|Token Validation| IdentityServer
    ApiService -->|Read/Write| PostgreSQL
    ApiService <-->|Cache Read/Write| Redis
    ApiService -->|Publish Events| RabbitMQ

    %% Internal API flows
    ApiService --> Definitions
    ApiService --> CountryEP
    ApiService --> PersonEP

    CountryEP --> CountryLogicQ
    CountryEP --> CountryLogicV
    CountryEP --> CountryLogicVM

    PersonEP --> PersonLogicQ
    PersonEP --> PersonLogicV
    PersonEP --> PersonLogicVM

    CountryLogicQ --> Mappers
    PersonLogicQ --> Mappers

    CountryLogicQ --> Repos
    PersonLogicQ --> Repos

    Repos --> DbContextBase
    Repos --> Pagination
    Repos --> ModelConfig
    Repos --> Migrations
    InfraDI --> DbContextBase

    %% Click Events
    click BlazorClient "https://github.com/faliush/contactmanager/tree/master/BlazorClient/"
    click IdentityServer "https://github.com/faliush/contactmanager/tree/master/IdentityServer/"
    click ApiService "https://github.com/faliush/contactmanager/tree/master/Faliush.ContactManager.Api/"
    click Definitions "https://github.com/faliush/contactmanager/tree/master/Faliush.ContactManager.Api/Definitions/"
    click CountryEP "https://github.com/faliush/contactmanager/blob/master/Faliush.ContactManager.Api/Endpoints/CountryEndpoints/CountryEndpoints.cs"
    click PersonEP "https://github.com/faliush/contactmanager/blob/master/Faliush.ContactManager.Api/Endpoints/PersonEndpoints/PersonEndpoints.cs"
    click CountryLogicQ "https://github.com/faliush/contactmanager/tree/master/Faliush.ContactManager.Core/Logic/CountryLogic/Queries/"
    click CountryLogicV "https://github.com/faliush/contactmanager/tree/master/Faliush.ContactManager.Core/Logic/CountryLogic/Validators/"
    click CountryLogicVM "https://github.com/faliush/contactmanager/tree/master/Faliush.ContactManager.Core/Logic/CountryLogic/ViewModels/"
    click PersonLogicQ "https://github.com/faliush/contactmanager/tree/master/Faliush.ContactManager.Core/Logic/PersonLogic/Queries/"
    click PersonLogicV "https://github.com/faliush/contactmanager/tree/master/Faliush.ContactManager.Core/Logic/PersonLogic/Validators/"
    click PersonLogicVM "https://github.com/faliush/contactmanager/tree/master/Faliush.ContactManager.Core/Logic/PersonLogic/ViewModels/"
    click Mappers "https://github.com/faliush/contactmanager/tree/master/Faliush.ContactManager.Core/Mappers/"
    click Behaviors "https://github.com/faliush/contactmanager/tree/master/Faliush.ContactManager.Core/Common/ValidationBehavior/"
    click ServicesCore "https://github.com/faliush/contactmanager/tree/master/Faliush.ContactManager.Core/Services/"
    click DbContextBase "https://github.com/faliush/contactmanager/blob/master/Faliush.ContactManager.Infrastructure/Base/DbContextBase.cs"
    click Repos "https://github.com/faliush/contactmanager/tree/master/Faliush.ContactManager.Infrastructure/UnitOfWork/"
    click Pagination "https://github.com/faliush/contactmanager/tree/master/Faliush.ContactManager.Infrastructure/UnitOfWork/Pagination/"
    click ModelConfig "https://github.com/faliush/contactmanager/tree/master/Faliush.ContactManager.Infrastructure/ModelConfiguration/"
    click Migrations "https://github.com/faliush/contactmanager/tree/master/Faliush.ContactManager.Infrastructure/Migrations/"
    click InfraDI "https://github.com/faliush/contactmanager/blob/master/Faliush.ContactManager.Infrastructure/DependencyInjection.cs"

    %% Styles
    classDef frontend fill:#D6E9F8,stroke:#333,stroke-width:1px
    classDef auth fill:#DFF0D8,stroke:#333,stroke-width:1px
    classDef api fill:#FCF8E3,stroke:#333,stroke-width:1px
    classDef core fill:#F2DEDE,stroke:#333,stroke-width:1px
    classDef infra fill:#EEEEEE,stroke:#333,stroke-width:1px
    classDef db fill:#F5ADC6,stroke:#333,stroke-width:1px
    classDef cache fill:#D9EDF7,stroke:#333,stroke-width:1px
    classDef broker fill:#FDE3A7,stroke:#333,stroke-width:1px
    classDef external fill:#E1D5E7,stroke:#333,stroke-width:1px
    classDef config fill:#FAEBD7,stroke:#333,stroke-width:1px
```
