# justfrenzy22/yanstribe architecture

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

- Interactive diagram: https://gitdiagram.com/justfrenzy22/yanstribe
- Repository: https://github.com/justfrenzy22/yanstribe

## Overview

Based on our analysis of the file tree and README, this project is a full‐stack social media application (named “YansTribe”) inspired by Facebook and Instagram. It comprises a client-side front-end (built with Next.js/React and Tailwind CSS), a robust server-side back-end (an ASP.NET MVC application with controllers, views, and services), a clearly defined data access layer (DAL and the similar DALe projects that encapsulate database interactions and repository patterns), core domain logic (in the “core” directory with entities, models, and mappers), and an underlying SQL database (with an SQL creation script provided). Additionally, there is a testing project (“TestBackend”) to run integration/unit tests against the back-end logic.

##### Main Components
- Client (Front-end):
- “client” directory containing Next.js configuration, React components, API utilities, and styling (tailwind.config, css files).
- That it handles user interactions, authentication flows, and presentation.
- Server (Back-end):
- “server” folder containing Controllers (AdminController, UserController, HomeController, BaseController), Services (AuthService, HashService), Managers, Mappers, and Views.
- MVC structure (Controllers, Views, Models) and integration with authentication and business logic.
- Data Access Layer (DAL/DALe):
- Components from “DAL” and “DALe” directories responsible for repositories, query building (queries directory), requests, responses, and exception handling.
- Use of interfaces and repository patterns.
- Core Domain:
- “core” folder that houses domain entities (like User, Post, Chat, Comment, etc.), enums (e.g., Role, FriendStatus), and mappers.
- Database:
- Use the “database” folder and DB scripts to indicate the persistence mechanism.
- Testing:
- A component for “TestBackend” where MSTest-based tests run to validate back-end functionality.
- External Integration/Configuration:
- Components for CI/CD integration (as alluded to in the README) and deployment settings (the presence of appsettings.json, environment files, and GitLab CI configuration notes).

##### Relationships and Data Flow
- Within the Server, indicate the flow from Controllers to Services/Managers and onward to the Data Access Layer.
- DAL interacting with the Database for queries, insertions, updates, and deletions.
- Optionally, demonstrate the Core as the shared set of models/entities used by both the Server and DAL components.
- In testing flows, note that TestBackend simulates calls into these server endpoints or DAL methods.

##### Architectural Patterns & Design Principles
- Layered architecture: Clearly separate presentation (Client), business logic (Server/Services), data access (DAL/DALe), and domain models (Core).
- MVC pattern in the server-side: Controllers managing requests, Services performing business logic, and Views responsible for rendering responses.
- Use of Repository and Mapper patterns in the DAL and Core layers.
- Dependency inversion through interfaces (see interfaces folders in DAL and server).

##### Technologies and Frameworks
- Client uses Next.js, React, Tailwind CSS, and likely ESLint for code quality.
- The back-end is built with ASP.NET (with MVC patterns), using C# projects (.csproj).
- Database integration is SQL-based (with provided SQL creation queries in the “database” folder).
- Testing is done using MSTest (TestBackend project).
- Version control and CI/CD practices are integrated per GitLab guidelines shown in the README.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client - Next.js Frontend"
        Client["Client Application"]:::client
    end

    subgraph "Server - ASP.NET MVC"
        Controllers["Controllers"]:::server
        Services["Services & Managers"]:::server
        Views["Views"]:::server
    end

    subgraph "Data Access Layer"
        DAL["DAL Repository"]:::dal
        DALe["DALe Repository"]:::dal
    end

    subgraph "Core Domain"
        Entities["Entities"]:::core
        Enums["Enums"]:::core
        Mappers["Mappers"]:::core
    end

    subgraph "Database"
        SQL["SQL Script"]:::database
    end

    subgraph "Testing"
        TestSuite["MSTest TestBackend"]:::testing
    end

    Client -->|"APIcalls"| Controllers
    Controllers -->|"invoke"| Services
    Services -->|"calldataaccess"| DAL
    Services -->|"calldataaccess"| DALe
    DAL -->|"CRUDoperations"| SQL
    DALe -->|"CRUDoperations"| SQL
    Services -->|"usessharedModel"| Entities
    Services -->|"usessharedEnum"| Enums
    Services -->|"usessharedMapper"| Mappers
    DAL -->|"mapstowithmapper"| Mappers
    DALe -->|"mapstowithmapper"| Mappers
    TestSuite -->|"testsendpoint"| Controllers
    TestSuite -->|"testsmethods"| DAL
    TestSuite -->|"testsmethods"| DALe

    click Client "https://github.com/justfrenzy22/yanstribe/tree/main/client"
    click Controllers "https://github.com/justfrenzy22/yanstribe/tree/main/server/Controllers"
    click Services "https://github.com/justfrenzy22/yanstribe/tree/main/server/services"
    click Views "https://github.com/justfrenzy22/yanstribe/tree/main/server/Views"
    click DAL "https://github.com/justfrenzy22/yanstribe/tree/main/DAL"
    click DALe "https://github.com/justfrenzy22/yanstribe/tree/main/DALe"
    click Entities "https://github.com/justfrenzy22/yanstribe/tree/main/core/entities"
    click Enums "https://github.com/justfrenzy22/yanstribe/tree/main/core/enums"
    click Mappers "https://github.com/justfrenzy22/yanstribe/tree/main/core/mapper"
    click SQL "https://github.com/justfrenzy22/yanstribe/blob/main/database/creation_query.sql"
    click TestSuite "https://github.com/justfrenzy22/yanstribe/tree/main/TestBackend"

    classDef client fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef server fill:#FFD966,stroke:#000,stroke-width:2px;
    classDef dal fill:#F4CCCC,stroke:#000,stroke-width:2px;
    classDef core fill:#D9EAD3,stroke:#000,stroke-width:2px;
    classDef database fill:#EAD1DC,stroke:#000,stroke-width:2px;
    classDef testing fill:#D0E0E3,stroke:#000,stroke-width:2px;
```
