# prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8 architecture

> Architecture diagram of the GitHub repository prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8
- Repository: https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8

## Overview

This is a desktop-to-server weapon-surveillance application. A user logs in, supplies a location and alert recipient, then starts webcam monitoring; the client runs YOLOv8 detection, displays annotated frames, plays an alarm, and posts captured detections to Django. The backend accepts uploads, stores alert records, dispatches email or SMS notifications, and serves filtered dashboard and alert-history views. The principal client and server calls are excerpted; broader notification and dashboard capabilities are also documented in the README.

Main entry points: [`Server_Side/detection/views.py`](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/detection/views.py) (Account and dashboard views), [`Client_Side/detection.py`](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Client_Side/detection.py) (Camera detector), [`Client_Side/login_window.py`](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Client_Side/login_window.py) (Desktop login), [`Server_Side/alertupload_rest/views.py`](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/alertupload_rest/views.py) (Alert upload)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Desktop client"]
  node_login["Desktop login<br/>[login_window.py]"]
  node_settings["Monitoring settings<br/>[settings_window.py]"]
  node_detection_window["Detection display"]
  node_detector["Camera detector<br/>[detection.py]"]
end

subgraph group_api["Upload and alerts"]
  node_api_routes["REST endpoints<br/>[urls.py]"]
  node_upload_view["Alert upload<br/>[views.py]"]
  node_serializer["Upload serializer<br/>[serializers.py]"]
  node_alert_model[("Detection records<br/>[models.py]")]
  node_notifications["Email and SMS<br/>[views.py]"]
end

subgraph group_web["Accounts and history"]
  node_web_views["Account and dashboard views<br/>[views.py]"]
  node_forms["Registration form<br/>[forms.py]"]
  node_filters["History filters<br/>[filters.py]"]
  node_web_pages["Web pages"]
end

node_user(("Operator"))
node_webcam(("Webcam"))
node_notification_services["Email / SMS providers"]

node_user -->|"opens"| node_login
node_login -->|"requests token"| node_api_routes
node_login -->|"opens settings"| node_settings
node_user -.->|"sets monitoring"| node_settings
node_settings -->|"starts detector"| node_detection_window
node_detection_window -->|"creates and starts"| node_detector
node_webcam -->|"provides frames"| node_detector
node_detector -->|"emits frames"| node_detection_window
node_detector -->|"posts capture"| node_api_routes
node_api_routes -->|"routes upload"| node_upload_view
node_upload_view -->|"validates and saves"| node_serializer
node_serializer -->|"serializes records"| node_alert_model
node_upload_view -->|"dispatches alert"| node_notifications
node_notifications -->|"sends email or SMS"| node_notification_services
node_user -.->|"uses dashboard"| node_web_views
node_web_views -->|"uses registration form"| node_forms
node_web_views -->|"filters records"| node_filters
node_web_views -->|"queries records"| node_alert_model
node_web_views -.->|"renders pages"| node_web_pages

click node_login "https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Client_Side/login_window.py"
click node_settings "https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Client_Side/settings_window.py"
click node_detection_window "https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Client_Side/detection_window.py"
click node_detector "https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Client_Side/detection.py"
click node_api_routes "https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/alertupload_rest/urls.py"
click node_upload_view "https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/alertupload_rest/views.py"
click node_serializer "https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/alertupload_rest/serializers.py"
click node_alert_model "https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/detection/models.py"
click node_notifications "https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/alertupload_rest/views.py"
click node_web_views "https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/detection/views.py"
click node_forms "https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/detection/forms.py"
click node_filters "https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/detection/filters.py"
click node_web_pages "https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/tree/main/Server_Side/detection/templates/detection"

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_login,node_settings,node_detection_window,node_detector toneBlue
class node_api_routes,node_upload_view,node_serializer,node_alert_model,node_notifications toneAmber
class node_web_views,node_forms,node_filters,node_web_pages toneMint
class node_user,node_webcam,node_notification_services toneIndigo
```

## Components

### Desktop client

- [Desktop login](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Client_Side/login_window.py): `Client_Side/login_window.py`
- [Monitoring settings](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Client_Side/settings_window.py): `Client_Side/settings_window.py`
- [Detection display](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Client_Side/detection_window.py): `Client_Side/detection_window.py`
- [Camera detector](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Client_Side/detection.py): `Client_Side/detection.py`

### Upload and alerts

- [REST endpoints](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/alertupload_rest/urls.py): `Server_Side/alertupload_rest/urls.py`
- [Alert upload](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/alertupload_rest/views.py): `Server_Side/alertupload_rest/views.py`
- [Upload serializer](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/alertupload_rest/serializers.py): `Server_Side/alertupload_rest/serializers.py`
- [Detection records](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/detection/models.py): `Server_Side/detection/models.py`
- [Email and SMS](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/alertupload_rest/views.py): `Server_Side/alertupload_rest/views.py`

### Accounts and history

- [Account and dashboard views](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/detection/views.py): `Server_Side/detection/views.py`
- [Registration form](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/detection/forms.py): `Server_Side/detection/forms.py`
- [History filters](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/blob/main/Server_Side/detection/filters.py): `Server_Side/detection/filters.py`
- [Web pages](https://github.com/prince-of-morocco/ai-driven-smart-surveillance-for-weapon-detection-using-yolov8/tree/main/Server_Side/detection/templates/detection): `Server_Side/detection/templates/detection`

### Other components

- **Operator**
- **Webcam**
- **Email / SMS providers**

## Connections

- Operator → Desktop login: opens
- Desktop login → REST endpoints: requests token (evidence: `Client_Side/login_window.py`)
- Desktop login → Monitoring settings: opens settings (evidence: `Client_Side/login_window.py`)
- Operator → Monitoring settings: sets monitoring (evidence: `README.md`)
- Monitoring settings → Detection display: starts detector (evidence: `Client_Side/settings_window.py`)
- Detection display → Camera detector: creates and starts (evidence: `Client_Side/detection_window.py`)
- Webcam → Camera detector: provides frames (evidence: `Client_Side/detection.py`)
- Camera detector → Detection display: emits frames (evidence: `Client_Side/detection_window.py`)
- Camera detector → REST endpoints: posts capture (evidence: `Client_Side/detection.py`)
- REST endpoints → Alert upload: routes upload (evidence: `Server_Side/alertupload_rest/urls.py`)
- Alert upload → Upload serializer: validates and saves (evidence: `Server_Side/alertupload_rest/views.py`)
- Upload serializer → Detection records: serializes records (evidence: `Server_Side/alertupload_rest/serializers.py`)
- Alert upload → Email and SMS: dispatches alert (evidence: `Server_Side/alertupload_rest/views.py`)
- Email and SMS → Email / SMS providers: sends email or SMS (evidence: `Server_Side/alertupload_rest/views.py`)
- Operator → Account and dashboard views: uses dashboard (evidence: `README.md`)
- Account and dashboard views → Registration form: uses registration form (evidence: `Server_Side/detection/views.py`)
- Account and dashboard views → History filters: filters records (evidence: `Server_Side/detection/views.py`)
- Account and dashboard views → Detection records: queries records (evidence: `Server_Side/detection/views.py`)
- Account and dashboard views → Web pages: renders pages (evidence: `README.md`)
