# rexshin1/absensi-iot architecture

> Architecture diagram of the GitHub repository rexshin1/absensi-iot, 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/rexshin1/absensi-iot
- Repository: https://github.com/rexshin1/absensi-iot

## Overview

The product is a Laravel-backed IoT attendance and health-monitoring system. ESP32 enrollment broadcasts fingerprint IDs for browser enrollment; attendance scans record BPM and attendance. Admin workflows manage student records and inspect daily analytics and historical attendance/health recaps. The README documents the Pusher-to-browser enrollment flow; browser-side subscription code is not in the sampled sources, so that link reflects documentation rather than inspected implementation.

Main entry points: [`app/Http/Controllers/DashboardController.php`](https://github.com/rexshin1/absensi-iot/blob/main/app/Http/Controllers/DashboardController.php) (Admin dashboard), [`app/Http/Controllers/Api/EnrollmentController.php`](https://github.com/rexshin1/absensi-iot/blob/main/app/Http/Controllers/Api/EnrollmentController.php) (Enrollment API), [`app/Http/Controllers/Api/AttendanceController.php`](https://github.com/rexshin1/absensi-iot/blob/main/app/Http/Controllers/Api/AttendanceController.php) (Attendance API), [`routes/api.php`](https://github.com/rexshin1/absensi-iot/blob/main/routes/api.php) (API routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_iot["IoT workflows"]
  node_enrollment["Enrollment API"]
  node_attendance_api["Attendance API"]
  node_fingerprint_event["Fingerprint event"]
end

subgraph group_admin["Admin workflows"]
  node_dashboard["Admin dashboard"]
  node_dashboard_view["Dashboard view<br/>[index.blade.php]"]
  node_student_views["Student screens<br/>[index.blade.php]"]
  node_recap_view["Attendance recap<br/>[recap.blade.php]"]
  node_master_view["Master data view<br/>[index.blade.php]"]
end

subgraph group_core["Backend services"]
  node_api_routes["API routes<br/>[api.php]"]
  node_athletes[("Athlete records<br/>[Athlete.php]")]
  node_attendance_records[("Attendance records<br/>[Attendance.php]")]
  node_users[("Student records<br/>[User.php]")]
  node_device_cache["Device mode cache"]
  node_web_routes["Web routes<br/>[web.php]"]
end

node_esp32(("ESP32 sensors"))
node_pusher["Pusher Channels"]
node_browser(("Browser client"))

node_esp32 -->|"sends HTTP"| node_api_routes
node_api_routes -->|"dispatches enrollment"| node_enrollment
node_api_routes -->|"dispatches attendance"| node_attendance_api
node_enrollment -->|"fires event"| node_fingerprint_event
node_fingerprint_event -.->|"broadcasts ID"| node_pusher
node_pusher -.->|"sends WebSocket event"| node_browser
node_enrollment -->|"looks up fingerprint"| node_athletes
node_enrollment -->|"reads/writes mode"| node_device_cache
node_attendance_api -->|"finds athlete"| node_athletes
node_attendance_api -->|"looks up user"| node_users
node_attendance_api -->|"creates record"| node_attendance_records
node_browser -->|"requests pages"| node_web_routes
node_web_routes -->|"dispatches web actions"| node_dashboard
node_dashboard -->|"renders dashboard"| node_dashboard_view
node_dashboard -->|"renders student screens"| node_student_views
node_dashboard -->|"renders recap"| node_recap_view
node_dashboard -->|"renders master data"| node_master_view
node_dashboard -->|"reads attendance"| node_attendance_records
node_dashboard -->|"reads athlete totals"| node_athletes
node_dashboard -->|"reads/writes students"| node_users
node_dashboard -->|"sets device mode"| node_device_cache

click node_api_routes "https://github.com/rexshin1/absensi-iot/blob/main/routes/api.php"
click node_enrollment "https://github.com/rexshin1/absensi-iot/blob/main/app/Http/Controllers/Api/EnrollmentController.php"
click node_attendance_api "https://github.com/rexshin1/absensi-iot/blob/main/app/Http/Controllers/Api/AttendanceController.php"
click node_fingerprint_event "https://github.com/rexshin1/absensi-iot/blob/main/app/Events/FingerprintScanned.php"
click node_athletes "https://github.com/rexshin1/absensi-iot/blob/main/app/Models/Athlete.php"
click node_attendance_records "https://github.com/rexshin1/absensi-iot/blob/main/app/Models/Attendance.php"
click node_users "https://github.com/rexshin1/absensi-iot/blob/main/app/Models/User.php"
click node_device_cache "https://github.com/rexshin1/absensi-iot/blob/main/app/Http/Controllers/Api/EnrollmentController.php"
click node_web_routes "https://github.com/rexshin1/absensi-iot/blob/main/routes/web.php"
click node_dashboard "https://github.com/rexshin1/absensi-iot/blob/main/app/Http/Controllers/DashboardController.php"
click node_dashboard_view "https://github.com/rexshin1/absensi-iot/blob/main/resources/views/dashboard/index.blade.php"
click node_student_views "https://github.com/rexshin1/absensi-iot/blob/main/resources/views/students/index.blade.php"
click node_recap_view "https://github.com/rexshin1/absensi-iot/blob/main/resources/views/attendance/recap.blade.php"
click node_master_view "https://github.com/rexshin1/absensi-iot/blob/main/resources/views/master-data/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_enrollment,node_attendance_api,node_fingerprint_event,node_browser toneBlue
class node_dashboard,node_dashboard_view,node_student_views,node_recap_view,node_master_view toneAmber
class node_api_routes,node_athletes,node_attendance_records,node_users,node_device_cache,node_web_routes toneMint
class node_esp32,node_pusher toneIndigo
```

## Components

### IoT workflows

- [Enrollment API](https://github.com/rexshin1/absensi-iot/blob/main/app/Http/Controllers/Api/EnrollmentController.php): `app/Http/Controllers/Api/EnrollmentController.php`
- [Attendance API](https://github.com/rexshin1/absensi-iot/blob/main/app/Http/Controllers/Api/AttendanceController.php): `app/Http/Controllers/Api/AttendanceController.php`
- [Fingerprint event](https://github.com/rexshin1/absensi-iot/blob/main/app/Events/FingerprintScanned.php): `app/Events/FingerprintScanned.php`

### Admin workflows

- [Admin dashboard](https://github.com/rexshin1/absensi-iot/blob/main/app/Http/Controllers/DashboardController.php): `app/Http/Controllers/DashboardController.php`
- [Dashboard view](https://github.com/rexshin1/absensi-iot/blob/main/resources/views/dashboard/index.blade.php): `resources/views/dashboard/index.blade.php`
- [Student screens](https://github.com/rexshin1/absensi-iot/blob/main/resources/views/students/index.blade.php): `resources/views/students/index.blade.php`
- [Attendance recap](https://github.com/rexshin1/absensi-iot/blob/main/resources/views/attendance/recap.blade.php): `resources/views/attendance/recap.blade.php`
- [Master data view](https://github.com/rexshin1/absensi-iot/blob/main/resources/views/master-data/index.blade.php): `resources/views/master-data/index.blade.php`

### Backend services

- [API routes](https://github.com/rexshin1/absensi-iot/blob/main/routes/api.php): `routes/api.php`
- [Athlete records](https://github.com/rexshin1/absensi-iot/blob/main/app/Models/Athlete.php): `app/Models/Athlete.php`
- [Attendance records](https://github.com/rexshin1/absensi-iot/blob/main/app/Models/Attendance.php): `app/Models/Attendance.php`
- [Student records](https://github.com/rexshin1/absensi-iot/blob/main/app/Models/User.php): `app/Models/User.php`
- [Device mode cache](https://github.com/rexshin1/absensi-iot/blob/main/app/Http/Controllers/Api/EnrollmentController.php): `app/Http/Controllers/Api/EnrollmentController.php`
- [Web routes](https://github.com/rexshin1/absensi-iot/blob/main/routes/web.php): `routes/web.php`

### Other components

- **ESP32 sensors**
- **Pusher Channels**
- **Browser client**

## Connections

- ESP32 sensors → API routes: sends HTTP
- API routes → Enrollment API: dispatches enrollment
- API routes → Attendance API: dispatches attendance
- Enrollment API → Fingerprint event: fires event
- Fingerprint event → Pusher Channels: broadcasts ID
- Pusher Channels → Browser client: sends WebSocket event
- Enrollment API → Athlete records: looks up fingerprint
- Enrollment API → Device mode cache: reads/writes mode
- Attendance API → Athlete records: finds athlete
- Attendance API → Student records: looks up user
- Attendance API → Attendance records: creates record
- Browser client → Web routes: requests pages
- Web routes → Admin dashboard: dispatches web actions
- Admin dashboard → Dashboard view: renders dashboard
- Admin dashboard → Student screens: renders student screens
- Admin dashboard → Attendance recap: renders recap
- Admin dashboard → Master data view: renders master data
- Admin dashboard → Attendance records: reads attendance
- Admin dashboard → Athlete records: reads athlete totals
- Admin dashboard → Student records: reads/writes students
- Admin dashboard → Device mode cache: sets device mode
