# dard1ka/ilegalparkingthesis architecture

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

- Interactive diagram: https://gitdiagram.com/dard1ka/ilegalparkingthesis
- Repository: https://github.com/dard1ka/ilegalparkingthesis

## Overview

This monorepo provides an illegal-parking detection service and a React dashboard. Users select a video or camera, configure parking zones, then monitor a live annotated stream and staged alerts. Backend processing detects and tracks vehicles, applies zone and parking-duration checks, and handles triangle exceptions, color identification, and Indonesian voice alerts. The shared state bridges the processor thread and API. The documented architecture supplies several pipeline details not visible in the sampled code; those edges cite the README.

Main entry points: [`backend/main.py`](https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/main.py) (FastAPI endpoints), [`backend/processor.py`](https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/processor.py) (Video processor), [`parking-dashboard/src/App.jsx`](https://github.com/dard1ka/ilegalparkingthesis/blob/main/parking-dashboard/src/App.jsx) (Dashboard shell), [`parking-dashboard/src/components/SetupWizard.jsx`](https://github.com/dard1ka/ilegalparkingthesis/blob/main/parking-dashboard/src/components/SetupWizard.jsx) (Source and ROI setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Setup and monitoring"]
  node_wizard["Source and ROI setup<br/>[SetupWizard.jsx]"]
  node_monitor["Live video and ROI editor<br/>[VideoMonitor.jsx]"]
  node_app["Dashboard shell<br/>[App.jsx]"]
  node_alerts_hook["Alert WebSocket hook<br/>[useAlerts.js]"]
  node_alert_view["Alert sidebar<br/>[AlertSidebar.jsx]"]
end

subgraph group_api["API and state"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_state["Thread-safe shared state<br/>[shared.py]"]
end

subgraph group_vision["Detection pipeline"]
  node_processor["Video processor<br/>[processor.py]"]
  node_detect["Vehicle detection and tracking<br/>[processor.py]"]
  node_zone["Zone and parking stages<br/>[processor.py]"]
  node_triangle["Triangle exception check<br/>[processor.py]"]
  node_color["Vehicle color classification<br/>[processor.py]"]
end

subgraph group_outputs["Alert outputs"]
  node_speech["Indonesian TTS and playback<br/>[processor.py]"]
end

node_operator(("Operator"))
node_source(("Video or camera"))
node_weights["YOLO model weights<br/>[best.pt]"]
node_triangle_weights["Triangle model weights<br/>[triangle.pt]"]
node_tts_service(("Edge-TTS service"))

node_operator -->|"chooses source"| node_wizard
node_wizard -->|"configures source"| node_api
node_wizard -->|"submits zones"| node_api
node_operator -->|"views stream"| node_monitor
node_app -->|"renders setup"| node_wizard
node_app -->|"renders monitor"| node_monitor
node_app -->|"opens alerts"| node_alerts_hook
node_app -->|"renders alerts"| node_alert_view
node_source -->|"supplies frames"| node_processor
node_api -->|"sets configuration"| node_state
node_api -->|"starts processor"| node_processor
node_processor -->|"reads and updates"| node_state
node_processor -->|"runs detection"| node_detect
node_weights -->|"loads vehicle model"| node_detect
node_detect -->|"filters and tracks"| node_zone
node_zone -->|"checks warning stage"| node_triangle
node_triangle_weights -.->|"loads triangle model"| node_triangle
node_zone -->|"classifies violations"| node_color
node_color -->|"provides vehicle details"| node_speech
node_processor -->|"produces voice alerts"| node_speech
node_speech -->|"generates speech"| node_tts_service
node_state -->|"provides frames and alerts"| node_api
node_api -->|"streams MJPEG"| node_monitor
node_api -->|"pushes WebSocket data"| node_alerts_hook
node_alerts_hook -->|"supplies alerts"| node_alert_view

click node_wizard "https://github.com/dard1ka/ilegalparkingthesis/blob/main/parking-dashboard/src/components/SetupWizard.jsx"
click node_monitor "https://github.com/dard1ka/ilegalparkingthesis/blob/main/parking-dashboard/src/components/VideoMonitor.jsx"
click node_app "https://github.com/dard1ka/ilegalparkingthesis/blob/main/parking-dashboard/src/App.jsx"
click node_alerts_hook "https://github.com/dard1ka/ilegalparkingthesis/blob/main/parking-dashboard/src/hooks/useAlerts.js"
click node_alert_view "https://github.com/dard1ka/ilegalparkingthesis/blob/main/parking-dashboard/src/components/AlertSidebar.jsx"
click node_api "https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/main.py"
click node_state "https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/shared.py"
click node_processor "https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/processor.py"
click node_detect "https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/processor.py"
click node_zone "https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/processor.py"
click node_triangle "https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/processor.py"
click node_color "https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/processor.py"
click node_weights "https://github.com/dard1ka/ilegalparkingthesis/blob/main/best.pt"
click node_triangle_weights "https://github.com/dard1ka/ilegalparkingthesis/blob/main/triangle.pt"
click node_speech "https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/processor.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_wizard,node_monitor,node_app,node_alerts_hook,node_alert_view toneBlue
class node_api,node_state toneAmber
class node_processor,node_detect,node_zone,node_triangle,node_color toneMint
class node_speech toneRose
class node_operator,node_source,node_weights,node_triangle_weights,node_tts_service toneIndigo
```

## Components

### Setup and monitoring

- [Source and ROI setup](https://github.com/dard1ka/ilegalparkingthesis/blob/main/parking-dashboard/src/components/SetupWizard.jsx): `parking-dashboard/src/components/SetupWizard.jsx`
- [Live video and ROI editor](https://github.com/dard1ka/ilegalparkingthesis/blob/main/parking-dashboard/src/components/VideoMonitor.jsx): `parking-dashboard/src/components/VideoMonitor.jsx`
- [Dashboard shell](https://github.com/dard1ka/ilegalparkingthesis/blob/main/parking-dashboard/src/App.jsx): `parking-dashboard/src/App.jsx`
- [Alert WebSocket hook](https://github.com/dard1ka/ilegalparkingthesis/blob/main/parking-dashboard/src/hooks/useAlerts.js): `parking-dashboard/src/hooks/useAlerts.js`
- [Alert sidebar](https://github.com/dard1ka/ilegalparkingthesis/blob/main/parking-dashboard/src/components/AlertSidebar.jsx): `parking-dashboard/src/components/AlertSidebar.jsx`

### API and state

- [FastAPI endpoints](https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/main.py): `backend/main.py`
- [Thread-safe shared state](https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/shared.py): `backend/shared.py`

### Detection pipeline

- [Video processor](https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/processor.py): `backend/processor.py`
- [Vehicle detection and tracking](https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/processor.py): `backend/processor.py`
- [Zone and parking stages](https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/processor.py): `backend/processor.py`
- [Triangle exception check](https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/processor.py): `backend/processor.py`
- [Vehicle color classification](https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/processor.py): `backend/processor.py`

### Alert outputs

- [Indonesian TTS and playback](https://github.com/dard1ka/ilegalparkingthesis/blob/main/backend/processor.py): `backend/processor.py`

### Other components

- **Operator**
- **Video or camera**
- [YOLO model weights](https://github.com/dard1ka/ilegalparkingthesis/blob/main/best.pt): `best.pt`
- [Triangle model weights](https://github.com/dard1ka/ilegalparkingthesis/blob/main/triangle.pt): `triangle.pt`
- **Edge-TTS service**

## Connections

- Operator → Source and ROI setup: chooses source (evidence: `README.md`)
- Source and ROI setup → FastAPI endpoints: configures source (evidence: `parking-dashboard/src/components/SetupWizard.jsx`)
- Source and ROI setup → FastAPI endpoints: submits zones (evidence: `README.md`)
- Operator → Live video and ROI editor: views stream (evidence: `README.md`)
- Dashboard shell → Source and ROI setup: renders setup (evidence: `parking-dashboard/src/App.jsx`)
- Dashboard shell → Live video and ROI editor: renders monitor (evidence: `parking-dashboard/src/App.jsx`)
- Dashboard shell → Alert WebSocket hook: opens alerts (evidence: `parking-dashboard/src/App.jsx`)
- Dashboard shell → Alert sidebar: renders alerts (evidence: `parking-dashboard/src/App.jsx`)
- Video or camera → Video processor: supplies frames (evidence: `README.md`)
- FastAPI endpoints → Thread-safe shared state: sets configuration (evidence: `backend/main.py`)
- FastAPI endpoints → Video processor: starts processor (evidence: `backend/main.py`)
- Video processor → Thread-safe shared state: reads and updates (evidence: `README.md`)
- Video processor → Vehicle detection and tracking: runs detection (evidence: `README.md`)
- YOLO model weights → Vehicle detection and tracking: loads vehicle model (evidence: `backend/processor.py`)
- Vehicle detection and tracking → Zone and parking stages: filters and tracks (evidence: `README.md`)
- Zone and parking stages → Triangle exception check: checks warning stage (evidence: `README.md`)
- Triangle model weights → Triangle exception check: loads triangle model (evidence: `README.md`)
- Zone and parking stages → Vehicle color classification: classifies violations (evidence: `README.md`)
- Vehicle color classification → Indonesian TTS and playback: provides vehicle details (evidence: `README.md`)
- Video processor → Indonesian TTS and playback: produces voice alerts (evidence: `README.md`)
- Indonesian TTS and playback → Edge-TTS service: generates speech (evidence: `README.md`)
- Thread-safe shared state → FastAPI endpoints: provides frames and alerts (evidence: `backend/main.py`)
- FastAPI endpoints → Live video and ROI editor: streams MJPEG (evidence: `README.md`)
- FastAPI endpoints → Alert WebSocket hook: pushes WebSocket data (evidence: `README.md`)
- Alert WebSocket hook → Alert sidebar: supplies alerts (evidence: `parking-dashboard/src/App.jsx`)
