# abdulrahman-aldoais/schoolprojectewithcleanarchitecture architecture

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

- Interactive diagram: https://gitdiagram.com/abdulrahman-aldoais/schoolprojectewithcleanarchitecture
- Repository: https://github.com/abdulrahman-aldoais/schoolprojectewithcleanarchitecture

## Overview

##### Project Type and Purpose
- This is a .NET-based web application implemented with a Clean Architecture approach.
- It serves as a school management system that handles functionalities for managing departments, students, users (authentication and authorization), and other administrative features.
- The system is organized into multiple layers such as Domain, Application, Persistence, and a Presentation (MVC) layer, ensuring separation of concerns and maintainability.

##### Analyzing the File Structure
- The top-level directories (Core.Application, School.Application, School.Domain, Core.Persistence, School.Persistence, and SochoolProjecte) indicate the layered architecture.
- The “Core” and “School” projects are used to implement business logic (e.g., features for Auth, Departments, Students, User) and domain models (entities, enums, result types) respectively.
- The Persistence layers (Core.Persistence, School.Persistence) define repositories, configurations, the SchoolDbContext, and migration scripts – all aimed at data access.
- The “SochoolProjecte” folder contains MVC controllers, views (for departments, students, users, and login), models, and configuration files (appsettings.json) serving as the presentation layer.
- Build outputs and configurations (e.g., .csproj, bin, obj folders) further confirm a strongly structured multi-layer architecture based on Clean Architecture principles.

##### Reviewing the README
- The README identifies the project as “SchoolProjecteWithCleanArchitecture” and provides a link to a Google Document that likely expands on the architectural choices.
- This confirms that the project is intentionally built following Clean Architecture guidelines, which separate concerns into different layers (domain, application, persistence, etc.).

##### Main Components
a. Presentation Layer:
- SochoolProjecte (MVC project): Includes Controllers (e.g., AccountController, DepartmentController, StudentController, UserController), Views, Models, and static assets (Bootstrap, jQuery, SweetAlert, Select2).
b. Application Layer:
- School.Application: Contains command/query handlers, feature implementations (for Auth, Departments, Students, User), DTOs, mapping profiles, and service classes.
- Core.Application: Manages common cross-cutting concerns like exception handling, responses, and additional authentication services.
c. Domain Layer:
- School.Domain: Contains domain entities (Department, Student, ApplicationUser, etc.), enums, and result types. This defines the core business models and rules.
d. Persistence / Infrastructure Layer:
- Core.Persistence and School.Persistence: These projects include repository interfaces and implementations, configurations for mapping domain entities to database tables, the DbContext, and migration files.
e. External Dependencies:
- Libraries and frameworks in the wwwroot folder such as Bootstrap, jQuery, SweetAlert2, and Select2.

##### Relationships and Data Flow
- The UI (MVC controllers in SochoolProjecte) initiates requests which are then forwarded to the Application layer (School.Application and Core.Application) where business logic and validation occur.
- The Application layer communicates with the Persistence layer (repositories in School.Persistence/Core.Persistence) to perform CRUD operations against the database.
- The Domain layer sits at the center where the core business rules and entities reside, accessed and manipulated by the Application layer.
- External libraries enhance the UI, while configuration settings (appsettings.json) define runtime and deployment parameters.

##### Architectural Patterns and Design Principles
- Repository Pattern: Shown in the Persistence layer design (read and write repositories for Departments, Students, and Users).
- Command Query Responsibility Segregation (CQRS): Evident from the commands and queries under School.Application (e.g., LoginUserCommand, CreateDepartmentCommand, GetStudentListQuery).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        SP["SochoolProjecte (MVC)"]:::presentation
        CT["Controllers"]:::presentation
        VS["Views"]:::presentation
        CF["Configurations"]:::presentation
        SA["Static Assets"]:::presentation
    end

    %% Application Layer
    subgraph "Application Layer"
        SA2["School.Application"]:::application
        CA2["Core.Application"]:::application
    end

    %% Domain Layer
    subgraph "Domain Layer"
        SD["School.Domain"]:::domain
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        CP["Core.Persistence"]:::persistence
        SPers["School.Persistence"]:::persistence
    end

    %% Data Flow / Relationships
    SP -->|"calls"| SA2
    SP -->|"calls"| CA2
    CT -->|"routesTo"| SA2
    CT -->|"routesTo"| CA2
    SA2 -->|"uses"| SD
    CA2 -->|"uses"| SD
    SA2 -->|"CRUD"| CP
    SA2 -->|"CRUD"| SPers
    CA2 -->|"CRUD"| CP
    CA2 -->|"CRUD"| SPers

    %% External Dependencies for UI Enhancements
    LIB["External Libraries (Bootstrap, jQuery, SweetAlert2, Select2)"]:::external
    SA -->|"includes"| LIB

    %% Click Events for Presentation Layer
    click SP "https://github.com/abdulrahman-aldoais/schoolprojectewithcleanarchitecture/tree/main/SochoolProjecte"
    click CT "https://github.com/abdulrahman-aldoais/schoolprojectewithcleanarchitecture/tree/main/SochoolProjecte/Controllers"
    click VS "https://github.com/abdulrahman-aldoais/schoolprojectewithcleanarchitecture/tree/main/SochoolProjecte/Views"
    click CF "https://github.com/abdulrahman-aldoais/schoolprojectewithcleanarchitecture/blob/main/SochoolProjecte/appsettings.json"
    click SA "https://github.com/abdulrahman-aldoais/schoolprojectewithcleanarchitecture/tree/main/SochoolProjecte/wwwroot"

    %% Click Events for Application Layer
    click SA2 "https://github.com/abdulrahman-aldoais/schoolprojectewithcleanarchitecture/blob/main/School.Application"
    click CA2 "https://github.com/abdulrahman-aldoais/schoolprojectewithcleanarchitecture/blob/main/Core.Application"

    %% Click Event for Domain Layer
    click SD "https://github.com/abdulrahman-aldoais/schoolprojectewithcleanarchitecture/blob/main/School.Domain"

    %% Click Events for Persistence Layer
    click CP "https://github.com/abdulrahman-aldoais/schoolprojectewithcleanarchitecture/blob/main/Core.Persistence"
    click SPers "https://github.com/abdulrahman-aldoais/schoolprojectewithcleanarchitecture/blob/main/School.Persistence"

    %% Styles
    classDef presentation fill:#f9f,stroke:#333,stroke-width:2px;
    classDef application fill:#9f9,stroke:#333,stroke-width:2px;
    classDef domain fill:#99f,stroke:#333,stroke-width:2px;
    classDef persistence fill:#ff9,stroke:#333,stroke-width:2px;
    classDef external fill:#ccc,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5;
```
