# mohamedakeeljm/campus_attendance_system architecture

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

- Interactive diagram: https://gitdiagram.com/mohamedakeeljm/campus_attendance_system
- Repository: https://github.com/mohamedakeeljm/campus_attendance_system

## Overview

Brainiacs Campus is a PHP/MySQL attendance portal for administrators, lecturers, and students. Users authenticate and are routed to role-specific areas. Administrators manage campus records and enrollment; lecturers record attendance manually or by QR and review history and reports; students view modules, profiles, and attendance. The README documents live attendance percentages and QR check-in. Source excerpts confirm session role guards, database configuration, and parts of the manual, QR, and email flows; several page-to-page and QR endpoint connections are documented or inferred rather than fully sampled.

Main entry points: [`login.php`](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/login.php) (Login and routing), [`admin/add_student.php`](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/admin/add_student.php) (People and module management), [`includes/api/qr_mark.php`](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/includes/api/qr_mark.php) (QR mark endpoint), [`includes/mailer.php`](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/includes/mailer.php) (Welcome email service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and shared services"]
  node_login["Login and routing<br/>[login.php]"]
  node_auth["Session and role guard<br/>[auth.php]"]
  node_database[("MySQL campus database")]
  node_helpers["Attendance and page helpers<br/>[functions.php]"]
  node_mailer["Welcome email service<br/>[mailer.php]"]
end

subgraph group_admin["Campus administration"]
  node_adminmanage["People and module management<br/>[add_student.php]"]
  node_enrollment["Module enrollment"]
  node_adminattendance["Admin attendance records"]
  node_adminqr["Admin QR attendance<br/>[qr_attendance.php]"]
  node_adminreports["Admin reports<br/>[reports.php]"]
  node_welcome["Welcome email dispatch"]
end

subgraph group_lecturer["Lecturer attendance"]
  node_lecturerdash["Lecturer dashboard<br/>[dashboard.php]"]
  node_lecturermodules["Assigned modules<br/>[modules.php]"]
  node_manualmark["Manual attendance marking"]
  node_lecturerqr["Lecturer QR scanner<br/>[qr_attendance.php]"]
  node_qrapi["QR mark endpoint<br/>[qr_mark.php]"]
  node_history["Attendance history"]
  node_lecturerreports["Lecturer reports<br/>[reports.php]"]
end

subgraph group_student["Student portal"]
  node_studentdash["Student dashboard<br/>[dashboard.php]"]
  node_studentmodules["Student modules<br/>[modules.php]"]
  node_studentattendance["Student attendance history<br/>[attendance.php]"]
  node_studentprofile["Student profile<br/>[profile.php]"]
  node_studentqr["Student QR check-in<br/>[qr_checkin.php]"]
end

node_users(("Campus users"))
node_mailserver(("SMTP service"))

node_users -->|"signs in"| node_login
node_login -->|"validates session"| node_auth
node_auth -->|"loads connection"| node_database
node_login -->|"routes by role"| node_lecturerdash
node_login -->|"routes by role"| node_studentdash
node_login -->|"routes by role"| node_adminmanage
node_adminmanage -->|"creates campus records"| node_database
node_adminmanage -.->|"sets enrollment"| node_enrollment
node_adminmanage -->|"requests welcome email"| node_mailer
node_welcome -->|"dispatches emails"| node_mailer
node_mailer -->|"sends SMTP mail"| node_mailserver
node_enrollment -.->|"updates enrollment"| node_database
node_adminattendance -.->|"reads records"| node_database
node_adminqr -->|"loads session data"| node_database
node_adminqr -.->|"submits scans"| node_qrapi
node_adminreports -.->|"reads attendance"| node_database
node_lecturerdash -->|"queries dashboard data"| node_database
node_lecturermodules -.->|"lists assignments"| node_database
node_manualmark -.->|"saves attendance"| node_database
node_lecturerqr -->|"submits scans"| node_qrapi
node_qrapi -.->|"records check-in"| node_database
node_history -.->|"reads past records"| node_database
node_lecturerreports -.->|"reads attendance"| node_database
node_studentdash -.->|"reads student data"| node_database
node_studentmodules -.->|"reads enrollment"| node_database
node_studentattendance -.->|"reads attendance"| node_database
node_studentprofile -.->|"reads profile"| node_database
node_studentqr -.->|"checks in"| node_qrapi
node_helpers -->|"calculates attendance rates"| node_database

click node_login "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/login.php"
click node_auth "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/includes/auth.php"
click node_helpers "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/includes/functions.php"
click node_mailer "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/includes/mailer.php"
click node_adminmanage "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/admin/add_student.php"
click node_enrollment "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/admin/module_students.php"
click node_adminattendance "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/admin/attendance_records.php"
click node_adminqr "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/admin/qr_attendance.php"
click node_adminreports "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/admin/reports.php"
click node_lecturerdash "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/lecturer/dashboard.php"
click node_lecturermodules "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/lecturer/modules.php"
click node_manualmark "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/lecturer/mark_attendance.php"
click node_lecturerqr "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/lecturer/qr_attendance.php"
click node_qrapi "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/includes/api/qr_mark.php"
click node_history "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/lecturer/attendance_history.php"
click node_lecturerreports "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/lecturer/reports.php"
click node_studentdash "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/student/dashboard.php"
click node_studentmodules "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/student/modules.php"
click node_studentattendance "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/student/attendance.php"
click node_studentprofile "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/student/profile.php"
click node_studentqr "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/student/qr_checkin.php"
click node_welcome "https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/admin/send_welcome_emails.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_login,node_auth,node_database,node_helpers,node_mailer,node_users toneBlue
class node_adminmanage,node_enrollment,node_adminattendance,node_adminqr,node_adminreports,node_welcome toneAmber
class node_lecturerdash,node_lecturermodules,node_manualmark,node_lecturerqr,node_qrapi,node_history,node_lecturerreports toneMint
class node_studentdash,node_studentmodules,node_studentattendance,node_studentprofile,node_studentqr toneRose
class node_mailserver toneIndigo
```

## Components

### Access and shared services

- [Login and routing](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/login.php): `login.php`
- [Session and role guard](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/includes/auth.php): `includes/auth.php`
- **MySQL campus database**
- [Attendance and page helpers](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/includes/functions.php): `includes/functions.php`
- [Welcome email service](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/includes/mailer.php): `includes/mailer.php`

### Campus administration

- [People and module management](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/admin/add_student.php): `admin/add_student.php`
- [Module enrollment](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/admin/module_students.php): `admin/module_students.php`
- [Admin attendance records](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/admin/attendance_records.php): `admin/attendance_records.php`
- [Admin QR attendance](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/admin/qr_attendance.php): `admin/qr_attendance.php`
- [Admin reports](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/admin/reports.php): `admin/reports.php`
- [Welcome email dispatch](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/admin/send_welcome_emails.php): `admin/send_welcome_emails.php`

### Lecturer attendance

- [Lecturer dashboard](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/lecturer/dashboard.php): `lecturer/dashboard.php`
- [Assigned modules](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/lecturer/modules.php): `lecturer/modules.php`
- [Manual attendance marking](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/lecturer/mark_attendance.php): `lecturer/mark_attendance.php`
- [Lecturer QR scanner](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/lecturer/qr_attendance.php): `lecturer/qr_attendance.php`
- [QR mark endpoint](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/includes/api/qr_mark.php): `includes/api/qr_mark.php`
- [Attendance history](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/lecturer/attendance_history.php): `lecturer/attendance_history.php`
- [Lecturer reports](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/lecturer/reports.php): `lecturer/reports.php`

### Student portal

- [Student dashboard](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/student/dashboard.php): `student/dashboard.php`
- [Student modules](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/student/modules.php): `student/modules.php`
- [Student attendance history](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/student/attendance.php): `student/attendance.php`
- [Student profile](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/student/profile.php): `student/profile.php`
- [Student QR check-in](https://github.com/mohamedakeeljm/campus_attendance_system/blob/main/student/qr_checkin.php): `student/qr_checkin.php`

### Other components

- **Campus users**
- **SMTP service**

## Connections

- Campus users → Login and routing: signs in (evidence: `README.md`)
- Login and routing → Session and role guard: validates session (evidence: `login.php`)
- Session and role guard → MySQL campus database: loads connection (evidence: `includes/auth.php`)
- Login and routing → Lecturer dashboard: routes by role
- Login and routing → Student dashboard: routes by role
- Login and routing → People and module management: routes by role
- People and module management → MySQL campus database: creates campus records (evidence: `admin/add_student.php`)
- People and module management → Module enrollment: sets enrollment
- People and module management → Welcome email service: requests welcome email (evidence: `admin/add_student.php`)
- Welcome email dispatch → Welcome email service: dispatches emails (evidence: `admin/send_welcome_emails.php`)
- Welcome email service → SMTP service: sends SMTP mail (evidence: `includes/mailer.php`)
- Module enrollment → MySQL campus database: updates enrollment
- Admin attendance records → MySQL campus database: reads records
- Admin QR attendance → MySQL campus database: loads session data (evidence: `admin/qr_attendance.php`)
- Admin QR attendance → QR mark endpoint: submits scans
- Admin reports → MySQL campus database: reads attendance
- Lecturer dashboard → MySQL campus database: queries dashboard data (evidence: `lecturer/dashboard.php`)
- Assigned modules → MySQL campus database: lists assignments
- Manual attendance marking → MySQL campus database: saves attendance
- Lecturer QR scanner → QR mark endpoint: submits scans (evidence: `lecturer/qr_attendance.php`)
- QR mark endpoint → MySQL campus database: records check-in
- Attendance history → MySQL campus database: reads past records
- Lecturer reports → MySQL campus database: reads attendance
- Student dashboard → MySQL campus database: reads student data
- Student modules → MySQL campus database: reads enrollment
- Student attendance history → MySQL campus database: reads attendance
- Student profile → MySQL campus database: reads profile
- Student QR check-in → QR mark endpoint: checks in
- Attendance and page helpers → MySQL campus database: calculates attendance rates (evidence: `includes/functions.php`)
