# jadoniyonkuru/attendance-system architecture

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

- Interactive diagram: https://gitdiagram.com/jadoniyonkuru/attendance-system
- Repository: https://github.com/jadoniyonkuru/attendance-system

## Overview

This is a PHP/MySQL multi-branch attendance application. Admins establish branches and managers; managers create employees and register their face descriptors; employees use browser-based face recognition and geolocation to check in or out, with server-side face, branch-radius, and work-time checks. Attendance can also be listed and swept for automatic checkout. The graph follows documented workflows and indexed source references; some page-to-client wiring is documented in the README rather than shown in the excerpts.

Main entry points: [`src/db.php`](https://github.com/jadoniyonkuru/attendance-system/blob/main/src/db.php) (PDO access), [`public/js/camera.js`](https://github.com/jadoniyonkuru/attendance-system/blob/main/public/js/camera.js) (Browser camera), [`public/index.php`](https://github.com/jadoniyonkuru/attendance-system/blob/main/public/index.php) (Sign-in), [`public/api/verify_checkin.php`](https://github.com/jadoniyonkuru/attendance-system/blob/main/public/api/verify_checkin.php) (Check-in verification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Accounts and roles"]
  node_login["Sign-in<br/>[index.php]"]
  node_auth["Session and roles<br/>[auth.php]"]
  node_manager_reg["Manager registration"]
  node_employee_reg["Employee registration"]
  node_face_capture["Face enrollment<br/>[save_face.php]"]
  node_camera["Browser camera<br/>[camera.js]"]
  node_face_models["Recognition models"]
end

subgraph group_setup["Branch setup"]
  node_branch_reg["Branch registration"]
  node_dashboard["Role dashboard<br/>[dashboard.php]"]
end

subgraph group_attendance["Attendance workflow"]
  node_checkin_page["Check-in page<br/>[checkin.php]"]
  node_verify["Check-in verification<br/>[verify_checkin.php]"]
  node_attendance_list["Attendance list"]
  node_auto_checkout["Auto-checkout sweep<br/>[auto_checkout.php]"]
end

subgraph group_shared["Shared runtime"]
  node_helpers["Geofence and matching<br/>[helpers.php]"]
  node_config["Runtime configuration<br/>[config.php]"]
  node_db_access["PDO access<br/>[db.php]"]
  node_mysql[("MySQL data<br/>[schema.sql]")]
end

node_admin(("Admin"))
node_manager(("Manager"))
node_employee(("Employee"))

node_employee -->|"signs in"| node_login
node_manager -->|"signs in"| node_login
node_admin -->|"signs in"| node_login
node_login -->|"starts session"| node_auth
node_login -->|"redirects"| node_dashboard
node_admin -->|"registers branch"| node_branch_reg
node_admin -->|"registers manager"| node_manager_reg
node_manager -->|"registers employee"| node_employee_reg
node_employee_reg -->|"loads"| node_camera
node_camera -->|"loads models"| node_face_models
node_camera -->|"sends descriptor"| node_face_capture
node_manager -->|"enrolls face"| node_face_capture
node_employee -->|"opens attendance"| node_checkin_page
node_checkin_page -->|"uses"| node_camera
node_camera -->|"sends descriptor and location"| node_verify
node_verify -->|"checks face and radius"| node_helpers
node_verify -->|"reads work rules"| node_config
node_verify -->|"reads and writes"| node_db_access
node_helpers -->|"loads branch"| node_db_access
node_helpers -->|"reads threshold"| node_config
node_attendance_list -->|"queries records"| node_db_access
node_auto_checkout -->|"updates attendance"| node_db_access
node_db_access -->|"reads credentials"| node_config
node_db_access -->|"connects"| node_mysql

click node_login "https://github.com/jadoniyonkuru/attendance-system/blob/main/public/index.php"
click node_auth "https://github.com/jadoniyonkuru/attendance-system/blob/main/src/auth.php"
click node_manager_reg "https://github.com/jadoniyonkuru/attendance-system/blob/main/public/register_manager.php"
click node_employee_reg "https://github.com/jadoniyonkuru/attendance-system/blob/main/public/register_employee.php"
click node_face_capture "https://github.com/jadoniyonkuru/attendance-system/blob/main/public/api/save_face.php"
click node_camera "https://github.com/jadoniyonkuru/attendance-system/blob/main/public/js/camera.js"
click node_face_models "https://github.com/jadoniyonkuru/attendance-system/tree/main/public/models"
click node_branch_reg "https://github.com/jadoniyonkuru/attendance-system/blob/main/public/register_branch.php"
click node_dashboard "https://github.com/jadoniyonkuru/attendance-system/blob/main/public/dashboard.php"
click node_checkin_page "https://github.com/jadoniyonkuru/attendance-system/blob/main/public/checkin.php"
click node_verify "https://github.com/jadoniyonkuru/attendance-system/blob/main/public/api/verify_checkin.php"
click node_attendance_list "https://github.com/jadoniyonkuru/attendance-system/blob/main/public/attendance_list.php"
click node_auto_checkout "https://github.com/jadoniyonkuru/attendance-system/blob/main/public/api/auto_checkout.php"
click node_helpers "https://github.com/jadoniyonkuru/attendance-system/blob/main/src/helpers.php"
click node_config "https://github.com/jadoniyonkuru/attendance-system/blob/main/config.php"
click node_db_access "https://github.com/jadoniyonkuru/attendance-system/blob/main/src/db.php"
click node_mysql "https://github.com/jadoniyonkuru/attendance-system/blob/main/schema.sql"

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_manager_reg,node_employee_reg,node_face_capture,node_camera,node_face_models toneBlue
class node_branch_reg,node_dashboard toneAmber
class node_checkin_page,node_verify,node_attendance_list,node_auto_checkout toneMint
class node_helpers,node_config,node_db_access,node_mysql toneRose
class node_admin,node_manager,node_employee toneIndigo
```

## Components

### Accounts and roles

- [Sign-in](https://github.com/jadoniyonkuru/attendance-system/blob/main/public/index.php): `public/index.php`
- [Session and roles](https://github.com/jadoniyonkuru/attendance-system/blob/main/src/auth.php): `src/auth.php`
- [Manager registration](https://github.com/jadoniyonkuru/attendance-system/blob/main/public/register_manager.php): `public/register_manager.php`
- [Employee registration](https://github.com/jadoniyonkuru/attendance-system/blob/main/public/register_employee.php): `public/register_employee.php`
- [Face enrollment](https://github.com/jadoniyonkuru/attendance-system/blob/main/public/api/save_face.php): `public/api/save_face.php`
- [Browser camera](https://github.com/jadoniyonkuru/attendance-system/blob/main/public/js/camera.js): `public/js/camera.js`
- [Recognition models](https://github.com/jadoniyonkuru/attendance-system/tree/main/public/models): `public/models`

### Branch setup

- [Branch registration](https://github.com/jadoniyonkuru/attendance-system/blob/main/public/register_branch.php): `public/register_branch.php`
- [Role dashboard](https://github.com/jadoniyonkuru/attendance-system/blob/main/public/dashboard.php): `public/dashboard.php`

### Attendance workflow

- [Check-in page](https://github.com/jadoniyonkuru/attendance-system/blob/main/public/checkin.php): `public/checkin.php`
- [Check-in verification](https://github.com/jadoniyonkuru/attendance-system/blob/main/public/api/verify_checkin.php): `public/api/verify_checkin.php`
- [Attendance list](https://github.com/jadoniyonkuru/attendance-system/blob/main/public/attendance_list.php): `public/attendance_list.php`
- [Auto-checkout sweep](https://github.com/jadoniyonkuru/attendance-system/blob/main/public/api/auto_checkout.php): `public/api/auto_checkout.php`

### Shared runtime

- [Geofence and matching](https://github.com/jadoniyonkuru/attendance-system/blob/main/src/helpers.php): `src/helpers.php`
- [Runtime configuration](https://github.com/jadoniyonkuru/attendance-system/blob/main/config.php): `config.php`
- [PDO access](https://github.com/jadoniyonkuru/attendance-system/blob/main/src/db.php): `src/db.php`
- [MySQL data](https://github.com/jadoniyonkuru/attendance-system/blob/main/schema.sql): `schema.sql`

### Other components

- **Admin**
- **Manager**
- **Employee**

## Connections

- Employee → Sign-in: signs in (evidence: `README.md`)
- Manager → Sign-in: signs in (evidence: `README.md`)
- Admin → Sign-in: signs in (evidence: `README.md`)
- Sign-in → Session and roles: starts session (evidence: `public/index.php`)
- Sign-in → Role dashboard: redirects (evidence: `public/index.php`)
- Admin → Branch registration: registers branch (evidence: `README.md`)
- Admin → Manager registration: registers manager (evidence: `README.md`)
- Manager → Employee registration: registers employee (evidence: `README.md`)
- Employee registration → Browser camera: loads (evidence: `README.md`)
- Browser camera → Recognition models: loads models (evidence: `README.md`)
- Browser camera → Face enrollment: sends descriptor (evidence: `README.md`)
- Manager → Face enrollment: enrolls face (evidence: `README.md`)
- Employee → Check-in page: opens attendance (evidence: `README.md`)
- Check-in page → Browser camera: uses (evidence: `README.md`)
- Browser camera → Check-in verification: sends descriptor and location (evidence: `README.md`)
- Check-in verification → Geofence and matching: checks face and radius (evidence: `public/api/verify_checkin.php`)
- Check-in verification → Runtime configuration: reads work rules (evidence: `public/api/verify_checkin.php`)
- Check-in verification → PDO access: reads and writes (evidence: `public/api/verify_checkin.php`)
- Geofence and matching → PDO access: loads branch (evidence: `src/helpers.php`)
- Geofence and matching → Runtime configuration: reads threshold (evidence: `src/helpers.php`)
- Attendance list → PDO access: queries records (evidence: `public/attendance_list.php`)
- Auto-checkout sweep → PDO access: updates attendance (evidence: `public/api/auto_checkout.php`)
- PDO access → Runtime configuration: reads credentials (evidence: `src/db.php`)
- PDO access → MySQL data: connects (evidence: `README.md`)
