# s35241607/lan-side-project architecture

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

- Interactive diagram: https://gitdiagram.com/s35241607/lan-side-project
- Repository: https://github.com/s35241607/lan-side-project

## Overview

##### High-Level Architecture Components

a) Frontend Layer (Top)
- React Client (Primary)
- Vue Client (Secondary/Alternative)
- Shared components like authentication, layouts, and state management

b) API Gateway/Backend Layer (Middle)
- ASP.NET Core 8 API
- Authentication/Authorization services
- Controllers layer
- Business Services layer
- Repository layer

c) Data Layer (Bottom)
- PostgreSQL Database
- Entity Framework Core context
- Migrations

##### Detailed Component Breakdown

Frontend Section:
- Modules:
- State Management (Redux/Pinia)
- API Integration Layer
- Authentication Components
- Layout Components
- View Components

Backend Section:
- Create distinct layers for:
- Controllers (AuthController, UserController, RoleController, etc.)
- Services (AuthService, UserService, RoleService, MailService)
- Repositories (Generic Repository pattern)
- Middleware (Exception Handling, Logging)
- Common Utilities (JWT, Mapper)

##### Connection Flows

- HTTP/HTTPS API calls between frontend and backend
- Database operations through Entity Framework
- Authentication flows (JWT token flow)
- File storage operations for user images
- Email service interactions

##### Technical Details

Annotations for:
- Technology versions (.NET 8, React/Vue, PostgreSQL)
- Communication protocols (REST)
- Security mechanisms (JWT)
- Database access (Entity Framework Core)
- State management solutions

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef frontend fill:#3498db,color:white
    classDef backend fill:#2ecc71,color:white
    classDef database fill:#9b59b6,color:white
    classDef security fill:#f1c40f,color:black
    classDef external fill:#e67e22,color:white
    classDef middleware fill:#95a5a6,color:white

    %% Frontend Layer
    subgraph Frontend
        React["React Client"]:::frontend
        Vue["Vue Client"]:::frontend
        StateManagement["State Management\n(Redux/Pinia)"]:::frontend
        AuthComponents["Authentication\nComponents"]:::frontend
        LayoutComponents["Layout Components"]:::frontend
        ViewComponents["View Components"]:::frontend
        APIIntegration["API Integration"]:::frontend
    end

    %% Backend Layer
    subgraph Backend
        APIGateway["ASP.NET Core 8 API"]:::backend
        
        subgraph Controllers
            AuthController["Auth Controller"]:::backend
            UserController["User Controller"]:::backend
            RoleController["Role Controller"]:::backend
        end
        
        subgraph Services
            AuthService["Auth Service"]:::backend
            UserService["User Service"]:::backend
            RoleService["Role Service"]:::backend
            MailService["Mail Service"]:::external
        end
        
        subgraph Middleware
            ExceptionMiddleware["Exception Handling"]:::middleware
            LoggingMiddleware["Logging (Serilog)"]:::middleware
        end
        
        subgraph Utils
            JWTUtils["JWT Utils"]:::security
            Mapper["Object Mapper"]:::backend
        end
        
        Repository["Generic Repository"]:::backend
    end

    %% Data Layer
    subgraph Data
        DBContext["EF Core Context"]:::database
        PostgreSQL[(PostgreSQL)]:::database
        Migrations["DB Migrations"]:::database
        Models["Data Models"]:::database
        DTOs["DTOs"]:::database
    end

    %% Connections
    React --> APIIntegration
    Vue --> APIIntegration
    APIIntegration --> APIGateway
    
    AuthComponents --> StateManagement
    ViewComponents --> StateManagement
    
    APIGateway --> Controllers
    Controllers --> Services
    Services --> Repository
    Repository --> DBContext
    DBContext --> PostgreSQL
    
    AuthService --> JWTUtils
    APIGateway --> ExceptionMiddleware
    APIGateway --> LoggingMiddleware

    %% Click Events
    click React "https://github.com/s35241607/lan-side-project/tree/main/frontend/react/src"
    click Vue "https://github.com/s35241607/lan-side-project/tree/main/frontend/vue/src"
    click StateManagement "https://github.com/s35241607/lan-side-project/tree/main/frontend/react/src/stores"
    click AuthComponents "https://github.com/s35241607/lan-side-project/blob/main/frontend/react/src/components/login.tsx"
    click LayoutComponents "https://github.com/s35241607/lan-side-project/tree/main/frontend/react/src/components/layout"
    click ViewComponents "https://github.com/s35241607/lan-side-project/tree/main/frontend/react/src/views"
    click APIIntegration "https://github.com/s35241607/lan-side-project/tree/main/frontend/react/src/api"
    click Controllers "https://github.com/s35241607/lan-side-project/tree/main/backend/lan-side-project/Controllers"
    click AuthService "https://github.com/s35241607/lan-side-project/blob/main/backend/lan-side-project/Services/AuthService.cs"
    click UserService "https://github.com/s35241607/lan-side-project/blob/main/backend/lan-side-project/Services/UserService.cs"
    click RoleService "https://github.com/s35241607/lan-side-project/blob/main/backend/lan-side-project/Services/RoleService.cs"
    click MailService "https://github.com/s35241607/lan-side-project/blob/main/backend/lan-side-project/Services/MailService.cs"
    click Repository "https://github.com/s35241607/lan-side-project/tree/main/backend/lan-side-project/Repositories"
    click DBContext "https://github.com/s35241607/lan-side-project/blob/main/backend/lan-side-project/Data/AppDbContext.cs"
    click Migrations "https://github.com/s35241607/lan-side-project/tree/main/backend/lan-side-project/Migrations"
    click JWTUtils "https://github.com/s35241607/lan-side-project/blob/main/backend/lan-side-project/Utils/JwtUtils.cs"
    click ExceptionMiddleware "https://github.com/s35241607/lan-side-project/blob/main/backend/lan-side-project/Middlewares/ExceptionHandlingMiddleware.cs"
    click LoggingMiddleware "https://github.com/s35241607/lan-side-project/blob/main/backend/lan-side-project/Middlewares/SerilogHttpSessionsLoggingMiddleware.cs"
    click Models "https://github.com/s35241607/lan-side-project/tree/main/backend/lan-side-project/Models"
    click DTOs "https://github.com/s35241607/lan-side-project/tree/main/backend/lan-side-project/DTOs"
```
