# gurau-anil/libmanease architecture

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

- Interactive diagram: https://gitdiagram.com/gurau-anil/libmanease
- Repository: https://github.com/gurau-anil/libmanease

## Overview

##### Project Type and Purpose
- Full-stack library-management application
- Implements Onion Architecture to isolate business rules from infrastructure and presentation
- Backend: ASP.NET Core Web API
- Frontend: Angular SPA

##### File Structure and Layers
- Presentation Layer
– LibManEase.Api (Controllers, HTTP endpoints)
– LibManEase.Client (Angular project)
- Dependency Injection
– LibManEase.DependencyInjection (resolves services across layers)
- Application Layer
– LibManEase.Application.Abstraction (DTOs, service & logger interfaces)
– LibManEase.Application (service implementations, FluentValidation, AutoMapper mappings)
- Domain Layer
– LibManEase.Domain (entity classes, repository interfaces)
- Infrastructure Layer
– LibManEase.Infrastructure (EF Core DbContext, repository implementations, Serilog logger, migrations)

- Angular Client (UI)
- Web API
– Controllers
– Dependency Resolver (DI container)
- Application Services
– IBookService, IMemberService, ILoanService and their implementations
– Validation & Mapping subcomponents
- Domain Entities & Interfaces
– Book, Member, Loan entities
– IRepository<T>, IBookRepository, etc.
- Infrastructure
– ApplicationDbContext (EF Core)
– Concrete repositories
– SerilogLogger
– Database (SQL Server or equivalent)
- External/Supporting Services
– Configuration (appsettings.json)
– HTTP client(s) if any (e.g., WeatherForecast sample)

##### Relationships and Data Flow
- Angular → HTTP calls → API Controllers
- Controller invokes → Application Services (via interfaces)
- Service uses → Domain Entities & Repository interfaces
- DependencyResolver binds → Service interfaces to implementations
- Repository implementation uses → DbContext → Database
- Cross-cutting concerns (Logging via IAppLogger/Serilog)

##### Architectural Patterns and Principles to Highlight
- Onion Architecture (layers depend only inward)
- Dependency Injection (inversion of control container in .DependencyInjection)
- Repository Pattern (abstraction of data access)
- DTOs & AutoMapper (mapping between domain and transport models)
- FluentValidation (input validation in Application layer)

##### Detailed Capture of Essential Architecture
- Do not omit the DependencyResolver layer—show how it wires interfaces to implementations
- Data-flow through AutoMapper & FluentValidation in the Application layer
- EF Core Migrations under Infrastructure to show schema management
- Configuration files (appsettings.json) feeding into the API for environment settings

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "UI - Angular Client"
        Angular["Angular Client"]:::frontend
    end

    subgraph "API - Presentation"
        Controllers["Controllers"]:::frontend
        Config["Configuration"]:::frontend
        Program["Program & Startup"]:::frontend
        DI["Dependency Resolver"]:::di
    end

    %% Application Layer
    subgraph "Application Layer"
        subgraph "Abstraction"
            Interfaces["Service & Logger Interfaces"]:::app
            DTOs["DTOs"]:::app
        end
        subgraph "Implementation"
            Services["Service Implementations"]:::app
            Validation["Validation (FluentValidation)"]:::app
            Mapping["Mapping (AutoMapper)"]:::app
        end
    end

    %% Domain Layer
    subgraph "Domain Layer"
        Entities["Entities"]:::domain
        RepoInterfaces["Repository Interfaces"]:::domain
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        DbContext["ApplicationDbContext"]:::infra
        Repositories["Repository Implementations"]:::infra
        Logger["SerilogLogger"]:::infra
        Migrations["Migrations"]:::infra
        InfraExt["Infrastructure Extensions"]:::infra
        Database["Database"]:::infra
    end

    %% Data Flows and Dependencies
    Angular -->|"HTTP calls"| Controllers
    Controllers -->|"uses"| Interfaces
    Controllers -->|"configured by"| Config
    Controllers -->|"startup"| Program
    Controllers -->|"DI resolves via"| DI

    Program -->|"wires"| DI
    DI -->|"binds interfaces to"| Services
    DI -->|"binds interfaces to"| Repositories
    DI -->|"binds logger to"| Logger

    Interfaces -->|"implemented by"| Services
    DTOs -->|"mapped by"| Mapping
    DTOs -->|"validated by"| Validation

    Services -->|"use"| RepoInterfaces
    Services -->|"use"| DTOs

    RepoInterfaces -->|"implemented by"| Repositories
    Repositories -->|"use"| DbContext
    DbContext -->|"migrates schema"| Migrations
    DbContext -->|"connects to"| Database

    Services -->|"log via"| Logger
    Controllers -->|"log via"| Logger

    InfraExt -->|"extends"| DI

    %% Click Events
    click Angular "https://github.com/gurau-anil/libmanease/tree/master/LibManEase.Client/"
    click Controllers "https://github.com/gurau-anil/libmanease/tree/master/LibManEase.Api/Controllers/"
    click Config "https://github.com/gurau-anil/libmanease/blob/master/LibManEase.Api/appsettings.json"
    click Program "https://github.com/gurau-anil/libmanease/blob/master/LibManEase.Api/Program.cs"
    click DI "https://github.com/gurau-anil/libmanease/blob/master/LibManEase.DependencyInjection/DependencyResolver.cs"
    click Interfaces "https://github.com/gurau-anil/libmanease/tree/master/LibManEase.Application.Abstraction/Contracts/Services/"
    click DTOs "https://github.com/gurau-anil/libmanease/tree/master/LibManEase.Application.Abstraction/DTOs/"
    click Services "https://github.com/gurau-anil/libmanease/tree/master/LibManEase.Application/Services/"
    click Validation "https://github.com/gurau-anil/libmanease/tree/master/LibManEase.Application/Validators/"
    click Mapping "https://github.com/gurau-anil/libmanease/blob/master/LibManEase.Application/Mappings/MappingProfile.cs"
    click Entities "https://github.com/gurau-anil/libmanease/tree/master/LibManEase.Domain/Entities/"
    click RepoInterfaces "https://github.com/gurau-anil/libmanease/tree/master/LibManEase.Domain/Contracts/"
    click DbContext "https://github.com/gurau-anil/libmanease/blob/master/LibManEase.Infrastructure/Data/ApplicationDbContext.cs"
    click Repositories "https://github.com/gurau-anil/libmanease/tree/master/LibManEase.Infrastructure/Repositories/"
    click Logger "https://github.com/gurau-anil/libmanease/blob/master/LibManEase.Infrastructure/Logger/SerilogLogger.cs"
    click Migrations "https://github.com/gurau-anil/libmanease/tree/master/LibManEase.Infrastructure/Migrations/"
    click InfraExt "https://github.com/gurau-anil/libmanease/blob/master/LibManEase.Infrastructure/InfrastructureServiceExtensions.cs"

    %% Styles
    classDef frontend fill:#cfe2ff,stroke:#084298,color:#084298;
    classDef di fill:#e2d6f3,stroke:#5f3dc4,color:#3f2c8d;
    classDef app fill:#d1e7dd,stroke:#0f5132,color:#0f5132;
    classDef domain fill:#fff3cd,stroke:#664d03,color:#664d03;
    classDef infra fill:#e2e3e5,stroke:#41464b,color:#41464b;
```
