# moturumonishpvt-byte/facultyapp_sc architecture

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

- Interactive diagram: https://gitdiagram.com/moturumonishpvt-byte/facultyapp_sc
- Repository: https://github.com/moturumonishpvt-byte/facultyapp_sc

## Overview

Academic Monitor is a faculty mobile app for offline-capable identity verification and classroom attendance. A faculty member syncs identity data when possible, scans their face, selects a class, broadcasts a BLE session, and uses an OTP to confirm attendance before reviewing and saving records. The map includes the React Native screens and services plus Android native modules and local/cloud state. Some screen and native implementations were not excerpted, so only documented or indexed relationships are shown; uncertain links are omitted.

Main entry points: [`src/navigation/AppNavigator.tsx`](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/navigation/AppNavigator.tsx) (App Navigator), [`src/ble/FacultyBLEModule.ts`](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/ble/FacultyBLEModule.ts) (BLE Session Logic), [`src/services/faceService.ts`](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/services/faceService.ts) (Face Matching), [`src/services/timetableService.ts`](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/services/timetableService.ts) (Timetable Data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Faculty App"]
  node_app_root["App Root<br/>[App.tsx]"]
  node_navigator["App Navigator<br/>[AppNavigator.tsx]"]
  node_timetable_screen["Timetable"]
  node_theme["Theme Tokens<br/>[theme.ts]"]
end

subgraph group_identity["Identity Verification"]
  node_face_screen["Face Scan<br/>[FaceScanScreen.tsx]"]
  node_face_hook["Scan Loop"]
  node_face_service["Face Matching<br/>[faceService.ts]"]
end

subgraph group_session["Session Management"]
  node_ble_screen["BLE Session"]
  node_ble_js["BLE Session Logic"]
  node_ble_constants["BLE Constants<br/>[BLEConstants.ts]"]
  node_otp_screen["OTP Confirmation<br/>[OTPScreen.tsx]"]
  node_result_screen["Attendance Review<br/>[ResultScreen.tsx]"]
end

subgraph group_data["Data Services"]
  node_timetable_service["Timetable Data"]
  node_supabase[("Supabase<br/>[supabaseClient.ts]")]
  node_local_cache[("MMKV Cache<br/>[storageService.ts]")]
end

subgraph group_native["Android Native"]
  node_face_native["Face Pipeline"]
  node_ble_native["BLE Peripheral"]
end

node_faculty(("Faculty"))
node_students(("Student Devices"))

node_faculty -->|"uses"| node_app_root
node_app_root -->|"mounts"| node_navigator
node_navigator -->|"starts at"| node_face_screen
node_navigator -->|"routes to"| node_timetable_screen
node_navigator -->|"routes to"| node_ble_screen
node_navigator -->|"routes to"| node_otp_screen
node_navigator -->|"routes to"| node_result_screen
node_face_screen -->|"uses"| node_face_hook
node_face_screen -->|"syncs embeddings"| node_face_service
node_face_hook -->|"processes frames"| node_face_native
node_face_hook -->|"matches embeddings"| node_face_service
node_face_service -->|"fetches embeddings"| node_supabase
node_face_service -->|"caches embeddings"| node_local_cache
node_faculty -->|"selects class"| node_timetable_screen
node_timetable_screen -->|"loads schedule"| node_timetable_service
node_timetable_service -->|"reads timetable"| node_supabase
node_ble_screen -->|"starts session"| node_ble_js
node_ble_js -->|"controls peripheral"| node_ble_native
node_ble_js -->|"uses protocol"| node_ble_constants
node_ble_native -->|"broadcasts session"| node_students
node_students -->|"connects locally"| node_ble_native
node_otp_screen -->|"generates OTP"| node_ble_js
node_ble_js -->|"requests OTP"| node_students
node_otp_screen -->|"finishes session"| node_result_screen
node_result_screen -->|"saves attendance"| node_timetable_service
node_timetable_service -->|"writes attendance"| node_supabase

click node_app_root "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/App.tsx"
click node_navigator "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/navigation/AppNavigator.tsx"
click node_face_screen "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/screens/FaceScanScreen.tsx"
click node_face_hook "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/hooks/useFaceRecognition.ts"
click node_face_service "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/services/faceService.ts"
click node_face_native "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/android/app/src/main/java/com/am_faculty/FaceRecognitionModule.kt"
click node_timetable_screen "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/screens/TimetableScreen.tsx"
click node_timetable_service "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/services/timetableService.ts"
click node_ble_screen "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/screens/BLESessionScreen.tsx"
click node_ble_js "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/ble/FacultyBLEModule.ts"
click node_ble_constants "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/ble/BLEConstants.ts"
click node_ble_native "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/android/app/src/main/java/com/am_faculty/BLEPeripheralModule.kt"
click node_otp_screen "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/screens/OTPScreen.tsx"
click node_result_screen "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/screens/ResultScreen.tsx"
click node_supabase "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/services/supabaseClient.ts"
click node_local_cache "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/services/storageService.ts"
click node_theme "https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/constants/theme.ts"

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_app_root,node_navigator,node_timetable_screen,node_theme toneBlue
class node_face_screen,node_face_hook,node_face_service toneAmber
class node_ble_screen,node_ble_js,node_ble_constants,node_otp_screen,node_result_screen toneMint
class node_timetable_service,node_supabase,node_local_cache toneRose
class node_face_native,node_ble_native,node_faculty,node_students toneIndigo
```

## Components

### Faculty App

- [App Root](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/App.tsx): `App.tsx`
- [App Navigator](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/navigation/AppNavigator.tsx): `src/navigation/AppNavigator.tsx`
- [Timetable](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/screens/TimetableScreen.tsx): `src/screens/TimetableScreen.tsx`
- [Theme Tokens](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/constants/theme.ts): `src/constants/theme.ts`

### Identity Verification

- [Face Scan](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/screens/FaceScanScreen.tsx): `src/screens/FaceScanScreen.tsx`
- [Scan Loop](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/hooks/useFaceRecognition.ts): `src/hooks/useFaceRecognition.ts`
- [Face Matching](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/services/faceService.ts): `src/services/faceService.ts`

### Session Management

- [BLE Session](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/screens/BLESessionScreen.tsx): `src/screens/BLESessionScreen.tsx`
- [BLE Session Logic](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/ble/FacultyBLEModule.ts): `src/ble/FacultyBLEModule.ts`
- [BLE Constants](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/ble/BLEConstants.ts): `src/ble/BLEConstants.ts`
- [OTP Confirmation](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/screens/OTPScreen.tsx): `src/screens/OTPScreen.tsx`
- [Attendance Review](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/screens/ResultScreen.tsx): `src/screens/ResultScreen.tsx`

### Data Services

- [Timetable Data](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/services/timetableService.ts): `src/services/timetableService.ts`
- [Supabase](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/services/supabaseClient.ts): `src/services/supabaseClient.ts`
- [MMKV Cache](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/src/services/storageService.ts): `src/services/storageService.ts`

### Android Native

- [Face Pipeline](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/android/app/src/main/java/com/am_faculty/FaceRecognitionModule.kt): `android/app/src/main/java/com/am_faculty/FaceRecognitionModule.kt`
- [BLE Peripheral](https://github.com/moturumonishpvt-byte/facultyapp_sc/blob/main/android/app/src/main/java/com/am_faculty/BLEPeripheralModule.kt): `android/app/src/main/java/com/am_faculty/BLEPeripheralModule.kt`

### Other components

- **Faculty**
- **Student Devices**

## Connections

- Faculty → App Root: uses (evidence: `README.md`)
- App Root → App Navigator: mounts (evidence: `App.tsx`)
- App Navigator → Face Scan: starts at (evidence: `src/navigation/AppNavigator.tsx`)
- App Navigator → Timetable: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- App Navigator → BLE Session: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- App Navigator → OTP Confirmation: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- App Navigator → Attendance Review: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- Face Scan → Scan Loop: uses (evidence: `src/screens/FaceScanScreen.tsx`)
- Face Scan → Face Matching: syncs embeddings (evidence: `src/screens/FaceScanScreen.tsx`)
- Scan Loop → Face Pipeline: processes frames (evidence: `src/hooks/useFaceRecognition.ts`)
- Scan Loop → Face Matching: matches embeddings (evidence: `src/hooks/useFaceRecognition.ts`)
- Face Matching → Supabase: fetches embeddings (evidence: `src/services/faceService.ts`)
- Face Matching → MMKV Cache: caches embeddings (evidence: `src/services/faceService.ts`)
- Faculty → Timetable: selects class (evidence: `README.md`)
- Timetable → Timetable Data: loads schedule (evidence: `README.md`)
- Timetable Data → Supabase: reads timetable (evidence: `src/services/timetableService.ts`)
- BLE Session → BLE Session Logic: starts session (evidence: `src/screens/BLESessionScreen.tsx`)
- BLE Session Logic → BLE Peripheral: controls peripheral (evidence: `src/ble/FacultyBLEModule.ts`)
- BLE Session Logic → BLE Constants: uses protocol (evidence: `src/ble/FacultyBLEModule.ts`)
- BLE Peripheral → Student Devices: broadcasts session (evidence: `README.md`)
- Student Devices → BLE Peripheral: connects locally (evidence: `README.md`)
- OTP Confirmation → BLE Session Logic: generates OTP (evidence: `src/screens/OTPScreen.tsx`)
- BLE Session Logic → Student Devices: requests OTP (evidence: `src/ble/FacultyBLEModule.ts`)
- OTP Confirmation → Attendance Review: finishes session (evidence: `README.md`)
- Attendance Review → Timetable Data: saves attendance (evidence: `src/screens/ResultScreen.tsx`)
- Timetable Data → Supabase: writes attendance (evidence: `src/services/timetableService.ts`)
