# sugrado/car-rental-dotnet architecture

> Architecture diagram of the GitHub repository sugrado/car-rental-dotnet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sugrado/car-rental-dotnet
- Repository: https://github.com/sugrado/car-rental-dotnet

## Overview

##### Project Type and Purpose
This is a .NET-based N-tier architecture project implementing a daily car rental system with features like authentication, image management, and payment processing.

##### Main Architectural Components

- Presentation Layer (WebAPI)
- Business Layer
- Data Access Layer
- Core Layer (Infrastructure)
- Entities Layer

B. Cross-Cutting Concerns (Show as horizontal layers):
- Authentication/Authorization
- Caching
- Validation
- Exception Handling
- Logging
- Transaction Management

**[Client Applications] → [WebAPI Layer]**
- ↓
**[Business Layer + Aspects]**
- ↓
**[Data Access Layer]**
- ↓
**[Database]**

##### Important Relationships to Highlight

- JWT authentication flow
- Demonstrate the image upload process flow
- Rental process workflow
- Payment system integration
- Caching mechanism interaction
- Validation flow

##### Technical Elements

- Entity Framework Core
- Autofac IoC Container
- JWT Authentication
- Fluent Validation
- File Storage System
- Caching System
- Error Handling Middleware

##### Specific Implementation Details

- Synchronous operations
- Aspect interceptors
- Validation flows
- Authentication checks
- Database operations

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        CL[Client Applications]
    end

    subgraph "Presentation Layer"
        API["WebAPI"]:::api
        CTRL["Controllers"]:::controller
        START["Startup Configuration"]:::config
    end

    subgraph "Business Layer"
        BL["Business Services"]:::business
        VAL["Validation Rules"]:::validation
        IOC["Autofac IoC Container"]:::ioc
        SEC["Security Operations"]:::security
    end

    subgraph "Data Access Layer"
        DAL["Data Access"]:::dal
        EF["Entity Framework"]:::ef
        IM["In-Memory Implementation"]:::inmem
        REPO["Repository Pattern"]:::repo
    end

    subgraph "Core Infrastructure"
        CORE["Core Components"]:::core
        JWT["JWT Authentication"]:::security
        CACHE["Caching System"]:::cache
        EXC["Exception Handling"]:::error
        LOG["Logging"]:::logging
        TRANS["Transaction Management"]:::transaction
    end

    subgraph "Entities Layer"
        ENT["Domain Models"]:::entity
        DTO["DTOs"]:::dto
    end

    subgraph "Cross-Cutting Concerns"
        ASP["Aspects"]:::aspect
        VAL_ASP["Validation Aspects"]:::validation
        CACHE_ASP["Cache Aspects"]:::cache
        SEC_ASP["Security Aspects"]:::security
        TRANS_ASP["Transaction Aspects"]:::transaction
    end

    CL --> API
    API --> CTRL
    API --> START
    CTRL --> BL
    BL --> DAL
    DAL --> EF
    DAL --> IM
    DAL --> REPO
    BL --> VAL
    BL --> IOC
    BL --> SEC
    DAL --> ENT
    BL --> DTO
    CORE --> JWT
    CORE --> CACHE
    CORE --> EXC
    CORE --> LOG
    CORE --> TRANS
    ASP --> VAL_ASP
    ASP --> CACHE_ASP
    ASP --> SEC_ASP
    ASP --> TRANS_ASP

    %% Click Events
    click API "https://github.com/sugrado/car-rental-dotnet/tree/master/WebAPI"
    click CTRL "https://github.com/sugrado/car-rental-dotnet/tree/master/WebAPI/Controllers"
    click START "https://github.com/sugrado/car-rental-dotnet/blob/master/WebAPI/Startup.cs"
    click BL "https://github.com/sugrado/car-rental-dotnet/tree/master/Business"
    click VAL "https://github.com/sugrado/car-rental-dotnet/tree/master/Business/ValidationRules/FluentValdiation"
    click SEC "https://github.com/sugrado/car-rental-dotnet/blob/master/Business/BusinessAspects/Autofac/SecuredOperation.cs"
    click IOC "https://github.com/sugrado/car-rental-dotnet/blob/master/Business/DependencyResolvers/Autofac/AutofacBusinessModule.cs"
    click DAL "https://github.com/sugrado/car-rental-dotnet/tree/master/DataAccess"
    click EF "https://github.com/sugrado/car-rental-dotnet/tree/master/DataAccess/Concrete/EntityFramework"
    click IM "https://github.com/sugrado/car-rental-dotnet/tree/master/DataAccess/Concrete/InMemory"
    click REPO "https://github.com/sugrado/car-rental-dotnet/blob/master/Core/DataAccess/IEntityRepository.cs"
    click ENT "https://github.com/sugrado/car-rental-dotnet/tree/master/Entities/Concrete"
    click DTO "https://github.com/sugrado/car-rental-dotnet/tree/master/Entities/DTOs"
    click JWT "https://github.com/sugrado/car-rental-dotnet/tree/master/Core/Utilities/Security/JWT"
    click CACHE "https://github.com/sugrado/car-rental-dotnet/tree/master/Core/CrossCuttingConcers/Caching"
    click EXC "https://github.com/sugrado/car-rental-dotnet/blob/master/Core/Extensions/ExceptionMiddleware.cs"
    click TRANS "https://github.com/sugrado/car-rental-dotnet/blob/master/Core/Aspects/Autofac/Transaction/TransactionScopeAspect.cs"

    %% Styles
    classDef api fill:#f9f,stroke:#333,stroke-width:2px
    classDef controller fill:#bbf,stroke:#333,stroke-width:2px
    classDef config fill:#fbb,stroke:#333,stroke-width:2px
    classDef business fill:#bfb,stroke:#333,stroke-width:2px
    classDef validation fill:#fbf,stroke:#333,stroke-width:2px
    classDef ioc fill:#ffb,stroke:#333,stroke-width:2px
    classDef security fill:#f88,stroke:#333,stroke-width:2px
    classDef dal fill:#8ff,stroke:#333,stroke-width:2px
    classDef ef fill:#8f8,stroke:#333,stroke-width:2px
    classDef inmem fill:#ff8,stroke:#333,stroke-width:2px
    classDef repo fill:#f8f,stroke:#333,stroke-width:2px
    classDef core fill:#888,stroke:#333,stroke-width:2px
    classDef cache fill:#faa,stroke:#333,stroke-width:2px
    classDef error fill:#f44,stroke:#333,stroke-width:2px
    classDef logging fill:#4f4,stroke:#333,stroke-width:2px
    classDef transaction fill:#44f,stroke:#333,stroke-width:2px
    classDef entity fill:#484,stroke:#333,stroke-width:2px
    classDef dto fill:#848,stroke:#333,stroke-width:2px
    classDef aspect fill:#448,stroke:#333,stroke-width:2px
```
