# luclvan/onlinecourse architecture

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

- Interactive diagram: https://gitdiagram.com/luclvan/onlinecourse
- Repository: https://github.com/luclvan/onlinecourse

## Overview

This is a PHP online-course application: users browse courses, view details, and (as students) enroll; instructors manage courses and lessons, while administrators manage users and categories and view statistics. The front controller dispatches requests to role-specific controllers, which render PHP views and invoke domain models. The tree also documents materials and student dashboards/progress, but their controller wiring is not present in the sampled source, so those links are omitted. Database interactions are directly evidenced for enrollment and admin statistics; other model persistence paths are not sampled.

Main entry points: [`index.php`](https://github.com/luclvan/onlinecourse/blob/main/index.php) (Action router), [`controllers/CourseController.php`](https://github.com/luclvan/onlinecourse/blob/main/controllers/CourseController.php) (Course controller), [`controllers/LessonController.php`](https://github.com/luclvan/onlinecourse/blob/main/controllers/LessonController.php) (Lesson controller), [`controllers/AuthController.php`](https://github.com/luclvan/onlinecourse/blob/main/controllers/AuthController.php) (Authentication controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["Request handling"]
  node_router["Action router<br/>[index.php]"]
end

subgraph group_coursework["Coursework"]
  node_course_controller["Course controller"]
  node_enrollment_controller["Enrollment controller"]
  node_lesson_controller["Lesson controller"]
  node_course_model["Course model<br/>[Course.php]"]
  node_lesson_model["Lesson model<br/>[Lesson.php]"]
  node_material_model["Material model<br/>[Material.php]"]
  node_catalog_views["Course catalog views<br/>[index.php]"]
  node_detail_view["Course detail view<br/>[detail.php]"]
  node_instructor_views["Instructor workspace<br/>[my_courses.php]"]
  node_lesson_views["Lesson management views<br/>[manage.php]"]
  node_material_view["Material upload view<br/>[upload.php]"]
  node_student_views["Student learning views"]
end

subgraph group_accounts["Accounts and admin"]
  node_auth_controller["Authentication controller<br/>[AuthController.php]"]
  node_user_model["User model<br/>[User.php]"]
  node_category_model["Category model<br/>[Category.php]"]
  node_auth_views["Sign-in views<br/>[login.php]"]
  node_admin_views["Administration views<br/>[dashboard.php]"]
  node_admin_controller["Statistics controller"]
end

subgraph group_persistence["Persistence"]
  node_enrollment_model["Enrollment model<br/>[Enrollment.php]"]
  node_database_connector["Database connector<br/>[Database.php]"]
  node_mysql[("MySQL database")]
end

node_visitor(("Learner"))
node_instructor(("Instructor"))
node_administrator(("Administrator"))

node_visitor -->|"requests pages"| node_router
node_instructor -->|"requests management"| node_router
node_administrator -->|"requests administration"| node_router
node_router -->|"dispatches auth"| node_auth_controller
node_router -->|"dispatches courses"| node_course_controller
node_router -->|"dispatches enrollment"| node_enrollment_controller
node_router -->|"dispatches lessons"| node_lesson_controller
node_router -->|"dispatches statistics"| node_admin_controller
node_course_controller -->|"calls"| node_course_model
node_course_controller -->|"loads categories"| node_category_model
node_course_controller -->|"renders"| node_catalog_views
node_course_controller -->|"renders"| node_detail_view
node_course_controller -->|"renders"| node_instructor_views
node_lesson_controller -->|"checks ownership"| node_course_model
node_lesson_controller -->|"calls"| node_lesson_model
node_lesson_controller -->|"renders"| node_lesson_views
node_enrollment_controller -->|"checks and enrolls"| node_enrollment_model
node_auth_controller -->|"authenticates and manages"| node_user_model
node_auth_controller -->|"renders"| node_auth_views
node_admin_controller -->|"queries statistics"| node_database_connector
node_enrollment_model -->|"connects through"| node_database_connector
node_database_connector -->|"opens connection"| node_mysql

click node_router "https://github.com/luclvan/onlinecourse/blob/main/index.php"
click node_course_controller "https://github.com/luclvan/onlinecourse/blob/main/controllers/CourseController.php"
click node_enrollment_controller "https://github.com/luclvan/onlinecourse/blob/main/controllers/EnrollmentController.php"
click node_lesson_controller "https://github.com/luclvan/onlinecourse/blob/main/controllers/LessonController.php"
click node_course_model "https://github.com/luclvan/onlinecourse/blob/main/models/Course.php"
click node_lesson_model "https://github.com/luclvan/onlinecourse/blob/main/models/Lesson.php"
click node_material_model "https://github.com/luclvan/onlinecourse/blob/main/models/Material.php"
click node_catalog_views "https://github.com/luclvan/onlinecourse/blob/main/views/courses/index.php"
click node_detail_view "https://github.com/luclvan/onlinecourse/blob/main/views/courses/detail.php"
click node_instructor_views "https://github.com/luclvan/onlinecourse/blob/main/views/instructor/my_courses.php"
click node_lesson_views "https://github.com/luclvan/onlinecourse/blob/main/views/instructor/lessons/manage.php"
click node_material_view "https://github.com/luclvan/onlinecourse/blob/main/views/instructor/materials/upload.php"
click node_student_views "https://github.com/luclvan/onlinecourse/blob/main/views/student/course_progress.php"
click node_auth_controller "https://github.com/luclvan/onlinecourse/blob/main/controllers/AuthController.php"
click node_user_model "https://github.com/luclvan/onlinecourse/blob/main/models/User.php"
click node_category_model "https://github.com/luclvan/onlinecourse/blob/main/models/Category.php"
click node_auth_views "https://github.com/luclvan/onlinecourse/blob/main/views/auth/login.php"
click node_admin_views "https://github.com/luclvan/onlinecourse/blob/main/views/admin/dashboard.php"
click node_enrollment_model "https://github.com/luclvan/onlinecourse/blob/main/models/Enrollment.php"
click node_database_connector "https://github.com/luclvan/onlinecourse/blob/main/config/Database.php"
click node_admin_controller "https://github.com/luclvan/onlinecourse/blob/main/controllers/AdminController.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_router toneBlue
class node_course_controller,node_enrollment_controller,node_lesson_controller,node_course_model,node_lesson_model,node_material_model,node_catalog_views,node_detail_view,node_instructor_views,node_lesson_views,node_material_view,node_student_views toneAmber
class node_auth_controller,node_user_model,node_category_model,node_auth_views,node_admin_views,node_admin_controller toneMint
class node_enrollment_model,node_database_connector,node_mysql toneRose
class node_visitor,node_instructor,node_administrator toneIndigo
```

## Components

### Request handling

- [Action router](https://github.com/luclvan/onlinecourse/blob/main/index.php): `index.php`

### Coursework

- [Course controller](https://github.com/luclvan/onlinecourse/blob/main/controllers/CourseController.php): `controllers/CourseController.php`
- [Enrollment controller](https://github.com/luclvan/onlinecourse/blob/main/controllers/EnrollmentController.php): `controllers/EnrollmentController.php`
- [Lesson controller](https://github.com/luclvan/onlinecourse/blob/main/controllers/LessonController.php): `controllers/LessonController.php`
- [Course model](https://github.com/luclvan/onlinecourse/blob/main/models/Course.php): `models/Course.php`
- [Lesson model](https://github.com/luclvan/onlinecourse/blob/main/models/Lesson.php): `models/Lesson.php`
- [Material model](https://github.com/luclvan/onlinecourse/blob/main/models/Material.php): `models/Material.php`
- [Course catalog views](https://github.com/luclvan/onlinecourse/blob/main/views/courses/index.php): `views/courses/index.php`
- [Course detail view](https://github.com/luclvan/onlinecourse/blob/main/views/courses/detail.php): `views/courses/detail.php`
- [Instructor workspace](https://github.com/luclvan/onlinecourse/blob/main/views/instructor/my_courses.php): `views/instructor/my_courses.php`
- [Lesson management views](https://github.com/luclvan/onlinecourse/blob/main/views/instructor/lessons/manage.php): `views/instructor/lessons/manage.php`
- [Material upload view](https://github.com/luclvan/onlinecourse/blob/main/views/instructor/materials/upload.php): `views/instructor/materials/upload.php`
- [Student learning views](https://github.com/luclvan/onlinecourse/blob/main/views/student/course_progress.php): `views/student/course_progress.php`

### Accounts and admin

- [Authentication controller](https://github.com/luclvan/onlinecourse/blob/main/controllers/AuthController.php): `controllers/AuthController.php`
- [User model](https://github.com/luclvan/onlinecourse/blob/main/models/User.php): `models/User.php`
- [Category model](https://github.com/luclvan/onlinecourse/blob/main/models/Category.php): `models/Category.php`
- [Sign-in views](https://github.com/luclvan/onlinecourse/blob/main/views/auth/login.php): `views/auth/login.php`
- [Administration views](https://github.com/luclvan/onlinecourse/blob/main/views/admin/dashboard.php): `views/admin/dashboard.php`
- [Statistics controller](https://github.com/luclvan/onlinecourse/blob/main/controllers/AdminController.php): `controllers/AdminController.php`

### Persistence

- [Enrollment model](https://github.com/luclvan/onlinecourse/blob/main/models/Enrollment.php): `models/Enrollment.php`
- [Database connector](https://github.com/luclvan/onlinecourse/blob/main/config/Database.php): `config/Database.php`
- **MySQL database**

### Other components

- **Learner**
- **Instructor**
- **Administrator**

## Connections

- Learner → Action router: requests pages
- Instructor → Action router: requests management
- Administrator → Action router: requests administration
- Action router → Authentication controller: dispatches auth
- Action router → Course controller: dispatches courses
- Action router → Enrollment controller: dispatches enrollment
- Action router → Lesson controller: dispatches lessons
- Action router → Statistics controller: dispatches statistics
- Course controller → Course model: calls
- Course controller → Category model: loads categories
- Course controller → Course catalog views: renders
- Course controller → Course detail view: renders
- Course controller → Instructor workspace: renders
- Lesson controller → Course model: checks ownership
- Lesson controller → Lesson model: calls
- Lesson controller → Lesson management views: renders
- Enrollment controller → Enrollment model: checks and enrolls
- Authentication controller → User model: authenticates and manages
- Authentication controller → Sign-in views: renders
- Statistics controller → Database connector: queries statistics
- Enrollment model → Database connector: connects through
- Database connector → MySQL database: opens connection
