# furkanisitan/dotnet-5-web-api-sample architecture

> Architecture diagram of the GitHub repository furkanisitan/dotnet-5-web-api-sample, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/furkanisitan/dotnet-5-web-api-sample
- Repository: https://github.com/furkanisitan/dotnet-5-web-api-sample

## Overview

##### Main Components

a. Presentation Layer:
- Shop.WebAPI (REST API Layer)
- Controllers (v1)
- Infrastructure (DI, AutoMapper)
- Models

b. Business Layer:
- Shop.Business
- Abstract (Service Interfaces)
- Concrete (Service Implementations)
- Validation Rules
- Dependency Resolvers

c. Data Access Layer:
- Shop.DataAccess
- Abstract (Repository Interfaces)
- Concrete (EntityFramework Implementations)
- Database Context and Configurations

d. Domain Layer:
- Shop.Entities
- Concrete Entities
- DTOs

e. Core Layer:
- Cross-Cutting Concerns
- Exception Handling
- Validation
- Authentication
- Generic Repository Pattern
- Aspect-Oriented Programming

**[Client Applications] → [Shop.WebAPI]**
- ↑               ↓
- [Authentication] ← [Business Layer]
- ↓
- [Data Access Layer]
- ↓
- [Database]

##### Important Elements to Highlight

- JWT Authentication Flow
- Cross-Cutting Concerns:
- Exception handling
- Validation
- PostSharp aspects
- Repository Pattern Implementation
- Service Layer Pattern
- Entity Relationships

##### Relationships

- HTTP request flow
- Service dependencies
- Repository usage
- Database interactions
- Cross-cutting concern implementations

##### Technical Details

- EntityFramework Core usage
- Autofac dependency injection
- FluentValidation implementation
- JWT token authentication
- AutoMapper configurations

## Diagram (Mermaid)

```mermaid
%%{init: {'theme': 'base', 'themeVariables': { 'fontSize': '16px'}}}%%
flowchart TB
    subgraph Client["Client Applications"]
        direction TB
        WebClient["Web Client"]
        MobileClient["Mobile Client"]
    end

    subgraph API["API Layer"]
        direction TB
        Controllers["Controllers (v1)"]:::api
        APIModels["API Models"]:::api
    end

    subgraph Business["Business Layer"]
        direction TB
        Services["Business Services"]:::business
        Managers["Business Managers"]:::business
        DI["Dependency Injection"]:::business
    end

    subgraph Data["Data Access Layer"]
        direction TB
        Repos["EF Repositories"]:::data
        DbContext["Database Context"]:::data
        EntityConfig["Entity Configurations"]:::data
    end

    subgraph Entities["Entity Layer"]
        direction TB
        DomainModels["Domain Models"]:::entity
        DTOs["Data Transfer Objects"]:::entity
    end

    subgraph Core["Core Infrastructure"]
        direction TB
        Auth["Authentication"]:::core
        Validation["Validation Framework"]:::core
        ExceptionHandling["Exception Handling"]:::core
        BaseRepo["Base Repository"]:::core
        AOP["Aspect-Oriented Programming"]:::core
    end

    Client --> Controllers
    Controllers --> Services
    Services --> Managers
    Managers --> Repos
    Repos --> DbContext
    DbContext --> DomainModels
    Controllers --> APIModels
    Managers --> DTOs
    
    Core --> API
    Core --> Business
    Core --> Data
    Core --> Entities

    classDef api fill:#2196F3,stroke:#1565C0,color:white
    classDef business fill:#4CAF50,stroke:#2E7D32,color:white
    classDef data fill:#FFC107,stroke:#FFA000,color:black
    classDef core fill:#9E9E9E,stroke:#616161,color:white
    classDef entity fill:#9C27B0,stroke:#7B1FA2,color:white

    click Controllers "https://github.com/furkanisitan/dotnet-5-web-api-sample/tree/main/Shop.WebAPI/Controllers/v1"
    click Services "https://github.com/furkanisitan/dotnet-5-web-api-sample/tree/main/Shop.Business/Abstract"
    click Managers "https://github.com/furkanisitan/dotnet-5-web-api-sample/tree/main/Shop.Business/Concrete/Managers"
    click Repos "https://github.com/furkanisitan/dotnet-5-web-api-sample/tree/main/Shop.DataAccess/Concrete/EntityFramework"
    click DbContext "https://github.com/furkanisitan/dotnet-5-web-api-sample/blob/main/Shop.DataAccess/Concrete/EntityFramework/Configuration/ApplicationDbContext.cs"
    click DomainModels "https://github.com/furkanisitan/dotnet-5-web-api-sample/tree/main/Shop.Entities/Concrete"
    click DTOs "https://github.com/furkanisitan/dotnet-5-web-api-sample/tree/main/Shop.Entities/DTOs"
    click Auth "https://github.com/furkanisitan/dotnet-5-web-api-sample/tree/main/Core/Utilities/Authentication/TokenBased"
    click Validation "https://github.com/furkanisitan/dotnet-5-web-api-sample/tree/main/Core/CrossCuttingConcerns/Validation/FluentValidation"
    click ExceptionHandling "https://github.com/furkanisitan/dotnet-5-web-api-sample/tree/main/Core/CrossCuttingConcerns/ExceptionHandling"
    click BaseRepo "https://github.com/furkanisitan/dotnet-5-web-api-sample/blob/main/Core/DataAccess/EntityFramework/EfRepository.cs"
    click DI "https://github.com/furkanisitan/dotnet-5-web-api-sample/tree/main/Shop.Business/DependencyResolvers/Autofac"
    click AOP "https://github.com/furkanisitan/dotnet-5-web-api-sample/tree/main/Core/Aspects/Postsharp"
    click EntityConfig "https://github.com/furkanisitan/dotnet-5-web-api-sample/tree/main/Shop.DataAccess/Concrete/EntityFramework/Configuration/Mappings"
    click APIModels "https://github.com/furkanisitan/dotnet-5-web-api-sample/tree/main/Shop.WebAPI/Models"
```
