# saddamhosen42/mobe architecture

> Architecture diagram of the GitHub repository saddamhosen42/mobe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saddamhosen42/mobe
- Repository: https://github.com/saddamhosen42/mobe

## Overview

1. **Overall shape**
   - This is a monolithic Laravel 10/11-style application for Outcome Based Education (OBE) grade management.
   - It uses server-rendered Blade views, Eloquent models, and traditional HTTP controllers rather than a frontend SPA architecture.

2. **Primary runtime boundaries**
   - **Browser/desktop client → Laravel HTTP kernel → middleware → controller → model/database → Blade view**
   - The app also supports a **NativePHP desktop mode**, so the same Laravel backend can run as a packaged desktop app in addition to the normal web server.

3. **Core domain subsystems**
   - The repository is organized around academic administration entities:
     - **Institution structure:** faculties, departments, study programs
     - **Teaching structure:** courses, course classes, class settings, class members, portfolios
     - **OBE curriculum design:** intended learning outcomes, course learning outcomes, lesson learning outcomes, learning plans, syllabi
     - **Assessment and grading:** criteria, criteria levels, rubrics, assignments, assignment plans/tasks, student grades, grade details
     - **User-facing grade views:** “my grade” and student grade screens

4. **Request handling and enforcement**
   - Controllers are split by domain and handle CRUD plus specialized flows, for example `CourseController`, `SyllabusController`, `StudentGradeController`, `AssignmentPlanController`, and `MyGradeController`.
   - Access control is enforced through custom middleware and policies:
     - `RoleCheck`, `MustBeTeacher`, and `ProfileCompleted` gate major flows
     - policy classes exist for most domain models, so authorization is model-specific rather than purely route-based

5. **Authentication and user management**
   - Authentication follows Laravel’s built-in auth flow with dedicated controllers for login, registration, password reset, email verification, and confirmation.
   - `User` is extended with role/profile-related behavior:
     - a `role` column is added in migrations
     - a `profile_completed` flag controls onboarding/usage
     - profile photo storage is supported
   - There are dedicated profile screens for different user states, including student-specific profile editing.

6. **OBE data model and hierarchy**
   - The architecture reflects a curriculum hierarchy:
     - institution layer: faculty → department → study program
     - academic layer: course → course class → class membership
     - OBE layer: ILO/CLO/LLO → learning plan/syllabus → criteria/rubrics
     - assessment layer: assignments → assignment plans/tasks → student grade records/details
   - This suggests the app is designed to propagate curriculum structure into grading and reporting, not just store marks.

7. **Persistence and schema evolution**
   - All core data is persisted in a relational database via Eloquent models and migrations.
   - The migration history shows active schema evolution around:
     - course/syllabus linkage
     - class settings
     - student grade redesign
     - profile completion and photo support
     - cascade-delete fixes across reference tables
   - The README’s warning about cascade-delete migrations indicates data integrity across seeded and relationally linked records is important to the system.

8. **Presentation layer**
   - Views are organized per domain under `resources/views`, with shared layout components and reusable Blade components.
   - The app uses standard Laravel layout separation:
     - authenticated app layout
     - guest/auth layout
     - a special create-faculties layout
   - Frontend assets are handled through Vite, Tailwind, and a small JS bootstrap layer, so the UI is server-rendered with compiled assets rather than a client-side application state.

9. **Background/utility features**
   - There is a console kernel and seeders for loading real, fake, and Bangladesh OBE sample data.
   - Factories exist for most domain models, which supports test data generation and local development.
   - Helper functions live in `app/helpers.php`, suggesting some shared domain formatting or utility logic outside of controllers/models.

10. **Storage and external integration**
   - The app relies on standard Laravel infrastructure: database, filesystem storage, mail/auth/session/cache config.
   - `storage:link` is required, so user-uploaded or generated files are exposed through public storage.
   - The presence of `public/sw.js` and `manifest.json` indicates some PWA-style assets, but the main architecture remains server-centric.

11. **Testing and quality boundaries**
   - Feature tests cover the auth flow, while the rest of the repo appears to rely on model/controller integration and seeded data.
   - Policies, middleware, and migrations are the main architectural guardrails that keep the domain logic consistent across web routes and desktop mode.

12. **Diagramming takeaway**
   - A good architecture diagram should center on one Laravel application boundary with:
     - HTTP/UI entry points
     - auth/role/profile middleware
     - domain controllers and policies
     - Eloquent models over a relational database
     - Blade rendering back to the client
   - Around that core, show the OBE subdomains as distinct but interconnected modules, especially the curriculum/assessment/grading flow.

Main entry points: [`routes/web.php`](https://github.com/saddamhosen42/mobe/blob/main/routes/web.php) (Web Routes), [`app/Http/Kernel.php`](https://github.com/saddamhosen42/mobe/blob/main/app/Http/Kernel.php) (HTTP Kernel), [`app/Models/User.php`](https://github.com/saddamhosen42/mobe/blob/main/app/Models/User.php) (User Model), [`app/Models/Course.php`](https://github.com/saddamhosen42/mobe/blob/main/app/Models/Course.php) (Courses)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Laravel runtime"]
  node_browser(("Browser / Desktop<br/>client"))
  node_kernel{{"HTTP Kernel<br/>[Kernel.php]"}}
  node_routes["Web Routes<br/>[web.php]"]
  node_native["NativePHP<br/>desktop host"]
end

subgraph group_auth["Auth and access"]
  node_authctrl["Auth Flow<br/>controllers"]
  node_middleware{{"Access Gates<br/>middleware<br/>[RoleCheck.php]"}}
  node_policies["Policies<br/>authorization"]
  node_user[("User Model<br/>auth model<br/>[User.php]")]
  node_profile["Profile UI<br/>user screens<br/>[edit.blade.php]"]
end

subgraph group_domain["OBE domain"]
  node_faculty[("Faculty<br/>institution<br/>[Faculty.php]")]
  node_department[("Department<br/>institution<br/>[Department.php]")]
  node_program[("Study Program<br/>institution<br/>[StudyProgram.php]")]
  node_course[("Courses<br/>teaching<br/>[Course.php]")]
  node_courseclass[("Course Class<br/>teaching<br/>[CourseClass.php]")]
  node_curriculum[("Curriculum OBE<br/>obe design")]
  node_assessment[("Assessment<br/>grading<br/>[Criteria.php]")]
  node_grades[("Student Grades<br/>grading<br/>[StudentGrade.php]")]
end

subgraph group_presentation["Presentation"]
  node_dashboard["Teacher / Student Views<br/>screens<br/>[index.blade.php]"]
  node_layouts["Blade Layouts<br/>views<br/>[app.blade.php]"]
  node_assets["Assets<br/>frontend<br/>[app.js]"]
end

node_browser -->|"requests"| node_kernel
node_native -->|"boots app"| node_kernel
node_kernel -->|"dispatches"| node_routes
node_routes -->|"auth endpoints"| node_authctrl
node_routes -->|"profile screens"| node_profile
node_routes -->|"grade screens"| node_dashboard
node_routes -->|"domain CRUD"| node_course
node_kernel -->|"enforces"| node_middleware
node_middleware -->|"authorizes"| node_policies
node_policies -->|"guards"| node_user
node_user -->|"renders"| node_profile
node_faculty -->|"contains"| node_department
node_department -->|"contains"| node_program
node_program -->|"offers"| node_course
node_course -->|"offered as"| node_courseclass
node_courseclass -->|"aligns to"| node_curriculum
node_curriculum -->|"drives"| node_assessment
node_assessment -->|"produces"| node_grades
node_grades -->|"shows"| node_dashboard
node_layouts -->|"wraps"| node_dashboard
node_assets -->|"styles UI"| node_layouts
node_user -->|"acts on"| node_grades

click node_kernel "https://github.com/saddamhosen42/mobe/blob/main/app/Http/Kernel.php"
click node_routes "https://github.com/saddamhosen42/mobe/blob/main/routes/web.php"
click node_native "https://github.com/saddamhosen42/mobe/blob/main/app/Providers/NativeAppServiceProvider.php"
click node_authctrl "https://github.com/saddamhosen42/mobe/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php"
click node_middleware "https://github.com/saddamhosen42/mobe/blob/main/app/Http/Middleware/RoleCheck.php"
click node_policies "https://github.com/saddamhosen42/mobe/blob/main/app/Policies/StudentGradePolicy.php"
click node_user "https://github.com/saddamhosen42/mobe/blob/main/app/Models/User.php"
click node_profile "https://github.com/saddamhosen42/mobe/blob/main/resources/views/profile/edit.blade.php"
click node_faculty "https://github.com/saddamhosen42/mobe/blob/main/app/Models/Faculty.php"
click node_department "https://github.com/saddamhosen42/mobe/blob/main/app/Models/Department.php"
click node_program "https://github.com/saddamhosen42/mobe/blob/main/app/Models/StudyProgram.php"
click node_course "https://github.com/saddamhosen42/mobe/blob/main/app/Models/Course.php"
click node_courseclass "https://github.com/saddamhosen42/mobe/blob/main/app/Models/CourseClass.php"
click node_curriculum "https://github.com/saddamhosen42/mobe/blob/main/app/Models/IntendedLearningOutcome.php"
click node_assessment "https://github.com/saddamhosen42/mobe/blob/main/app/Models/Criteria.php"
click node_grades "https://github.com/saddamhosen42/mobe/blob/main/app/Models/StudentGrade.php"
click node_dashboard "https://github.com/saddamhosen42/mobe/blob/main/resources/views/mygrade/index.blade.php"
click node_layouts "https://github.com/saddamhosen42/mobe/blob/main/resources/views/layouts/app.blade.php"
click node_assets "https://github.com/saddamhosen42/mobe/blob/main/resources/js/app.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browser,node_kernel,node_routes,node_native toneBlue
class node_authctrl,node_middleware,node_policies,node_user,node_profile toneAmber
class node_faculty,node_department,node_program,node_course,node_courseclass,node_curriculum,node_assessment,node_grades toneMint
class node_dashboard,node_layouts,node_assets toneRose
```

## Components

### Laravel runtime

HTTP kernel, routing, service providers, and shared request lifecycle

- **Browser / Desktop**: client · Web client or NativePHP desktop shell
- [HTTP Kernel](https://github.com/saddamhosen42/mobe/blob/main/app/Http/Kernel.php): kernel · Central request pipeline and middleware registration · `app/Http/Kernel.php`
- [Web Routes](https://github.com/saddamhosen42/mobe/blob/main/routes/web.php): routes · HTTP route definitions and entry mapping · `routes/web.php`
- [NativePHP](https://github.com/saddamhosen42/mobe/blob/main/app/Providers/NativeAppServiceProvider.php): desktop host · Desktop app bootstrap and integration · `app/Providers/NativeAppServiceProvider.php`

### Auth and access

Login, onboarding, middleware, and authorization boundaries

- [Auth Flow](https://github.com/saddamhosen42/mobe/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php): controllers · Login, registration, password reset, and verification controllers · `app/Http/Controllers/Auth/AuthenticatedSessionController.php`
- [Access Gates](https://github.com/saddamhosen42/mobe/blob/main/app/Http/Middleware/RoleCheck.php): middleware · Role, teacher, and profile-completion enforcement · `app/Http/Middleware/RoleCheck.php`
- [Policies](https://github.com/saddamhosen42/mobe/blob/main/app/Policies/StudentGradePolicy.php): authorization · Model-specific authorization rules · `app/Policies/StudentGradePolicy.php`
- [User Model](https://github.com/saddamhosen42/mobe/blob/main/app/Models/User.php): auth model · Users, roles, profiles, and profile photo support · `app/Models/User.php`
- [Profile UI](https://github.com/saddamhosen42/mobe/blob/main/resources/views/profile/edit.blade.php): user screens · Profile creation, editing, and student profile screens · `resources/views/profile/edit.blade.php`

### OBE domain

Academic structure, curriculum design, and assessment/grading modules

- [Faculty](https://github.com/saddamhosen42/mobe/blob/main/app/Models/Faculty.php): institution · Top-level academic structure · `app/Models/Faculty.php`
- [Department](https://github.com/saddamhosen42/mobe/blob/main/app/Models/Department.php): institution · Faculty subdivision and ownership boundary · `app/Models/Department.php`
- [Study Program](https://github.com/saddamhosen42/mobe/blob/main/app/Models/StudyProgram.php): institution · Program-level academic structure · `app/Models/StudyProgram.php`
- [Courses](https://github.com/saddamhosen42/mobe/blob/main/app/Models/Course.php): teaching · Course definitions and course CRUD · `app/Models/Course.php`
- [Course Class](https://github.com/saddamhosen42/mobe/blob/main/app/Models/CourseClass.php): teaching · Offerings, class settings, and membership container · `app/Models/CourseClass.php`
- [Curriculum OBE](https://github.com/saddamhosen42/mobe/blob/main/app/Models/IntendedLearningOutcome.php): obe design · ILO, CLO, LLO, learning plans, and syllabi · `app/Models/IntendedLearningOutcome.php`
- [Assessment](https://github.com/saddamhosen42/mobe/blob/main/app/Models/Criteria.php): grading · Criteria, levels, rubrics, assignments, and plans · `app/Models/Criteria.php`
- [Student Grades](https://github.com/saddamhosen42/mobe/blob/main/app/Models/StudentGrade.php): grading · Grade records, details, and student-facing views · `app/Models/StudentGrade.php`

### Presentation

Blade layouts, views, and compiled frontend assets

- [Teacher / Student Views](https://github.com/saddamhosen42/mobe/blob/main/resources/views/mygrade/index.blade.php): screens · Grade dashboards and personalized result pages · `resources/views/mygrade/index.blade.php`
- [Blade Layouts](https://github.com/saddamhosen42/mobe/blob/main/resources/views/layouts/app.blade.php): views · App, guest, and special onboarding layouts · `resources/views/layouts/app.blade.php`
- [Assets](https://github.com/saddamhosen42/mobe/blob/main/resources/js/app.js): frontend · Vite, Tailwind, and browser bootstrap assets · `resources/js/app.js`

## Connections

- Browser / Desktop → HTTP Kernel: requests · Browser and desktop requests enter the Laravel pipeline
- NativePHP → HTTP Kernel: boots app · NativePHP hosts the same Laravel backend
- HTTP Kernel → Web Routes: dispatches · Kernel hands requests to route resolution
- Web Routes → Auth Flow: auth endpoints · Built-in authentication routes map to auth controllers
- Web Routes → Profile UI: profile screens · Routes expose profile and account views
- Web Routes → Teacher / Student Views: grade screens · Routes expose teacher and student grade pages
- Web Routes → Courses: domain CRUD · Routes map to academic controllers and resources
- HTTP Kernel → Access Gates: enforces · Middleware gates protected flows before controllers
- Access Gates → Policies: authorizes · Access checks complement model policies
- Policies → User Model: guards · Policies rely on the authenticated user context
- User Model → Profile UI: renders · User state drives profile onboarding and editing
- Faculty → Department: contains · Faculty groups departments
- Department → Study Program: contains · Department groups study programs
- Study Program → Courses: offers · Programs own courses
- Courses → Course Class: offered as · Courses expand into class offerings
- Course Class → Curriculum OBE: aligns to · Course classes connect to OBE curriculum artifacts
- Curriculum OBE → Assessment: drives · Learning outcomes inform criteria, rubrics, and plans
- Assessment → Student Grades: produces · Assessment structures generate student grade records
- Student Grades → Teacher / Student Views: shows · Grade data is presented in personalized views
- Blade Layouts → Teacher / Student Views: wraps · Blade views are composed within shared layouts
- Assets → Blade Layouts: styles UI · Compiled frontend assets support server-rendered pages
- User Model → Student Grades: acts on · Teachers and students interact with grade data through user roles
