# cihaimasuiro/absensi-cam architecture

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

- Interactive diagram: https://gitdiagram.com/cihaimasuiro/absensi-cam
- Repository: https://github.com/cihaimasuiro/absensi-cam

## Overview

Absensi-Cam is an offline-first attendance product: administrators manage students and enrollment in Laravel, paired edge devices perform local face recognition, and attendance syncs back for review and reporting. The graph includes the documented Rust production engine and Python reference engine. Source evidence is uneven: several backend and Python paths are excerpted or indexed, while Rust internals and some backend features are described only in the README, so those connections cite the README rather than implying source-level inspection.

Main entry points: [`archive/edge-engine-py/engine.py`](https://github.com/cihaimasuiro/absensi-cam/blob/main/archive/edge-engine-py/engine.py) (Python Edge Engine), [`app/Http/Controllers/Web/StudentWebController.php`](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Http/Controllers/Web/StudentWebController.php) (Student Management), [`app/Jobs/GenerateFaceEmbedding.php`](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Jobs/GenerateFaceEmbedding.php) (Embedding Worker), [`clients/edge-engine-rs/crates/engine-cli/src/main.rs`](https://github.com/cihaimasuiro/absensi-cam/blob/main/clients/edge-engine-rs/crates/engine-cli/src/main.rs) (Recognition Engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_admin["Administration"]
  node_student_ui["Student Management"]
  node_device_admin["Device Management"]
  node_report_ui["Report Dashboard"]
end

subgraph group_backend["Backend Services"]
  node_student_data[("Student Records<br/>[Student.php]")]
  node_enrollment["Face Enrollment<br/>[EnrollFace.php]"]
  node_embedding_job["Embedding Worker"]
  node_encryption["Embedding Encryption"]
  node_templates[("Face Templates<br/>[FaceTemplate.php]")]
  node_device_api["Device API"]
  node_pairing["Device Pairing<br/>[PairDevice.php]"]
  node_ota["Model Updates"]
  node_attendance_api["Attendance Ingest"]
  node_attendance_sync["Batch Sync"]
  node_attendance_data[("Attendance Records<br/>[AttendanceLog.php]")]
  node_reporting["Attendance Reports<br/>[DtrService.php]"]
end

subgraph group_production_edge["Production Edge"]
  node_rust_engine["Recognition Engine<br/>[main.rs]"]
  node_rust_vision["Vision Pipeline<br/>[lib.rs]"]
  node_rust_local_db[("Local Attendance Store<br/>[db.rs]")]
  node_rust_sync["Outbox Sync Daemon<br/>[lib.rs]"]
end

subgraph group_reference_edge["Reference Edge"]
  node_python_engine["Python Edge Engine<br/>[engine.py]"]
  node_python_pipeline["Recognition Pipeline"]
  node_python_store[("Python Local Store<br/>[database.py]")]
end

node_administrator(("Administrator"))
node_edge_device(("Paired Edge Device"))

node_administrator -->|"manages students"| node_student_ui
node_student_ui -->|"updates records"| node_student_data
node_student_ui -->|"enrolls faces"| node_enrollment
node_enrollment -.->|"generates embeddings"| node_embedding_job
node_embedding_job -->|"stores templates"| node_templates
node_embedding_job -->|"encrypts embeddings"| node_encryption
node_device_api -->|"serves template deltas"| node_templates
node_edge_device -->|"syncs templates"| node_device_api
node_administrator -->|"manages devices"| node_device_admin
node_device_admin -.->|"creates pairing codes"| node_pairing
node_administrator -->|"triggers updates"| node_ota
node_ota -->|"distributes models"| node_edge_device
node_edge_device -->|"runs locally"| node_rust_engine
node_rust_engine -->|"performs inference"| node_rust_vision
node_rust_engine -->|"records attendance"| node_rust_local_db
node_rust_sync -->|"drains outbox"| node_rust_local_db
node_rust_sync -->|"syncs batches"| node_attendance_api
node_attendance_api -->|"delegates batches"| node_attendance_sync
node_attendance_sync -->|"persists logs"| node_attendance_data
node_administrator -->|"reviews attendance"| node_report_ui
node_report_ui -.->|"requests reports"| node_reporting
node_edge_device -.->|"runs reference engine"| node_python_engine
node_python_engine -->|"processes camera frames"| node_python_pipeline
node_python_engine -->|"records attendance"| node_python_store
node_python_engine -.->|"may use external sync"| node_rust_sync
node_python_pipeline -.->|"matches local templates"| node_python_store

click node_student_ui "https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Http/Controllers/Web/StudentWebController.php"
click node_student_data "https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Domain/Student/Models/Student.php"
click node_enrollment "https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Domain/Enrollment/Actions/EnrollFace.php"
click node_embedding_job "https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Jobs/GenerateFaceEmbedding.php"
click node_encryption "https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Domain/Enrollment/Services/FaceEncryptionService.php"
click node_templates "https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Domain/Enrollment/Models/FaceTemplate.php"
click node_device_api "https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Http/Controllers/API/V1/Enrollment/TemplateController.php"
click node_device_admin "https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Http/Controllers/Web/DeviceController.php"
click node_pairing "https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Domain/Device/Actions/PairDevice.php"
click node_ota "https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Console/Commands/PushModelUpdate.php"
click node_attendance_api "https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Http/Controllers/API/V1/Attendance/AttendanceBatchController.php"
click node_attendance_sync "https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Domain/Attendance/Actions/SyncAttendanceBatch.php"
click node_attendance_data "https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Domain/Attendance/Models/AttendanceLog.php"
click node_reporting "https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Domain/Report/Services/DtrService.php"
click node_report_ui "https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Http/Controllers/Web/ReportController.php"
click node_rust_engine "https://github.com/cihaimasuiro/absensi-cam/blob/main/clients/edge-engine-rs/crates/engine-cli/src/main.rs"
click node_rust_vision "https://github.com/cihaimasuiro/absensi-cam/blob/main/clients/edge-engine-rs/crates/engine-vision/src/lib.rs"
click node_rust_local_db "https://github.com/cihaimasuiro/absensi-cam/blob/main/clients/edge-engine-rs/crates/engine-core/src/db.rs"
click node_rust_sync "https://github.com/cihaimasuiro/absensi-cam/blob/main/clients/edge-engine-rs/crates/engine-sync/src/lib.rs"
click node_python_engine "https://github.com/cihaimasuiro/absensi-cam/blob/main/archive/edge-engine-py/engine.py"
click node_python_pipeline "https://github.com/cihaimasuiro/absensi-cam/blob/main/archive/edge-engine-py/services/detection_pipeline.py"
click node_python_store "https://github.com/cihaimasuiro/absensi-cam/blob/main/archive/edge-engine-py/database.py"

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_student_ui,node_device_admin,node_report_ui toneBlue
class node_student_data,node_enrollment,node_embedding_job,node_encryption,node_templates,node_device_api,node_pairing,node_ota,node_attendance_api,node_attendance_sync,node_attendance_data,node_reporting toneAmber
class node_rust_engine,node_rust_vision,node_rust_local_db,node_rust_sync toneMint
class node_python_engine,node_python_pipeline,node_python_store toneRose
class node_administrator,node_edge_device toneIndigo
```

## Components

### Administration

- [Student Management](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Http/Controllers/Web/StudentWebController.php): `app/Http/Controllers/Web/StudentWebController.php`
- [Device Management](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Http/Controllers/Web/DeviceController.php): `app/Http/Controllers/Web/DeviceController.php`
- [Report Dashboard](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Http/Controllers/Web/ReportController.php): `app/Http/Controllers/Web/ReportController.php`

### Backend Services

- [Student Records](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Domain/Student/Models/Student.php): `app/Domain/Student/Models/Student.php`
- [Face Enrollment](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Domain/Enrollment/Actions/EnrollFace.php): `app/Domain/Enrollment/Actions/EnrollFace.php`
- [Embedding Worker](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Jobs/GenerateFaceEmbedding.php): `app/Jobs/GenerateFaceEmbedding.php`
- [Embedding Encryption](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Domain/Enrollment/Services/FaceEncryptionService.php): `app/Domain/Enrollment/Services/FaceEncryptionService.php`
- [Face Templates](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Domain/Enrollment/Models/FaceTemplate.php): `app/Domain/Enrollment/Models/FaceTemplate.php`
- [Device API](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Http/Controllers/API/V1/Enrollment/TemplateController.php): `app/Http/Controllers/API/V1/Enrollment/TemplateController.php`
- [Device Pairing](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Domain/Device/Actions/PairDevice.php): `app/Domain/Device/Actions/PairDevice.php`
- [Model Updates](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Console/Commands/PushModelUpdate.php): `app/Console/Commands/PushModelUpdate.php`
- [Attendance Ingest](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Http/Controllers/API/V1/Attendance/AttendanceBatchController.php): `app/Http/Controllers/API/V1/Attendance/AttendanceBatchController.php`
- [Batch Sync](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Domain/Attendance/Actions/SyncAttendanceBatch.php): `app/Domain/Attendance/Actions/SyncAttendanceBatch.php`
- [Attendance Records](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Domain/Attendance/Models/AttendanceLog.php): `app/Domain/Attendance/Models/AttendanceLog.php`
- [Attendance Reports](https://github.com/cihaimasuiro/absensi-cam/blob/main/app/Domain/Report/Services/DtrService.php): `app/Domain/Report/Services/DtrService.php`

### Production Edge

- [Recognition Engine](https://github.com/cihaimasuiro/absensi-cam/blob/main/clients/edge-engine-rs/crates/engine-cli/src/main.rs): `clients/edge-engine-rs/crates/engine-cli/src/main.rs`
- [Vision Pipeline](https://github.com/cihaimasuiro/absensi-cam/blob/main/clients/edge-engine-rs/crates/engine-vision/src/lib.rs): `clients/edge-engine-rs/crates/engine-vision/src/lib.rs`
- [Local Attendance Store](https://github.com/cihaimasuiro/absensi-cam/blob/main/clients/edge-engine-rs/crates/engine-core/src/db.rs): `clients/edge-engine-rs/crates/engine-core/src/db.rs`
- [Outbox Sync Daemon](https://github.com/cihaimasuiro/absensi-cam/blob/main/clients/edge-engine-rs/crates/engine-sync/src/lib.rs): `clients/edge-engine-rs/crates/engine-sync/src/lib.rs`

### Reference Edge

- [Python Edge Engine](https://github.com/cihaimasuiro/absensi-cam/blob/main/archive/edge-engine-py/engine.py): `archive/edge-engine-py/engine.py`
- [Recognition Pipeline](https://github.com/cihaimasuiro/absensi-cam/blob/main/archive/edge-engine-py/services/detection_pipeline.py): `archive/edge-engine-py/services/detection_pipeline.py`
- [Python Local Store](https://github.com/cihaimasuiro/absensi-cam/blob/main/archive/edge-engine-py/database.py): `archive/edge-engine-py/database.py`

### Other components

- **Administrator**
- **Paired Edge Device**

## Connections

- Administrator → Student Management: manages students (evidence: `README.md`)
- Student Management → Student Records: updates records (evidence: `app/Http/Controllers/Web/StudentWebController.php`)
- Student Management → Face Enrollment: enrolls faces (evidence: `app/Http/Controllers/Web/StudentWebController.php`)
- Face Enrollment → Embedding Worker: generates embeddings (evidence: `README.md`)
- Embedding Worker → Face Templates: stores templates (evidence: `app/Jobs/GenerateFaceEmbedding.php`)
- Embedding Worker → Embedding Encryption: encrypts embeddings (evidence: `app/Jobs/GenerateFaceEmbedding.php`)
- Device API → Face Templates: serves template deltas (evidence: `app/Http/Controllers/API/V1/Enrollment/TemplateController.php`)
- Paired Edge Device → Device API: syncs templates (evidence: `README.md`)
- Administrator → Device Management: manages devices (evidence: `README.md`)
- Device Management → Device Pairing: creates pairing codes (evidence: `README.md`)
- Administrator → Model Updates: triggers updates (evidence: `README.md`)
- Model Updates → Paired Edge Device: distributes models (evidence: `README.md`)
- Paired Edge Device → Recognition Engine: runs locally (evidence: `README.md`)
- Recognition Engine → Vision Pipeline: performs inference (evidence: `README.md`)
- Recognition Engine → Local Attendance Store: records attendance (evidence: `README.md`)
- Outbox Sync Daemon → Local Attendance Store: drains outbox (evidence: `README.md`)
- Outbox Sync Daemon → Attendance Ingest: syncs batches (evidence: `README.md`)
- Attendance Ingest → Batch Sync: delegates batches (evidence: `app/Http/Controllers/API/V1/Attendance/AttendanceBatchController.php`)
- Batch Sync → Attendance Records: persists logs (evidence: `app/Domain/Attendance/Actions/SyncAttendanceBatch.php`)
- Administrator → Report Dashboard: reviews attendance (evidence: `README.md`)
- Report Dashboard → Attendance Reports: requests reports (evidence: `README.md`)
- Paired Edge Device → Python Edge Engine: runs reference engine (evidence: `README.md`)
- Python Edge Engine → Recognition Pipeline: processes camera frames (evidence: `archive/edge-engine-py/engine.py`)
- Python Edge Engine → Python Local Store: records attendance (evidence: `archive/edge-engine-py/engine.py`)
- Python Edge Engine → Outbox Sync Daemon: may use external sync (evidence: `README.md`)
- Recognition Pipeline → Python Local Store: matches local templates
