# x0rld/lebonanimal architecture

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

- Interactive diagram: https://gitdiagram.com/x0rld/lebonanimal
- Repository: https://github.com/x0rld/lebonanimal

## Overview

##### Project type and purpose
- This is a C# ASP.NET Core MVC web application (“lebonanimal”) for managing animal classifieds (users can register, post products/annonces, browse, buy; admins can approve or ban).
- It uses Entity Framework Core for persistence and Razor Views/Bootstrap/jQuery for the UI.

##### File structure
- Top-level folders:
- Controllers/           ← MVC controllers handling HTTP requests
- Models/                ← domain entities (User, Product, Category, Order…)
- Views/                 ← Razor (.cshtml) templates under Home, Product, User, Admin, Shared
- Datas/                 ← DbConnect.cs (EntityFramework DbContext configuration)
- Migrations/            ← EF Core migrations for database schema
- wwwroot/               ← static assets (css, js, images, Bootstrap, jQuery libs)
- Program.cs + appsettings*.json ← application entry point and configuration (including user-secrets for DB connection)
- There’s no separate “service” folder, so business logic likely lives in controllers or model classes.

##### README for additional insights
- Focuses on setting the SQL Server connection string via dotnet-user-secrets.
- Confirms use of SQL Server for the relational database.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client
    subgraph "Client"
        Browser["Client Browser\n(mobile/desktop)"]:::presentation
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        Views["Razor Views"]:::presentation
        StaticAssets["Static Assets\n(wwwroot)"]:::presentation
    end

    %% Application Layer
    subgraph "Application Layer"
        Controllers["Controllers"]:::application
        Models["Models & ViewModels"]:::application
    end

    %% Data Layer
    subgraph "Data Layer"
        DbContext["DbConnect (Datas/DbConnect.cs)"]:::data
        Migrations["EF Core Migrations"]:::data
        SQLServer["SQL Server Database"]:::data
    end

    %% External Dependencies
    subgraph "External Dependencies"
        Bootstrap["Bootstrap & jQuery\n(wwwroot/lib)"]:::external
        UserSecrets["dotnet-user-secrets"]:::external
    end

    %% Relationships
    Browser -->|"HTTP GET/POST"| Controllers
    Controllers -->|"uses"| Models
    Controllers -->|"calls"| DbContext
    DbContext -->|"SQL Query/Result"| SQLServer
    Controllers -->|"selects view"| Views
    Browser -->|"requests static files"| StaticAssets
    StaticAssets -->|"serves CSS/JS/Images"| Browser
    Migrations -->|"sync schema"| SQLServer
    UserSecrets -->|"provides connection string"| DbContext
    Bootstrap -->|"served from"| StaticAssets

    %% Click Events for Controllers
    click Controllers "https://github.com/x0rld/lebonanimal/tree/master/Controllers"
    click HomeController "https://github.com/x0rld/lebonanimal/blob/master/Controllers/HomeController.cs"
    click ProductController "https://github.com/x0rld/lebonanimal/blob/master/Controllers/ProductController.cs"
    click UserController "https://github.com/x0rld/lebonanimal/blob/master/Controllers/UserController.cs"
    click AdminController "https://github.com/x0rld/lebonanimal/blob/master/Controllers/AdminController.cs"

    %% Click Events for DbContext
    click DbContext "https://github.com/x0rld/lebonanimal/blob/master/Datas/DbConnect.cs"

    %% Click Events for Models
    click Models "https://github.com/x0rld/lebonanimal/tree/master/Models"
    click User "https://github.com/x0rld/lebonanimal/blob/master/Models/User.cs"
    click Product "https://github.com/x0rld/lebonanimal/blob/master/Models/Product.cs"
    click Category "https://github.com/x0rld/lebonanimal/blob/master/Models/Category.cs"
    click Order "https://github.com/x0rld/lebonanimal/blob/master/Models/Order.cs"
    click UserLogin "https://github.com/x0rld/lebonanimal/blob/master/Models/UserLogin.cs"
    click UserProductsOrdered "https://github.com/x0rld/lebonanimal/blob/master/Models/UserProductsOrdered.cs"
    click ErrorViewModel "https://github.com/x0rld/lebonanimal/blob/master/Models/ErrorViewModel.cs"

    %% Click Events for Views
    click Views "https://github.com/x0rld/lebonanimal/tree/master/Views"
    click HomeIndex "https://github.com/x0rld/lebonanimal/blob/master/Views/Home/Index.cshtml"
    click HomePrivacy "https://github.com/x0rld/lebonanimal/blob/master/Views/Home/Privacy.cshtml"
    click ProductIndex "https://github.com/x0rld/lebonanimal/blob/master/Views/Product/Index.cshtml"
    click ProductDetails "https://github.com/x0rld/lebonanimal/blob/master/Views/Product/Details.cshtml"
    click ProductCreate "https://github.com/x0rld/lebonanimal/blob/master/Views/Product/Create.cshtml"
    click ProductEdit "https://github.com/x0rld/lebonanimal/blob/master/Views/Product/Edit.cshtml"
    click ProductDelete "https://github.com/x0rld/lebonanimal/blob/master/Views/Product/Delete.cshtml"
    click ProductBuy "https://github.com/x0rld/lebonanimal/blob/master/Views/Product/Buy.cshtml"
    click UserLoginView "https://github.com/x0rld/lebonanimal/blob/master/Views/User/Login.cshtml"
    click UserRegister "https://github.com/x0rld/lebonanimal/blob/master/Views/User/Register.cshtml"
    click UserIndex "https://github.com/x0rld/lebonanimal/blob/master/Views/User/Index.cshtml"
    click UserCreate "https://github.com/x0rld/lebonanimal/blob/master/Views/User/Create.cshtml"
    click UserEdit "https://github.com/x0rld/lebonanimal/blob/master/Views/User/Edit.cshtml"
    click UserDelete "https://github.com/x0rld/lebonanimal/blob/master/Views/User/Delete.cshtml"
    click UserDetails "https://github.com/x0rld/lebonanimal/blob/master/Views/User/Details.cshtml"
    click UserAddAnnonce "https://github.com/x0rld/lebonanimal/blob/master/Views/User/AddAnnonce.cshtml"
    click UserAdminPage "https://github.com/x0rld/lebonanimal/blob/master/Views/User/AdminPage.cshtml"
    click UserListPublished "https://github.com/x0rld/lebonanimal/blob/master/Views/User/ListPublishedProducts.cshtml"
    click UserProfil "https://github.com/x0rld/lebonanimal/blob/master/Views/User/ProfilClient.cshtml"
    click UserProductsOrderedView "https://github.com/x0rld/lebonanimal/blob/master/Views/User/UserProductsOrdered.cshtml"
    click AdminIndex "https://github.com/x0rld/lebonanimal/blob/master/Views/Admin/Index.cshtml"
    click AdminApproveProduct "https://github.com/x0rld/lebonanimal/blob/master/Views/Admin/Product/ApproveProduct.cshtml"
    click AdminDeletedProduct "https://github.com/x0rld/lebonanimal/blob/master/Views/Admin/Product/DeletedProduct.cshtml"
    click AdminUnbanUser "https://github.com/x0rld/lebonanimal/blob/master/Views/Admin/User/UnbanUser.cshtml"
    click SharedLayout "https://github.com/x0rld/lebonanimal/blob/master/Views/Shared/_Layout.cshtml"
    click SharedValidation "https://github.com/x0rld/lebonanimal/blob/master/Views/Shared/_ValidationScriptsPartial.cshtml"
    click SharedError "https://github.com/x0rld/lebonanimal/blob/master/Views/Shared/Error.cshtml"

    %% Click Events for Migrations
    click Migrations "https://github.com/x0rld/lebonanimal/tree/master/Migrations"
    click Migration1 "https://github.com/x0rld/lebonanimal/blob/master/Migrations/20220210105039_initialMigration.*"
    click Migration2 "https://github.com/x0rld/lebonanimal/blob/master/Migrations/20220214123928_addNonNullableCertificate.*"
    click Migration3 "https://github.com/x0rld/lebonanimal/blob/master/Migrations/20220216105742_nouveu test.*"
    click MigrationSnapshot "https://github.com/x0rld/lebonanimal/blob/master/Migrations/DbConnectModelSnapshot.cs"

    %% Click Events for Configuration
    click Program "https://github.com/x0rld/lebonanimal/blob/master/Program.cs"
    click AppSettings "https://github.com/x0rld/lebonanimal/blob/master/appsettings.json"
    click AppSettingsDev "https://github.com/x0rld/lebonanimal/blob/master/appsettings.Development.json"

    %% Click Events for Static Assets
    click StaticAssets "https://github.com/x0rld/lebonanimal/tree/master/wwwroot"
    click CSS "https://github.com/x0rld/lebonanimal/blob/master/wwwroot/css/site.css"
    click JS "https://github.com/x0rld/lebonanimal/blob/master/wwwroot/js/site.js"
    click LibBootstrap "https://github.com/x0rld/lebonanimal/tree/master/wwwroot/lib/bootstrap"
    click LibJQuery "https://github.com/x0rld/lebonanimal/tree/master/wwwroot/lib/jquery"
    click Img "https://github.com/x0rld/lebonanimal/tree/master/wwwroot/img"

    %% Styles
    classDef presentation fill:#cce5ff,stroke:#004085,color:#004085
    classDef application fill:#d4edda,stroke:#155724,color:#155724
    classDef data fill:#fff3cd,stroke:#856404,color:#856404
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#383d41
```
