# sam798-del/cybershield-ai-final- architecture

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

- Interactive diagram: https://gitdiagram.com/sam798-del/cybershield-ai-final-
- Repository: https://github.com/sam798-del/cybershield-ai-final-

## Overview

CyberShield AI combines account security and digital identity management with detection, guidance, and security-analysis features. Users interact through the web platform or browser extension; the backend routes requests to authentication, identity, profile, and detection capabilities, with SQLite-backed account state. The README documents the product workflows and capabilities, while some frontend and integration wiring is not visible in the sampled source. Dashed edges mark those unverified or optional connections rather than asserting implementation details.

Main entry points: [`app.py`](https://github.com/sam798-del/cybershield-ai-final-/blob/main/app.py) (Flask app), [`db.py`](https://github.com/sam798-del/cybershield-ai-final-/blob/main/db.py) (SQLite state), [`routes_auth.py`](https://github.com/sam798-del/cybershield-ai-final-/blob/main/routes_auth.py) (Authentication routes), [`routes_profile.py`](https://github.com/sam798-del/cybershield-ai-final-/blob/main/routes_profile.py) (Profile routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User clients"]
  node_web["Web platform"]
  node_browser_extension["Browser extension"]
  node_desktop_app["Desktop launcher<br/>[main.py]"]
end

subgraph group_backend["API backend"]
  node_app["Flask app<br/>[app.py]"]
  node_database[("SQLite state<br/>[db.py]")]
  node_response_helpers["API responses<br/>[responses.py]"]
end

subgraph group_identity["Identity and account security"]
  node_auth_routes["Authentication routes<br/>[routes_auth.py]"]
  node_identity_routes["Identity routes<br/>[routes_identity.py]"]
  node_profile_routes["Profile routes<br/>[routes_profile.py]"]
  node_security["Security services<br/>[security.py]"]
  node_document_checks["Document checks<br/>[identity_docs.py]"]
  node_settings_trust["Settings and trust<br/>[services.py]"]
end

subgraph group_protection["Detection and guidance"]
  node_module_routes["Detection and guidance API<br/>[routes_modules.py]"]
  node_phishing["Phishing detection<br/>[phishing_engine.py]"]
  node_toxicity["Cyberbullying detection<br/>[toxicity_engine.py]"]
  node_analyzer["Security analyzer<br/>[app.py]"]
end

node_user(("User"))

node_user -.->|"uses"| node_web
node_web -.->|"requests API"| node_app
node_user -.->|"uses"| node_browser_extension
node_browser_extension -.->|"gets login token"| node_auth_routes
node_browser_extension -.->|"gets config"| node_profile_routes
node_desktop_app -->|"starts server"| node_app
node_app -->|"initializes"| node_database
node_app -->|"registers"| node_auth_routes
node_app -->|"registers"| node_identity_routes
node_app -->|"registers"| node_profile_routes
node_app -->|"registers"| node_module_routes
node_auth_routes -->|"uses"| node_security
node_auth_routes -->|"reads and writes"| node_database
node_auth_routes -->|"formats responses"| node_response_helpers
node_identity_routes -->|"validates documents"| node_document_checks
node_identity_routes -->|"computes trust"| node_settings_trust
node_identity_routes -->|"reads and writes"| node_database
node_profile_routes -->|"loads settings"| node_settings_trust
node_profile_routes -->|"reads and writes"| node_database
node_profile_routes -->|"uses"| node_security
node_module_routes -->|"calls"| node_phishing
node_module_routes -->|"calls"| node_toxicity
node_module_routes -.->|"dispatches to"| node_analyzer
node_settings_trust -->|"reads and writes"| node_database
node_security -->|"stores sessions"| node_database

click node_web "https://github.com/sam798-del/cybershield-ai-final-/tree/main/frontend"
click node_browser_extension "https://github.com/sam798-del/cybershield-ai-final-/tree/main/extension"
click node_desktop_app "https://github.com/sam798-del/cybershield-ai-final-/blob/main/desktop/main.py"
click node_app "https://github.com/sam798-del/cybershield-ai-final-/blob/main/app.py"
click node_auth_routes "https://github.com/sam798-del/cybershield-ai-final-/blob/main/routes_auth.py"
click node_identity_routes "https://github.com/sam798-del/cybershield-ai-final-/blob/main/routes_identity.py"
click node_profile_routes "https://github.com/sam798-del/cybershield-ai-final-/blob/main/routes_profile.py"
click node_security "https://github.com/sam798-del/cybershield-ai-final-/blob/main/security.py"
click node_document_checks "https://github.com/sam798-del/cybershield-ai-final-/blob/main/identity_docs.py"
click node_settings_trust "https://github.com/sam798-del/cybershield-ai-final-/blob/main/services.py"
click node_database "https://github.com/sam798-del/cybershield-ai-final-/blob/main/db.py"
click node_response_helpers "https://github.com/sam798-del/cybershield-ai-final-/blob/main/responses.py"
click node_module_routes "https://github.com/sam798-del/cybershield-ai-final-/blob/main/routes_modules.py"
click node_phishing "https://github.com/sam798-del/cybershield-ai-final-/blob/main/modules/phishing_engine.py"
click node_toxicity "https://github.com/sam798-del/cybershield-ai-final-/blob/main/modules/toxicity_engine.py"
click node_analyzer "https://github.com/sam798-del/cybershield-ai-final-/blob/main/security-analyzer/app.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_web,node_browser_extension,node_desktop_app,node_user toneBlue
class node_app,node_database,node_response_helpers toneAmber
class node_auth_routes,node_identity_routes,node_profile_routes,node_security,node_document_checks,node_settings_trust toneMint
class node_module_routes,node_phishing,node_toxicity,node_analyzer toneRose
```

## Components

### User clients

- [Web platform](https://github.com/sam798-del/cybershield-ai-final-/tree/main/frontend): `frontend`
- [Browser extension](https://github.com/sam798-del/cybershield-ai-final-/tree/main/extension): `extension`
- [Desktop launcher](https://github.com/sam798-del/cybershield-ai-final-/blob/main/desktop/main.py): `desktop/main.py`

### API backend

- [Flask app](https://github.com/sam798-del/cybershield-ai-final-/blob/main/app.py): `app.py`
- [SQLite state](https://github.com/sam798-del/cybershield-ai-final-/blob/main/db.py): `db.py`
- [API responses](https://github.com/sam798-del/cybershield-ai-final-/blob/main/responses.py): `responses.py`

### Identity and account security

- [Authentication routes](https://github.com/sam798-del/cybershield-ai-final-/blob/main/routes_auth.py): `routes_auth.py`
- [Identity routes](https://github.com/sam798-del/cybershield-ai-final-/blob/main/routes_identity.py): `routes_identity.py`
- [Profile routes](https://github.com/sam798-del/cybershield-ai-final-/blob/main/routes_profile.py): `routes_profile.py`
- [Security services](https://github.com/sam798-del/cybershield-ai-final-/blob/main/security.py): `security.py`
- [Document checks](https://github.com/sam798-del/cybershield-ai-final-/blob/main/identity_docs.py): `identity_docs.py`
- [Settings and trust](https://github.com/sam798-del/cybershield-ai-final-/blob/main/services.py): `services.py`

### Detection and guidance

- [Detection and guidance API](https://github.com/sam798-del/cybershield-ai-final-/blob/main/routes_modules.py): `routes_modules.py`
- [Phishing detection](https://github.com/sam798-del/cybershield-ai-final-/blob/main/modules/phishing_engine.py): `modules/phishing_engine.py`
- [Cyberbullying detection](https://github.com/sam798-del/cybershield-ai-final-/blob/main/modules/toxicity_engine.py): `modules/toxicity_engine.py`
- [Security analyzer](https://github.com/sam798-del/cybershield-ai-final-/blob/main/security-analyzer/app.py): `security-analyzer/app.py`

### Other components

- **User**

## Connections

- User → Web platform: uses (evidence: `README.md`)
- Web platform → Flask app: requests API
- User → Browser extension: uses (evidence: `README.md`)
- Browser extension → Authentication routes: gets login token (evidence: `README.md`)
- Browser extension → Profile routes: gets config (evidence: `README.md`)
- Desktop launcher → Flask app: starts server (evidence: `desktop/main.py`)
- Flask app → SQLite state: initializes (evidence: `app.py`)
- Flask app → Authentication routes: registers (evidence: `app.py`)
- Flask app → Identity routes: registers (evidence: `app.py`)
- Flask app → Profile routes: registers (evidence: `app.py`)
- Flask app → Detection and guidance API: registers (evidence: `app.py`)
- Authentication routes → Security services: uses (evidence: `routes_auth.py`)
- Authentication routes → SQLite state: reads and writes (evidence: `routes_auth.py`)
- Authentication routes → API responses: formats responses (evidence: `routes_auth.py`)
- Identity routes → Document checks: validates documents (evidence: `routes_identity.py`)
- Identity routes → Settings and trust: computes trust (evidence: `routes_identity.py`)
- Identity routes → SQLite state: reads and writes (evidence: `routes_identity.py`)
- Profile routes → Settings and trust: loads settings (evidence: `routes_profile.py`)
- Profile routes → SQLite state: reads and writes (evidence: `routes_profile.py`)
- Profile routes → Security services: uses (evidence: `routes_profile.py`)
- Detection and guidance API → Phishing detection: calls (evidence: `routes_modules.py`)
- Detection and guidance API → Cyberbullying detection: calls (evidence: `routes_modules.py`)
- Detection and guidance API → Security analyzer: dispatches to
- Settings and trust → SQLite state: reads and writes (evidence: `services.py`)
- Security services → SQLite state: stores sessions (evidence: `security.py`)
