# masudranamushfiq/student-management-p1 architecture

> Architecture diagram of the GitHub repository masudranamushfiq/student-management-p1, 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/masudranamushfiq/student-management-p1
- Repository: https://github.com/masudranamushfiq/student-management-p1

## Overview

1. This is a Laravel 13 application for student management, built around classic server-rendered web flows plus a token-authenticated API. The architecture is centered on HTTP controllers, Eloquent models, database migrations/seeders, and Blade views.

2. The domain is split across a small set of core models: `Student`, `Department`, `Hall`, `User`, and `AuditLog`. Students are the primary entity, with departments and halls acting as supporting references, while audit logs capture important system actions.

3. Web traffic enters through `routes/web.php` and `routes/api.php`, then reaches controllers under `app/Http/Controllers`. The main controller set covers admin, authentication, student management, department-specific views, and role/user administration.

4. Request validation is explicitly separated into Form Request classes like `StoreStudentRequest` and `UpdateStudentRequest`, which means controllers handle orchestration while validation logic stays outside them. Authorization is enforced through policies for student, department, and hall access, backed by Spatie Laravel Permission.

5. The admin boundary is distinct: `Admin/DashboardController` and `Admin/UserManagementController` support dashboards, user/role management, and log review. This is the highest-privilege surface and is where role assignment and audit visibility are concentrated.

6. Department and exam workflows are separate from admin CRUD. The repository includes dedicated Blade views for department home, department student listing, and exam search/edit screens, indicating role-specific UIs rather than one shared generic interface.

7. Auditability is built into the domain. `StudentObserver` likely records lifecycle changes into `AuditLog`, and there are admin views for listing and inspecting those logs, so change tracking is a first-class data flow rather than an afterthought.

8. Authentication is split by channel: web login/registration lives alongside API authentication. The README and config show Laravel Sanctum for bearer-token API access, while the web side uses Blade-driven auth pages.

9. There is a modular subsystem under `Modules/Student`, isolated with its own service providers, routes, config, database assets, views, and tests. This module uses `nwidart/laravel-modules`, so it behaves like a self-contained feature boundary with its own controller and asset pipeline.

10. Frontend assets are compiled with Vite, with both root-level assets and module-level JS/Sass entries. That means the UI is built from Blade templates, but asset ownership is split between the main app and the Student module.

11. Persistence is managed through migrations and seeders. The schema includes users, students, departments, halls, personal access tokens, Spatie permission tables, and audit logs; seeders bootstrap roles, permissions, an admin user, and sample reference data.

12. Operationally, the repo is a conventional Laravel application with standard storage, cache, queue, and public entrypoint structure. The important architecture boundaries for a diagram are: web vs API, admin vs department/exam roles, core app vs Student module, and request handling vs validation/authorization vs persistence/auditing.

Main entry points: [`routes/web.php`](https://github.com/masudranamushfiq/student-management-p1/blob/main/routes/web.php) (Web routes), [`resources/views/admin/dashboard.blade.php`](https://github.com/masudranamushfiq/student-management-p1/blob/main/resources/views/admin/dashboard.blade.php) (Blade views), [`app/Models/Student.php`](https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Models/Student.php) (Domain models), [`app/Http/Controllers/StudentController.php`](https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Controllers/StudentController.php) (Student CRUD)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app_core["Main App"]
  node_web_routes["Web routes<br/>routing<br/>[web.php]"]
  node_api_routes["API routes<br/>routing<br/>[api.php]"]
  node_web_auth_controller["Auth flow<br/>controller"]
  node_student_controller["Student CRUD<br/>controller"]
  node_department_controller["Department UI<br/>controller"]
  node_hall_controller["Hall UI<br/>controller<br/>[HallController.php]"]
  node_auth_controller["API auth<br/>controller<br/>[AuthController.php]"]
  node_admin_dashboard["Admin dashboard<br/>controller"]
  node_user_admin["User admin<br/>controller"]
  node_form_requests["Form requests<br/>validation"]
  node_policies["Policies<br/>authorization<br/>[StudentPolicy.php]"]
  node_views["Blade views<br/>presentation"]
end

subgraph group_student_module["Student Module"]
  node_module_provider["Module provider<br/>module bootstrap"]
  node_module_routes["Module routes<br/>module routing<br/>[web.php]"]
  node_module_controller["Module controller"]
  node_module_views_assets["Module UI<br/>module presentation<br/>[index.blade.php]"]
end

subgraph group_data_ops["Data & Ops"]
  node_models[("Domain models<br/>eloquent models<br/>[Student.php]")]
  node_student_observer["Student observer<br/>auditing"]
  node_migrations_seeders["Schema & seed<br/>persistence bootstrap"]
  node_sanctum_permission["Auth config<br/>security config<br/>[sanctum.php]"]
end

node_web_routes -->|"auth pages"| node_web_auth_controller
node_web_routes -->|"students"| node_student_controller
node_web_routes -->|"departments"| node_department_controller
node_web_routes -->|"halls"| node_hall_controller
node_web_routes -->|"admin"| node_admin_dashboard
node_web_routes -->|"users & logs"| node_user_admin
node_api_routes -->|"api auth"| node_auth_controller
node_student_controller -->|"validates"| node_form_requests
node_department_controller -->|"validates"| node_form_requests
node_hall_controller -->|"validates"| node_form_requests
node_student_controller -->|"authorizes"| node_policies
node_department_controller -->|"authorizes"| node_policies
node_hall_controller -->|"authorizes"| node_policies
node_student_controller -->|"reads/writes"| node_models
node_department_controller -->|"reads/writes"| node_models
node_hall_controller -->|"reads/writes"| node_models
node_student_observer -->|"observes"| node_models
node_student_observer -.->|"logs"| node_models
node_admin_dashboard -->|"renders"| node_views
node_user_admin -->|"renders"| node_views
node_student_controller -->|"renders"| node_views
node_department_controller -->|"renders"| node_views
node_hall_controller -->|"renders"| node_views
node_web_auth_controller -->|"renders"| node_views
node_auth_controller -->|"uses"| node_sanctum_permission
node_user_admin -->|"roles"| node_sanctum_permission
node_migrations_seeders -->|"creates schema"| node_models
node_migrations_seeders -->|"boots auth"| node_sanctum_permission
node_module_provider -->|"registers"| node_module_routes
node_module_routes -->|"dispatches"| node_module_controller
node_module_controller -->|"renders"| node_module_views_assets
node_module_provider -->|"bootstraps"| node_module_views_assets

click node_web_routes "https://github.com/masudranamushfiq/student-management-p1/blob/main/routes/web.php"
click node_api_routes "https://github.com/masudranamushfiq/student-management-p1/blob/main/routes/api.php"
click node_web_auth_controller "https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Controllers/WebAuthController.php"
click node_student_controller "https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Controllers/StudentController.php"
click node_department_controller "https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Controllers/DepartmentController.php"
click node_hall_controller "https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Controllers/HallController.php"
click node_auth_controller "https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Controllers/AuthController.php"
click node_admin_dashboard "https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Controllers/Admin/DashboardController.php"
click node_user_admin "https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Controllers/Admin/UserManagementController.php"
click node_form_requests "https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Requests/StoreStudentRequest.php"
click node_policies "https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Policies/StudentPolicy.php"
click node_models "https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Models/Student.php"
click node_student_observer "https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Observers/StudentObserver.php"
click node_migrations_seeders "https://github.com/masudranamushfiq/student-management-p1/blob/main/database/migrations/2026_05_05_020837_create_students_table.php"
click node_views "https://github.com/masudranamushfiq/student-management-p1/blob/main/resources/views/admin/dashboard.blade.php"
click node_sanctum_permission "https://github.com/masudranamushfiq/student-management-p1/blob/main/config/sanctum.php"
click node_module_provider "https://github.com/masudranamushfiq/student-management-p1/blob/main/Modules/Student/app/Providers/StudentServiceProvider.php"
click node_module_routes "https://github.com/masudranamushfiq/student-management-p1/blob/main/Modules/Student/routes/web.php"
click node_module_controller "https://github.com/masudranamushfiq/student-management-p1/blob/main/Modules/Student/app/Http/Controllers/StudentController.php"
click node_module_views_assets "https://github.com/masudranamushfiq/student-management-p1/blob/main/Modules/Student/resources/views/index.blade.php"

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_web_routes,node_api_routes,node_web_auth_controller,node_student_controller,node_department_controller,node_hall_controller,node_auth_controller,node_admin_dashboard,node_user_admin,node_form_requests,node_policies,node_views toneBlue
class node_module_provider,node_module_routes,node_module_controller,node_module_views_assets toneAmber
class node_models,node_student_observer,node_migrations_seeders,node_sanctum_permission toneMint
```

## Components

### Main App

Primary Laravel web/API application for student management.

- [Web routes](https://github.com/masudranamushfiq/student-management-p1/blob/main/routes/web.php): routing · Server-rendered entry routes for the main app. · `routes/web.php`
- [API routes](https://github.com/masudranamushfiq/student-management-p1/blob/main/routes/api.php): routing · Token-authenticated API entry routes. · `routes/api.php`
- [Auth flow](https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Controllers/WebAuthController.php): controller · Web login and registration handling. · `app/Http/Controllers/WebAuthController.php`
- [Student CRUD](https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Controllers/StudentController.php): controller · Core student management orchestration. · `app/Http/Controllers/StudentController.php`
- [Department UI](https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Controllers/DepartmentController.php): controller · Department-specific views and actions. · `app/Http/Controllers/DepartmentController.php`
- [Hall UI](https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Controllers/HallController.php): controller · Hall management orchestration. · `app/Http/Controllers/HallController.php`
- [API auth](https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Controllers/AuthController.php): controller · Bearer-token API authentication endpoints. · `app/Http/Controllers/AuthController.php`
- [Admin dashboard](https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Controllers/Admin/DashboardController.php): controller · High-privilege admin landing and overview. · `app/Http/Controllers/Admin/DashboardController.php`
- [User admin](https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Controllers/Admin/UserManagementController.php): controller · User, role, and log management surface. · `app/Http/Controllers/Admin/UserManagementController.php`
- [Form requests](https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Http/Requests/StoreStudentRequest.php): validation · Separated request validation for student, department, and hall writes. · `app/Http/Requests/StoreStudentRequest.php`
- [Policies](https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Policies/StudentPolicy.php): authorization · Access control for student, department, and hall resources. · `app/Policies/StudentPolicy.php`
- [Blade views](https://github.com/masudranamushfiq/student-management-p1/blob/main/resources/views/admin/dashboard.blade.php): presentation · Server-rendered UI for auth, admin, department, exam, and student flows. · `resources/views/admin/dashboard.blade.php`

### Student Module

Isolated nwidart module with its own routes, provider, views, and assets.

- [Module provider](https://github.com/masudranamushfiq/student-management-p1/blob/main/Modules/Student/app/Providers/StudentServiceProvider.php): module bootstrap · Student module service provider and route registration. · `Modules/Student/app/Providers/StudentServiceProvider.php`
- [Module routes](https://github.com/masudranamushfiq/student-management-p1/blob/main/Modules/Student/routes/web.php): module routing · Module-local web and API routes. · `Modules/Student/routes/web.php`
- [Module controller](https://github.com/masudranamushfiq/student-management-p1/blob/main/Modules/Student/app/Http/Controllers/StudentController.php): module controller · Student module controller boundary. · `Modules/Student/app/Http/Controllers/StudentController.php`
- [Module UI](https://github.com/masudranamushfiq/student-management-p1/blob/main/Modules/Student/resources/views/index.blade.php): module presentation · Module-specific Blade views plus Vite-driven JS/Sass assets. · `Modules/Student/resources/views/index.blade.php`

### Data & Ops

Persistence, authorization, auditing, and bootstrap data.

- [Domain models](https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Models/Student.php): eloquent models · Core entities for students, departments, halls, users, and audit logs. · `app/Models/Student.php`
- [Student observer](https://github.com/masudranamushfiq/student-management-p1/blob/main/app/Observers/StudentObserver.php): auditing · Lifecycle hook that records student changes into audit logs. · `app/Observers/StudentObserver.php`
- [Schema & seed](https://github.com/masudranamushfiq/student-management-p1/blob/main/database/migrations/2026_05_05_020837_create_students_table.php): persistence bootstrap · Database schema and bootstrap data for roles, users, and reference records. · `database/migrations/2026_05_05_020837_create_students_table.php`
- [Auth config](https://github.com/masudranamushfiq/student-management-p1/blob/main/config/sanctum.php): security config · Sanctum bearer tokens and Spatie permission wiring. · `config/sanctum.php`

## Connections

- Web routes → Auth flow: auth pages · Web routes direct login and registration flows.
- Web routes → Student CRUD: students · Routes dispatch to student management actions.
- Web routes → Department UI: departments · Routes dispatch to department-specific screens.
- Web routes → Hall UI: halls · Routes dispatch to hall management screens.
- Web routes → Admin dashboard: admin · Admin area routes enter through the dashboard controller.
- Web routes → User admin: users & logs · Admin routes reach user, role, and audit views.
- API routes → API auth: api auth · API routes expose token-based authentication endpoints.
- Student CRUD → Form requests: validates · Student writes rely on dedicated form request classes.
- Department UI → Form requests: validates · Department writes are validated outside controllers.
- Hall UI → Form requests: validates · Hall writes are validated outside controllers.
- Student CRUD → Policies: authorizes · Student access is gated by policy checks.
- Department UI → Policies: authorizes · Department access is gated by policy checks.
- Hall UI → Policies: authorizes · Hall access is gated by policy checks.
- Student CRUD → Domain models: reads/writes · Student workflows operate on Eloquent domain models.
- Department UI → Domain models: reads/writes · Department views and updates use the shared models.
- Hall UI → Domain models: reads/writes · Hall workflows persist through the domain models.
- Student observer → Domain models: observes · Observer attaches to student lifecycle events.
- Student observer → Domain models: logs · Lifecycle changes are captured as audit records.
- Admin dashboard → Blade views: renders · Admin dashboard is presented through Blade views.
- User admin → Blade views: renders · User and log management screens are Blade-based.
- Student CRUD → Blade views: renders · Student CRUD flows render server-side pages and PDFs.
- Department UI → Blade views: renders · Department home and student listing are Blade views.
- Hall UI → Blade views: renders · Hall pages render from Blade templates.
- Auth flow → Blade views: renders · Web authentication pages are Blade-driven.
- API auth → Auth config: uses · API auth depends on Sanctum and permission config.
- User admin → Auth config: roles · Admin user management concentrates role assignment.
- Schema & seed → Domain models: creates schema · Database tables back the core domain models.
- Schema & seed → Auth config: boots auth · Migrations and seeders initialize tokens and permissions.
- Module provider → Module routes: registers · Module service provider wires module route files.
- Module routes → Module controller: dispatches · Module routes reach the module controller.
- Module controller → Module UI: renders · Module controller serves module-local UI.
- Module provider → Module UI: bootstraps · Module provider connects module resources and assets.
