# mahm0udrabie/schoolsystem architecture

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

- Interactive diagram: https://gitdiagram.com/mahm0udrabie/schoolsystem
- Repository: https://github.com/mahm0udrabie/schoolsystem

## Overview

##### Project type and purpose
- This is a modular Laravel‐based monolithic web application (“SchoolSystem”) that manages school data: configurations (grades, divisions, sections, subjects, teachers), student records, teacher agendas, and online classes (with Zoom integration). It exposes both web and API endpoints, handles authentication/authorization (Laratrust, Passport), event broadcasting, and notifications.

##### File structure
- Top‐level “Modules” directory: each subfolder (ConfigModule, OnlineClasses, Student, Teacher) is a self‐contained module with its own:
- Config (config.php, module.json)
- Database (migrations, seeders, factories)
- Entities (Eloquent models)
- Repositories (Interface + implementation)
- HTTP layer (Controllers, Requests, Routes, Middleware)
- Providers (ServiceProvider, RouteServiceProvider)
- Resources (views, JS, SCSS, language files)
- Transformers (API Resources)
- Tests
- Core Laravel app folders (app/, config/, routes/, database/, resources/, public/, storage/) host shared services: user auth, permissions, global configuration, queues, caching, event broadcasting.
- Key config files: config/modules.php wires modules; webpack.mix.js for asset compilation; composer.json for autoloading; modules_statuses.json for enabling/disabling modules.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        Browser["Browser"]:::client
        MobileClient["Mobile Client"]:::client
    end

    %% HTTP Gateway
    subgraph "Web Server Layer"
        direction TB
        WebServer["NGINX/Apache + PHP-FPM"]:::web
    end

    %% Application Layer - Core
    subgraph "Application Layer"
        direction TB
        LaravelKernel["Laravel Kernel"]:::core
        Middleware["HTTP Middleware Stack"]:::core
        Router["Router"]:::core
        ModulesManager["ModulesManager"]:::core
    end

    %% Modules
    subgraph "Modules" 
        direction TB
        subgraph "ConfigModule" 
            direction TB
            CM_Controllers["Controllers"]:::module1
            CM_Repos["Repositories"]:::module1
            CM_Entities["Entities"]:::module1
            CM_Migrations["Migrations"]:::module1
            CM_Providers["ConfigModuleServiceProvider"]:::module1
        end
        subgraph "StudentModule"
            direction TB
            SM_Controllers["StudentController"]:::module2
            SM_Repos["Repositories"]:::module2
            SM_Entities["Student Entity"]:::module2
            SM_Migrations["Migrations"]:::module2
            SM_Providers["StudentServiceProvider"]:::module2
        end
        subgraph "TeacherModule"
            direction TB
            TM_Controllers["Teacher & Agenda Controllers"]:::module3
            TM_Repos["Repositories"]:::module3
            TM_Entities["Entities"]:::module3
            TM_Migrations["Migrations"]:::module3
            TM_Providers["TeacherServiceProvider"]:::module3
        end
        subgraph "OnlineClassesModule"
            direction TB
            OC_Controllers["OnlineClassesController"]:::module4
            OC_Repos["Repositories"]:::module4
            OC_Entities["Entities"]:::module4
            OC_Migrations["Migrations"]:::module4
            OC_Trait["ZoomJWT Trait"]:::module4
            OC_Events["SendNotification Event"]:::module4
            OC_Listeners["NotifyStudent Listener"]:::module4
            OC_Notifications["NotifyStudent Notification"]:::module4
            OC_Providers["OnlineClassesServiceProvider"]:::module4
        end
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        DB["Primary Database (MySQL/PostgreSQL)"]:::data
        Cache["Cache Store (Redis/Memcached)"]:::data
        Queue["Queue System (Redis/RabbitMQ)"]:::data
    end

    %% External Services
    subgraph "External Services"
        direction TB
        OAuth["OAuth (Passport)"]:::external
        ZoomAPI["Zoom API"]:::external
        EmailSMS["Email/SMS Provider"]:::external
    end

    %% Global Core
    subgraph "Core Services"
        direction TB
        AuthControllers["ApiAuthController"]:::core
        UserModel["User Model"]:::core
        Laratrust["Laratrust Config"]:::core
        PassportCfg["Passport Config"]:::core
        BroadcastSP["BroadcastServiceProvider"]:::core
        EventSP["EventServiceProvider"]:::core
        QueueCfg["Queue Config"]:::core
        GlobalRoutes["Global Routes"]:::core
        Mix["webpack.mix.js"]:::core
    end

    %% Flows
    Browser -->|HTTPS Request| WebServer
    MobileClient -->|HTTPS Request| WebServer
    WebServer -->|Sends Request| LaravelKernel
    LaravelKernel --> Middleware
    Middleware --> Router
    Router -->|Dispatch| AuthControllers
    Router -->|Dispatch| CM_Controllers
    Router -->|Dispatch| SM_Controllers
    Router -->|Dispatch| TM_Controllers
    Router -->|Dispatch| OC_Controllers
    CM_Controllers --> CM_Repos
    SM_Controllers --> SM_Repos
    TM_Controllers --> TM_Repos
    OC_Controllers --> OC_Repos
    CM_Repos --> CM_Entities
    SM_Repos --> SM_Entities
    TM_Repos --> TM_Entities
    OC_Repos --> OC_Entities
    CM_Repos --> DB
    SM_Repos --> DB
    TM_Repos --> DB
    OC_Repos --> DB
    OC_Controllers -->|fires Event| OC_Events
    OC_Events --> Queue
    Queue --> OC_Listeners
    OC_Listeners --> OC_Notifications
    OC_Notifications -->|sends| EmailSMS
    OC_Notifications -->|sends| MobileClient
    OAuthCfg["config/passport.php"] --> OAuth
    Laratrust -->|roles perms| AuthControllers
    BroadcastSP -->|broadcast events| Queue
    EventSP -->|register events| OC_Events
    ModulesManager --> Modules
    ModulesManager -->|reads| ModulesStatus["modules_statuses.json"]:::core
    GlobalRoutes --> Router
    Mix -->|compiles assets| WebServer
    DB -->|caching| Cache
    Queue -->|jobs| OC_Listeners

    %% Click Events
    click CM_Controllers "https://github.com/mahm0udrabie/schoolsystem/tree/master/Modules/ConfigModule/Http/Controllers"
    click CM_Repos "https://github.com/mahm0udrabie/schoolsystem/tree/master/Modules/ConfigModule/Repositories"
    click CM_Entities "https://github.com/mahm0udrabie/schoolsystem/tree/master/Modules/ConfigModule/Entities"
    click CM_Migrations "https://github.com/mahm0udrabie/schoolsystem/tree/master/Modules/ConfigModule/Database/Migrations"
    click CM_Providers "https://github.com/mahm0udrabie/schoolsystem/blob/master/Modules/ConfigModule/Providers/ConfigModuleServiceProvider.php"
    click SM_Controllers "https://github.com/mahm0udrabie/schoolsystem/blob/master/Modules/Student/Http/Controllers/StudentController.php"
    click SM_Repos "https://github.com/mahm0udrabie/schoolsystem/tree/master/Modules/Student/Repositories"
    click SM_Entities "https://github.com/mahm0udrabie/schoolsystem/blob/master/Modules/Student/Entities/Student.php"
    click SM_Migrations "https://github.com/mahm0udrabie/schoolsystem/tree/master/Modules/Student/Database/Migrations"
    click SM_Providers "https://github.com/mahm0udrabie/schoolsystem/blob/master/Modules/Student/Providers/StudentServiceProvider.php"
    click TM_Controllers "https://github.com/mahm0udrabie/schoolsystem/blob/master/Modules/Teacher/Http/Controllers/TeacherController.php"
    click TM_Repos "https://github.com/mahm0udrabie/schoolsystem/tree/master/Modules/Teacher/Repositories"
    click TM_Entities "https://github.com/mahm0udrabie/schoolsystem/tree/master/Modules/Teacher/Entities"
    click TM_Migrations "https://github.com/mahm0udrabie/schoolsystem/tree/master/Modules/Teacher/Database/Migrations"
    click TM_Providers "https://github.com/mahm0udrabie/schoolsystem/blob/master/Modules/Teacher/Providers/TeacherServiceProvider.php"
    click OC_Controllers "https://github.com/mahm0udrabie/schoolsystem/blob/master/Modules/OnlineClasses/Http/Controllers/OnlineClassesController.php"
    click OC_Repos "https://github.com/mahm0udrabie/schoolsystem/tree/master/Modules/OnlineClasses/Repositories"
    click OC_Entities "https://github.com/mahm0udrabie/schoolsystem/tree/master/Modules/OnlineClasses/Entities"
    click OC_Migrations "https://github.com/mahm0udrabie/schoolsystem/tree/master/Modules/OnlineClasses/Database/Migrations"
    click OC_Trait "https://github.com/mahm0udrabie/schoolsystem/blob/master/Modules/OnlineClasses/Traits/ZoomJWT.php"
    click OC_Events "https://github.com/mahm0udrabie/schoolsystem/blob/master/Modules/OnlineClasses/Events/SendNotification.php"
    click OC_Listeners "https://github.com/mahm0udrabie/schoolsystem/blob/master/Modules/OnlineClasses/Listeners/NotifyStudent.php"
    click OC_Notifications "https://github.com/mahm0udrabie/schoolsystem/blob/master/Modules/OnlineClasses/Notifications/NotifyStudentOfNewOnlineClass.php"
    click OC_Providers "https://github.com/mahm0udrabie/schoolsystem/blob/master/Modules/OnlineClasses/Providers/OnlineClassesServiceProvider.php"
    click Mix "https://github.com/mahm0udrabie/schoolsystem/blob/master/webpack.mix.js"
    click ModulesStatus "https://github.com/mahm0udrabie/schoolsystem/blob/master/modules_statuses.json"
    click OAuth "https://github.com/mahm0udrabie/schoolsystem/blob/master/config/passport.php"
    click Laratrust "https://github.com/mahm0udrabie/schoolsystem/blob/master/config/laratrust.php"
    click BroadcastSP "https://github.com/mahm0udrabie/schoolsystem/blob/master/app/Providers/BroadcastServiceProvider.php"
    click EventSP "https://github.com/mahm0udrabie/schoolsystem/blob/master/app/Providers/EventServiceProvider.php"
    click QueueCfg "https://github.com/mahm0udrabie/schoolsystem/blob/master/config/queue.php"

    %% Styles
    classDef client fill:#FFEB3B,stroke:#FBC02D,color:#000
    classDef web fill:#90CAF9,stroke:#42A5F5,color:#000
    classDef core fill:#CFD8DC,stroke:#607D8B,color:#000
    classDef module1 fill:#FFE0B2,stroke:#FB8C00,color:#000
    classDef module2 fill:#C8E6C9,stroke:#43A047,color:#000
    classDef module3 fill:#F8BBD0,stroke:#EC407A,color:#000
    classDef module4 fill:#BBDEFB,stroke:#1E88E5,color:#000
    classDef data fill:#B3E5FC,stroke:#039BE5,color:#000
    classDef external fill:#C8E6C9,stroke:#2E7D32,color:#000
```
