# kaivals/mylittlev2 architecture

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

- Interactive diagram: https://gitdiagram.com/kaivals/mylittlev2
- Repository: https://github.com/kaivals/mylittlev2

## Overview

##### Project type and purpose
- This is a monolithic .NET 9.0 Web API implementing a layered, Domain-Driven-Design-inspired architecture.
- The solution exposes REST endpoints (Controllers), orchestrates business logic (Application layer), manages persistence (Infrastructure layer), and defines core entities (Domain layer).

##### File structure
- Top level:
- mylittle-project (Presentation/WebAPI)
- mylittle-project.Application (Application services, DTOs, interfaces, UoW)
- mylittle-project.Domain (Entities, enums)
- mylittle-project.infrastructure (EF DbContext, repositories, service implementations)
- Patterns:
- Controllers → Application interfaces → Infrastructure services → EF Core DbContext
- Repository + Unit of Work
- DTOs for request/response models
- Configuration:
- appsettings.Development.json for connection strings
- launchSettings.json for local IIS/Kestrel
- Program.cs wiring up DI for interfaces and implementations

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layers and Components
    Client["API Client (e.g., Postman)"]:::external

    Controllers["WebAPI Controllers"]:::presentation
    Program["Program & DI Configuration"]:::presentation

    subgraph "Application Layer"
        DTOs["DTOs"]:::application
        Interfaces["Service Interfaces"]:::application
        UoWIface["IUnitOfWork Interface"]:::application
    end

    subgraph "Domain Layer"
        Entities["Core Entities"]:::domain
        Enums["Domain Enums"]:::domain
    end

    subgraph "Infrastructure Layer"
        DbContext["AppDbContext"]:::infrastructure
        GenRepo["GenericRepository"]:::infrastructure
        UoWImpl["UnitOfWork Implementation"]:::infrastructure
        EmailSvc["EmailSendService"]:::infrastructure
        VirtualSvc["VirtualNumberService"]:::infrastructure
        OtherSvc["Domain Service Implementations"]:::infrastructure
    end

    Database["Database (SQL Server)"]:::database
    SMTP["SMTP Server"]:::external
    SMS["SMS Gateway"]:::external

    %% Relationships
    Client -->|"HTTP Requests"| Controllers
    Controllers -->|"calls"| Interfaces
    Controllers -->|"uses"| UoWIface

    Program --> Interfaces
    Program --> UoWIface
    Program --> OtherSvc
    Program --> UoWImpl
    Program --> EmailSvc
    Program --> VirtualSvc

    Interfaces -->|"implemented by"| OtherSvc
    UoWIface -->|"implemented by"| UoWImpl

    OtherSvc -->|"uses"| DbContext
    OtherSvc -->|"sends email via"| EmailSvc
    OtherSvc -->|"sends SMS via"| VirtualSvc

    UoWImpl -->|"manages repos"| GenRepo
    UoWImpl -->|"uses"| DbContext
    GenRepo -->|"operates on"| DbContext

    DbContext -->|"reads/writes"| Database
    EmailSvc -->|"SMTP"| SMTP
    VirtualSvc -->|"HTTP/API"| SMS

    %% Click Events
    click Controllers "https://github.com/kaivals/mylittlev2/tree/main/mylittle-project/Controllers/"
    click Program "https://github.com/kaivals/mylittlev2/blob/main/mylittle-project/Program.cs"
    click DTOs "https://github.com/kaivals/mylittlev2/tree/main/mylittle-project.Application/DTOs/"
    click Interfaces "https://github.com/kaivals/mylittlev2/tree/main/mylittle-project.Application/Interfaces/"
    click UoWIface "https://github.com/kaivals/mylittlev2/blob/main/mylittle-project.Application/Interfaces/IUnitOfWork.cs"
    click Entities "https://github.com/kaivals/mylittlev2/tree/main/mylittle-project.Domain/Entities/"
    click Enums "https://github.com/kaivals/mylittlev2/blob/main/mylittle-project.Domain/Enums/Enums.cs"
    click DbContext "https://github.com/kaivals/mylittlev2/blob/main/mylittle-project.infrastructure/Data/AppDbContext.cs"
    click GenRepo "https://github.com/kaivals/mylittlev2/blob/main/mylittle-project.infrastructure/Repositories/GenericRepository.cs"
    click UoWImpl "https://github.com/kaivals/mylittlev2/blob/main/mylittle-project.infrastructure/Services/UnitOfWork.cs"
    click EmailSvc "https://github.com/kaivals/mylittlev2/blob/main/mylittle-project.infrastructure/Services/EmailSendService.cs"
    click VirtualSvc "https://github.com/kaivals/mylittlev2/blob/main/mylittle-project.infrastructure/Services/VirtualNumberService.cs"
    click OtherSvc "https://github.com/kaivals/mylittlev2/tree/main/mylittle-project.infrastructure/Services/"
    click AppSettings "https://github.com/kaivals/mylittlev2/blob/main/mylittle-project/appsettings.Development.json"
    click LaunchSettings "https://github.com/kaivals/mylittlev2/blob/main/mylittle-project/Properties/launchSettings.json"

    %% Styles
    classDef presentation fill:#D0E8FF,stroke:#1E90FF,color:#000;
    classDef application fill:#E0FFE0,stroke:#28A745,color:#000;
    classDef domain fill:#FFF5BA,stroke:#FFD700,color:#000;
    classDef infrastructure fill:#FFE8C0,stroke:#FF8C00,color:#000;
    classDef database fill:#E8E8E8,stroke:#696969,color:#000;
    classDef external fill:#F5E6FF,stroke:#800080,color:#000;
```
