# agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi architecture

> Architecture diagram of the GitHub repository agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi
- Repository: https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi

## Overview

This is a driver-drowsiness monitoring application: a signed-in user starts live monitoring, browser camera frames are sent to the API for AI classification, and the UI presents status/alerts and monitoring history. The frontend also supports registration, login, profile management, trip records, and dashboard summaries. Source excerpts establish the main API, inference, persistence, and dashboard interactions; some frontend routes and backend endpoints are only partially sampled, so those relationships are omitted where not evidenced.

Main entry points: [`backend/main.py`](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/backend/main.py) (FastAPI Service), [`frontend/drowsiness-app/src/App.jsx`](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/App.jsx) (App Router), [`frontend/drowsiness-app/src/pages/DashboardPage.jsx`](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/pages/DashboardPage.jsx) (Dashboard), [`frontend/drowsiness-app/src/pages/ProfilePage.jsx`](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/pages/ProfilePage.jsx) (Profile Page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_app["App Router<br/>[App.jsx]"]
  node_camera["Camera Capture<br/>[CameraSection.jsx]"]
  node_live["Live Detection"]
  node_dashboard["Dashboard<br/>[DashboardPage.jsx]"]
  node_charts["History Charts<br/>[ChartSection.jsx]"]
  node_history["History Page<br/>[HistoryPage.jsx]"]
  node_profile["Profile Page<br/>[ProfilePage.jsx]"]
end

subgraph group_identity["Identity"]
  node_authui["Login and Register<br/>[LoginPage.jsx]"]
  node_authutil["Token Storage<br/>[auth.js]"]
  node_jwt["JWT Checks<br/>[jwt.py]"]
end

subgraph group_detection["Detection"]
  node_api["FastAPI Service<br/>[main.py]"]
  node_inference["Drowsiness Inference<br/>[ai.py]"]
end

subgraph group_records["Monitoring Records"]
  node_models["Data Models<br/>[models.py]"]
  node_database[("Database Sessions<br/>[database.py]")]
  node_schemas["API Schemas<br/>[schemas.py]"]
end

node_driver(("Driver"))

node_driver -->|"uses"| node_app
node_app -->|"routes to"| node_live
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_authui
node_app -->|"routes to"| node_profile
node_live -->|"renders"| node_camera
node_dashboard -->|"renders"| node_charts
node_app -->|"posts frames"| node_api
node_api -->|"calls"| node_inference
node_api -->|"queries and writes"| node_database
node_api -->|"checks login"| node_jwt
node_api -->|"uses models"| node_models
node_api -->|"uses schemas"| node_schemas
node_charts -->|"fetches history"| node_api
node_dashboard -->|"updates summary"| node_api
node_profile -->|"fetches profile"| node_api
node_authui -->|"uses token helper"| node_authutil
node_profile -->|"reads token"| node_authutil
node_models -->|"uses database base"| node_database

click node_app "https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/App.jsx"
click node_camera "https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/components/CameraSection.jsx"
click node_live "https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/pages/LiveDetectionPage.jsx"
click node_dashboard "https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/pages/DashboardPage.jsx"
click node_charts "https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/components/ChartSection.jsx"
click node_history "https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/pages/HistoryPage.jsx"
click node_profile "https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/pages/ProfilePage.jsx"
click node_authui "https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/pages/LoginPage.jsx"
click node_authutil "https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/utils/auth.js"
click node_api "https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/backend/main.py"
click node_inference "https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/backend/ai.py"
click node_jwt "https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/backend/jwt.py"
click node_models "https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/backend/models.py"
click node_database "https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/backend/database.py"
click node_schemas "https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/backend/schemas.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_app,node_camera,node_live,node_dashboard,node_charts,node_history,node_profile toneBlue
class node_authui,node_authutil,node_jwt toneAmber
class node_api,node_inference toneMint
class node_models,node_database,node_schemas toneRose
class node_driver toneIndigo
```

## Components

### Frontend

- [App Router](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/App.jsx): `frontend/drowsiness-app/src/App.jsx`
- [Camera Capture](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/components/CameraSection.jsx): `frontend/drowsiness-app/src/components/CameraSection.jsx`
- [Live Detection](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/pages/LiveDetectionPage.jsx): `frontend/drowsiness-app/src/pages/LiveDetectionPage.jsx`
- [Dashboard](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/pages/DashboardPage.jsx): `frontend/drowsiness-app/src/pages/DashboardPage.jsx`
- [History Charts](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/components/ChartSection.jsx): `frontend/drowsiness-app/src/components/ChartSection.jsx`
- [History Page](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/pages/HistoryPage.jsx): `frontend/drowsiness-app/src/pages/HistoryPage.jsx`
- [Profile Page](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/pages/ProfilePage.jsx): `frontend/drowsiness-app/src/pages/ProfilePage.jsx`

### Identity

- [Login and Register](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/pages/LoginPage.jsx): `frontend/drowsiness-app/src/pages/LoginPage.jsx`
- [Token Storage](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/frontend/drowsiness-app/src/utils/auth.js): `frontend/drowsiness-app/src/utils/auth.js`
- [JWT Checks](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/backend/jwt.py): `backend/jwt.py`

### Detection

- [FastAPI Service](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/backend/main.py): `backend/main.py`
- [Drowsiness Inference](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/backend/ai.py): `backend/ai.py`

### Monitoring Records

- [Data Models](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/backend/models.py): `backend/models.py`
- [Database Sessions](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/backend/database.py): `backend/database.py`
- [API Schemas](https://github.com/agnesvika162-star/kemudi-sistem-pemantauan-kantuk-pengemudi/blob/main/backend/schemas.py): `backend/schemas.py`

### Other components

- **Driver**

## Connections

- Driver → App Router: uses
- App Router → Live Detection: routes to (evidence: `frontend/drowsiness-app/src/App.jsx`)
- App Router → Dashboard: routes to (evidence: `frontend/drowsiness-app/src/App.jsx`)
- App Router → Login and Register: routes to (evidence: `frontend/drowsiness-app/src/App.jsx`)
- App Router → Profile Page: routes to (evidence: `frontend/drowsiness-app/src/App.jsx`)
- Live Detection → Camera Capture: renders (evidence: `frontend/drowsiness-app/src/pages/LiveDetectionPage.jsx`)
- Dashboard → History Charts: renders (evidence: `frontend/drowsiness-app/src/pages/DashboardPage.jsx`)
- App Router → FastAPI Service: posts frames (evidence: `frontend/drowsiness-app/src/App.jsx`)
- FastAPI Service → Drowsiness Inference: calls (evidence: `backend/main.py`)
- FastAPI Service → Database Sessions: queries and writes (evidence: `backend/main.py`)
- FastAPI Service → JWT Checks: checks login (evidence: `backend/main.py`)
- FastAPI Service → Data Models: uses models (evidence: `backend/main.py`)
- FastAPI Service → API Schemas: uses schemas (evidence: `backend/main.py`)
- History Charts → FastAPI Service: fetches history (evidence: `frontend/drowsiness-app/src/components/ChartSection.jsx`)
- Dashboard → FastAPI Service: updates summary (evidence: `frontend/drowsiness-app/src/pages/DashboardPage.jsx`)
- Profile Page → FastAPI Service: fetches profile (evidence: `frontend/drowsiness-app/src/pages/ProfilePage.jsx`)
- Login and Register → Token Storage: uses token helper (evidence: `frontend/drowsiness-app/src/pages/LoginPage.jsx`)
- Profile Page → Token Storage: reads token (evidence: `frontend/drowsiness-app/src/pages/ProfilePage.jsx`)
- Data Models → Database Sessions: uses database base (evidence: `backend/models.py`)
