# abdomohsen228/learning_management_system architecture

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

- Interactive diagram: https://gitdiagram.com/abdomohsen228/learning_management_system
- Repository: https://github.com/abdomohsen228/learning_management_system

## Overview

1. **Overall shape**
   - This is a **Spring Boot monolith** organized as a classic layered backend: **controller → service → repository → entity**.
   - It exposes REST endpoints for an LMS domain with three primary actor types: **Admin, Instructor, Student**.

2. **API / presentation layer**
   - The `controller` package contains the entry points for the main workflows: authentication, users, courses, enrollment, lessons, quizzes, assignments, instructors, and students.
   - Controllers are thin request/response boundaries and likely delegate most business logic to services rather than talking directly to persistence.

3. **Business logic layer**
   - The `service` package is the main orchestration layer.
   - Core services include `CourseService`, `EnrollmentService`, `LessonService`, `QuizService`, `AssignmentService`, `StudentService`, `InstructorService`, `AdminService`, `UsersService`, and `NotificationsService`.
   - This is where cross-entity operations happen, such as enrollment validation, quiz/assignment workflows, grading, and notification creation.

4. **Persistence layer**
   - The `repository` package holds Spring Data repositories for each aggregate or supporting table: courses, enrollments, lessons, quizzes, questions, answers, submissions, grading, users, user types, and notifications.
   - The presence of many repositories indicates a relational model with direct table-backed entities and query methods generated by Spring Data JPA.

5. **Domain model**
   - The `entity` package defines the database-backed model: `Users`, `Admin`, `Instructor`, `Student`, `Course`, `Lesson`, `Enrollment`, `Quiz`, `Question`, `Answer`, `Assignment`, `Submission`, `Grading`, `LessonAttendance`, `Notifications`, and supporting enums like `UsersType` and `QuestionType`.
   - The model suggests the LMS stores both identity/role information and learning activity data in the same domain boundary.

6. **Authentication and authorization**
   - Security is centralized in `config/WebSecurityConfig` and `CustomAuthenticationSuccessHandler`, with `CustomUserDetailsService` in the service layer.
   - The architecture uses **role-based access control** for Admin/Instructor/Student paths, with login handled through a dedicated auth controller and a login DTO.
   - This means access control is enforced at the backend boundary, not inside individual domain entities.

7. **Primary LMS flows**
   - **User registration/login**: requests enter `AuthController`, are mapped through DTO/util request objects, and resolved via user/security services.
   - **Course lifecycle**: instructors create/manage courses, lessons, and associated media metadata.
   - **Enrollment**: students enroll in courses, with admin/instructor oversight.
   - **Assessments**: instructors create quizzes and assignments; students submit work; grading/feedback is persisted and exposed back to learners.

8. **Attendance and engagement**
   - The presence of `LessonAttendance` and OTP-related language in the README indicates lessons have an attendance verification flow.
   - That flow likely runs through lesson/instructor services and records attendance as a domain event tied to a lesson and student identity.

9. **Notifications and feedback**
   - `NotificationsService` and `NotificationsRepository` form a separate side-effect subsystem for system messages.
   - Notifications appear to be generated from enrollment, grading, or course update events, and the README also mentions email delivery via JavaMailSender, so the system likely fans out from domain actions to both persisted notifications and email.

10. **DTO boundary**
   - The `dto` package contains the request/response shapes used by controllers: course, lesson, quiz, question, assignment, grading, login, student, and feedback DTOs.
   - This layer isolates the API contract from the database entities, which is important because many LMS operations need partial views or flattened payloads rather than raw entity graphs.

11. **External infrastructure**
   - The project is built with **Maven** and runs as a Spring Boot app on **Java 17+**.
   - The README indicates a relational database such as **MySQL or PostgreSQL**, plus **JavaMailSender** for email notifications and **Apache POI** for Excel report generation.
   - These are supporting services, not separate deployable components.

12. **Testing boundary**
   - The `src/test` tree contains controller and service tests for course, enrollment, lesson, quiz, assignment, and notifications.
   - This suggests the repo emphasizes unit/integration coverage around service orchestration and endpoint behavior, matching the layered architecture.

13. **How to draw the diagram**
   - The main boxes are: **clients → controllers → services → repositories → database entities**.
   - Add a separate **security/authentication boundary** around login and role checks.
   - Add a **notifications/email/reporting side channel** fed by service events.
   - The central domain clusters are **user management**, **course/enrollment**, **lessons/attendance**, and **assessments/grading**.

Main entry points: [`src/main/java/com/LMS/Learning_Management_System/repository/CourseRepository.java`](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/repository/CourseRepository.java) (Repositories), [`src/main/java/com/LMS/Learning_Management_System/service/NotificationsService.java`](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/NotificationsService.java) (Notifications), [`src/main/java/com/LMS/Learning_Management_System/controller/QuizController.java`](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/controller/QuizController.java) (Assessments), [`src/main/java/com/LMS/Learning_Management_System/service/CourseService.java`](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/CourseService.java) (Courses)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Clients"]
  node_clients_api(("API clients<br/>consumer"))
end

subgraph group_presentation["Presentation"]
  node_auth_controller["Auth<br/>controller"]
  node_user_controllers["Users<br/>controller cluster"]
  node_course_controller["Courses<br/>controller"]
  node_lesson_controller["Lessons<br/>controller"]
  node_assessment_controllers["Assessments<br/>controller cluster"]
end

subgraph group_application["Services"]
  node_users_service["Users<br/>[UsersService.java]"]
  node_admin_service["Admin<br/>[AdminService.java]"]
  node_course_service["Courses<br/>[CourseService.java]"]
  node_lesson_service["Lessons<br/>[LessonService.java]"]
  node_enrollment_service["Enrollment"]
  node_quiz_service["Quizzes<br/>[QuizService.java]"]
  node_assignment_service["Assignments"]
  node_notifications_service["Notifications"]
end

subgraph group_security["Security"]
  node_security_config["Security config"]
  node_user_details_service["User details<br/>security service"]
end

subgraph group_persistence["Persistence"]
  node_repositories[("Repositories<br/>repository layer")]
end

subgraph group_domain["Domain"]
  node_domain_model[("Domain model<br/>entities<br/>[Course.java]")]
end

subgraph group_support["Support"]
  node_external_infra(("Mail/DB/Reports<br/>infrastructure"))
end

node_clients_api -->|"login"| node_auth_controller
node_clients_api -->|"users"| node_user_controllers
node_clients_api -->|"courses"| node_course_controller
node_clients_api -->|"lessons"| node_lesson_controller
node_clients_api -->|"assessments"| node_assessment_controllers
node_auth_controller -->|"auth"| node_user_details_service
node_auth_controller -->|"signup"| node_users_service
node_user_controllers -->|"users"| node_users_service
node_user_controllers -->|"admin"| node_admin_service
node_course_controller -->|"course ops"| node_course_service
node_lesson_controller -->|"lesson ops"| node_lesson_service
node_assessment_controllers -->|"enroll"| node_enrollment_service
node_assessment_controllers -->|"quiz ops"| node_quiz_service
node_assessment_controllers -->|"assignment ops"| node_assignment_service
node_course_service -->|"persist"| node_repositories
node_lesson_service -->|"persist"| node_repositories
node_enrollment_service -->|"persist"| node_repositories
node_quiz_service -->|"persist"| node_repositories
node_assignment_service -->|"persist"| node_repositories
node_users_service -->|"persist"| node_repositories
node_notifications_service -->|"persist"| node_repositories
node_repositories -->|"maps to"| node_domain_model
node_course_service -.->|"events"| node_notifications_service
node_lesson_service -.->|"events"| node_notifications_service
node_quiz_service -.->|"events"| node_notifications_service
node_assignment_service -.->|"events"| node_notifications_service
node_security_config -->|"authn"| node_user_details_service
node_security_config -->|"guard"| node_auth_controller
node_notifications_service -.->|"email"| node_external_infra
node_course_service -.->|"reports"| node_external_infra

click node_auth_controller "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/controller/AuthController.java"
click node_user_controllers "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/controller/UsersController.java"
click node_course_controller "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/controller/CourseController.java"
click node_lesson_controller "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/controller/LessonController.java"
click node_assessment_controllers "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/controller/QuizController.java"
click node_users_service "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/UsersService.java"
click node_admin_service "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/AdminService.java"
click node_course_service "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/CourseService.java"
click node_lesson_service "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/LessonService.java"
click node_enrollment_service "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/EnrollmentService.java"
click node_quiz_service "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/QuizService.java"
click node_assignment_service "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/AssignmentService.java"
click node_notifications_service "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/NotificationsService.java"
click node_security_config "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/config/WebSecurityConfig.java"
click node_user_details_service "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/CustomUserDetailsService.java"
click node_repositories "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/repository/CourseRepository.java"
click node_domain_model "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/entity/Course.java"
click node_external_infra "https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/resources/application.properties"

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_clients_api,node_external_infra toneBlue
class node_auth_controller,node_user_controllers,node_course_controller,node_lesson_controller,node_assessment_controllers toneAmber
class node_users_service,node_admin_service,node_course_service,node_lesson_service,node_enrollment_service,node_quiz_service,node_assignment_service,node_notifications_service toneMint
class node_security_config,node_user_details_service toneRose
class node_repositories toneIndigo
class node_domain_model toneTeal
```

## Components

### Clients

External API consumers

- **API clients**: consumer · Browser or API consumers calling the LMS endpoints

### Presentation

REST controllers and request/response boundaries

- [Auth](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/controller/AuthController.java): controller · Login and registration entry point · `src/main/java/com/LMS/Learning_Management_System/controller/AuthController.java`
- [Users](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/controller/UsersController.java): controller cluster · User-facing REST controllers for admin, instructor, and student workflows · `src/main/java/com/LMS/Learning_Management_System/controller/UsersController.java`
- [Courses](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/controller/CourseController.java): controller · Course management endpoints · `src/main/java/com/LMS/Learning_Management_System/controller/CourseController.java`
- [Lessons](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/controller/LessonController.java): controller · Lesson and attendance endpoints · `src/main/java/com/LMS/Learning_Management_System/controller/LessonController.java`
- [Assessments](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/controller/QuizController.java): controller cluster · Quiz, assignment, and enrollment entry points · `src/main/java/com/LMS/Learning_Management_System/controller/QuizController.java`

### Services

Business orchestration and workflow logic

- [Users](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/UsersService.java): service · User, profile, and role orchestration · `src/main/java/com/LMS/Learning_Management_System/service/UsersService.java`
- [Admin](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/AdminService.java): service · Admin-specific orchestration · `src/main/java/com/LMS/Learning_Management_System/service/AdminService.java`
- [Courses](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/CourseService.java): service · Course lifecycle and coordination · `src/main/java/com/LMS/Learning_Management_System/service/CourseService.java`
- [Lessons](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/LessonService.java): service · Lesson delivery and attendance logic · `src/main/java/com/LMS/Learning_Management_System/service/LessonService.java`
- [Enrollment](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/EnrollmentService.java): service · Student-course enrollment workflow · `src/main/java/com/LMS/Learning_Management_System/service/EnrollmentService.java`
- [Quizzes](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/QuizService.java): service · Quiz creation, questions, and grading workflow · `src/main/java/com/LMS/Learning_Management_System/service/QuizService.java`
- [Assignments](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/AssignmentService.java): service · Assignment submission and grading workflow · `src/main/java/com/LMS/Learning_Management_System/service/AssignmentService.java`
- [Notifications](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/NotificationsService.java): service · Notification side effects and message fan-out · `src/main/java/com/LMS/Learning_Management_System/service/NotificationsService.java`

### Security

Authentication and role-based access control

- [Security config](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/config/WebSecurityConfig.java): security · Spring Security rules and success handling · `src/main/java/com/LMS/Learning_Management_System/config/WebSecurityConfig.java`
- [User details](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/service/CustomUserDetailsService.java): security service · Loads users for authentication and authorization · `src/main/java/com/LMS/Learning_Management_System/service/CustomUserDetailsService.java`

### Persistence

Spring Data repositories

- [Repositories](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/repository/CourseRepository.java): repository layer · Spring Data JPA repositories for LMS aggregates · `src/main/java/com/LMS/Learning_Management_System/repository/CourseRepository.java`

### Domain

Database-backed LMS model

- [Domain model](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/java/com/LMS/Learning_Management_System/entity/Course.java): entities · Users, courses, lessons, assessments, attendance, and notifications · `src/main/java/com/LMS/Learning_Management_System/entity/Course.java`

### Support

Notification and infrastructure integrations

- [Mail/DB/Reports](https://github.com/abdomohsen228/learning_management_system/blob/main/src/main/resources/application.properties): infrastructure · Relational database, email delivery, and report generation dependencies · `src/main/resources/application.properties`

## Connections

- API clients → Auth: login · Authentication requests enter the auth boundary
- API clients → Users: users · User administration and profile workflows
- API clients → Courses: courses · Course browsing and management requests
- API clients → Lessons: lessons · Lesson and attendance requests
- API clients → Assessments: assessments · Enrollment, quiz, and assignment flows
- Auth → User details: auth · Credentials are resolved through the user details service
- Auth → Users: signup · Registration and account operations
- Users → Users: users · User and role orchestration
- Users → Admin: admin · Admin-facing workflows
- Courses → Courses: course ops · Course lifecycle is delegated to service logic
- Lessons → Lessons: lesson ops · Lesson and attendance operations
- Assessments → Enrollment: enroll · Enrollment validation and persistence
- Assessments → Quizzes: quiz ops · Quiz creation and student attempts
- Assessments → Assignments: assignment ops · Assignment submission and grading
- Courses → Repositories: persist · Course data is stored through Spring Data repositories
- Lessons → Repositories: persist · Lesson and attendance persistence
- Enrollment → Repositories: persist · Enrollment records are saved and queried
- Quizzes → Repositories: persist · Quiz, question, answer, and grading persistence
- Assignments → Repositories: persist · Assignments, submissions, and grading persistence
- Users → Repositories: persist · User and role storage access
- Notifications → Repositories: persist · Notification records are stored
- Repositories → Domain model: maps to · Repositories operate over the LMS entity model
- Courses → Notifications: events · Course actions can trigger notifications
- Lessons → Notifications: events · Attendance or lesson updates can trigger notifications
- Quizzes → Notifications: events · Assessment outcomes can trigger notifications
- Assignments → Notifications: events · Submission and grading events can trigger notifications
- Security config → User details: authn · Security configuration depends on user lookup
- Security config → Auth: guard · Login and role checks protect the API boundary
- Notifications → Mail/DB/Reports: email · Notifications fan out to mail and other supporting infrastructure
- Courses → Mail/DB/Reports: reports · Report generation and related infrastructure support
