# sam798-del/cybershield-ai architecture

> Architecture diagram of the GitHub repository sam798-del/cybershield-ai, 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/sam798-del/cybershield-ai
- Repository: https://github.com/sam798-del/cybershield-ai

## Overview

CyberShield AI combines a web security workspace, browser extension, and standalone password/email/domain analyzer. Users navigate the workspace to identity, phishing, cyberbullying, and security-report capabilities; the extension offers in-browser scanning and telemetry, while the analyzer provides password and breach checks. The sampled sources show shared browser state and analyzer integrations, but not the frontend API wiring or most backend routes, so those connections are omitted rather than inferred.

Main entry points: [`security-analyzer/app.py`](https://github.com/sam798-del/cybershield-ai/blob/main/security-analyzer/app.py) (Analyzer Service), [`frontend/js/navigation.js`](https://github.com/sam798-del/cybershield-ai/blob/main/frontend/js/navigation.js) (Navigation Shell), [`extension/popup/popup.js`](https://github.com/sam798-del/cybershield-ai/blob/main/extension/popup/popup.js) (Extension Popup), [`frontend/js/app.js`](https://github.com/sam798-del/cybershield-ai/blob/main/frontend/js/app.js) (Workspace Bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Web Workspace"]
  node_webapp["Workspace Bootstrap<br/>[app.js]"]
  node_navigation["Navigation Shell<br/>[navigation.js]"]
  node_workspace_pages["Workspace Pages"]
  node_shared_state["Shared Client State<br/>[state.js]"]
  node_feature_tour["Feature Tour<br/>[tour.js]"]
  node_api_client["API Client<br/>[api.js]"]
  node_desktop_launcher["Desktop Launcher<br/>[main.py]"]
end

subgraph group_detection["Threat Detection"]
  node_phishing_engine["Phishing Detection<br/>[phishing_engine.py]"]
  node_toxicity_engine["Cyberbullying Detection<br/>[toxicity_engine.py]"]
end

subgraph group_extension["Browser Extension"]
  node_extension_popup["Extension Popup<br/>[popup.js]"]
  node_extension_background["Background Service<br/>[background.js]"]
  node_extension_content["Page Content Defense<br/>[content.js]"]
end

subgraph group_analyzer["Security Analyzer"]
  node_analyzer_service["Analyzer Service<br/>[app.py]"]
  node_scan_log[("Scan Log<br/>[app.py]")]
end

node_user(("User"))
node_browser(("Browser"))
node_pwned_passwords["Pwned Passwords"]
node_breach_lookup["XposedOrNot"]

node_user -->|"opens"| node_webapp
node_webapp -->|"initializes"| node_navigation
node_navigation -->|"links to"| node_workspace_pages
node_navigation -->|"reads"| node_shared_state
node_navigation -->|"launches"| node_feature_tour
node_shared_state -->|"shares telemetry"| node_extension_popup
node_user -->|"opens"| node_extension_popup
node_extension_popup -->|"queries tabs"| node_browser
node_extension_popup -.->|"requests scans"| node_analyzer_service
node_extension_background -.->|"runs in"| node_browser
node_extension_content -.->|"inspects pages"| node_browser
node_user -.->|"submits scans"| node_analyzer_service
node_analyzer_service -->|"writes records"| node_scan_log
node_analyzer_service -->|"checks hashes"| node_pwned_passwords
node_analyzer_service -->|"checks exposure"| node_breach_lookup
node_user -->|"launches"| node_desktop_launcher
node_desktop_launcher -->|"opens guide"| node_workspace_pages

click node_webapp "https://github.com/sam798-del/cybershield-ai/blob/main/frontend/js/app.js"
click node_navigation "https://github.com/sam798-del/cybershield-ai/blob/main/frontend/js/navigation.js"
click node_workspace_pages "https://github.com/sam798-del/cybershield-ai/tree/main/frontend/pages"
click node_shared_state "https://github.com/sam798-del/cybershield-ai/blob/main/frontend/js/state.js"
click node_feature_tour "https://github.com/sam798-del/cybershield-ai/blob/main/frontend/js/tour.js"
click node_api_client "https://github.com/sam798-del/cybershield-ai/blob/main/frontend/js/api.js"
click node_phishing_engine "https://github.com/sam798-del/cybershield-ai/blob/main/modules/phishing_engine.py"
click node_toxicity_engine "https://github.com/sam798-del/cybershield-ai/blob/main/modules/toxicity_engine.py"
click node_extension_popup "https://github.com/sam798-del/cybershield-ai/blob/main/extension/popup/popup.js"
click node_extension_background "https://github.com/sam798-del/cybershield-ai/blob/main/extension/scripts/background.js"
click node_extension_content "https://github.com/sam798-del/cybershield-ai/blob/main/extension/scripts/content.js"
click node_analyzer_service "https://github.com/sam798-del/cybershield-ai/blob/main/security-analyzer/app.py"
click node_scan_log "https://github.com/sam798-del/cybershield-ai/blob/main/security-analyzer/app.py"
click node_desktop_launcher "https://github.com/sam798-del/cybershield-ai/blob/main/desktop/main.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_webapp,node_navigation,node_workspace_pages,node_shared_state,node_feature_tour,node_api_client,node_desktop_launcher,node_user,node_browser toneBlue
class node_phishing_engine,node_toxicity_engine toneAmber
class node_extension_popup,node_extension_background,node_extension_content toneMint
class node_analyzer_service,node_scan_log toneRose
class node_pwned_passwords,node_breach_lookup toneIndigo
```

## Components

### Web Workspace

- [Workspace Bootstrap](https://github.com/sam798-del/cybershield-ai/blob/main/frontend/js/app.js): `frontend/js/app.js`
- [Navigation Shell](https://github.com/sam798-del/cybershield-ai/blob/main/frontend/js/navigation.js): `frontend/js/navigation.js`
- [Workspace Pages](https://github.com/sam798-del/cybershield-ai/tree/main/frontend/pages): `frontend/pages`
- [Shared Client State](https://github.com/sam798-del/cybershield-ai/blob/main/frontend/js/state.js): `frontend/js/state.js`
- [Feature Tour](https://github.com/sam798-del/cybershield-ai/blob/main/frontend/js/tour.js): `frontend/js/tour.js`
- [API Client](https://github.com/sam798-del/cybershield-ai/blob/main/frontend/js/api.js): `frontend/js/api.js`
- [Desktop Launcher](https://github.com/sam798-del/cybershield-ai/blob/main/desktop/main.py): `desktop/main.py`

### Threat Detection

- [Phishing Detection](https://github.com/sam798-del/cybershield-ai/blob/main/modules/phishing_engine.py): `modules/phishing_engine.py`
- [Cyberbullying Detection](https://github.com/sam798-del/cybershield-ai/blob/main/modules/toxicity_engine.py): `modules/toxicity_engine.py`

### Browser Extension

- [Extension Popup](https://github.com/sam798-del/cybershield-ai/blob/main/extension/popup/popup.js): `extension/popup/popup.js`
- [Background Service](https://github.com/sam798-del/cybershield-ai/blob/main/extension/scripts/background.js): `extension/scripts/background.js`
- [Page Content Defense](https://github.com/sam798-del/cybershield-ai/blob/main/extension/scripts/content.js): `extension/scripts/content.js`

### Security Analyzer

- [Analyzer Service](https://github.com/sam798-del/cybershield-ai/blob/main/security-analyzer/app.py): `security-analyzer/app.py`
- [Scan Log](https://github.com/sam798-del/cybershield-ai/blob/main/security-analyzer/app.py): `security-analyzer/app.py`

### Other components

- **User**
- **Browser**
- **Pwned Passwords**
- **XposedOrNot**

## Connections

- User → Workspace Bootstrap: opens (evidence: `frontend/js/app.js`)
- Workspace Bootstrap → Navigation Shell: initializes (evidence: `frontend/js/app.js`)
- Navigation Shell → Workspace Pages: links to (evidence: `frontend/js/navigation.js`)
- Navigation Shell → Shared Client State: reads (evidence: `frontend/js/navigation.js`)
- Navigation Shell → Feature Tour: launches (evidence: `frontend/js/navigation.js`)
- Shared Client State → Extension Popup: shares telemetry (evidence: `extension/popup/popup.js`)
- User → Extension Popup: opens (evidence: `extension/popup/popup.js`)
- Extension Popup → Browser: queries tabs (evidence: `extension/popup/popup.js`)
- Extension Popup → Analyzer Service: requests scans
- Background Service → Browser: runs in
- Page Content Defense → Browser: inspects pages
- User → Analyzer Service: submits scans
- Analyzer Service → Scan Log: writes records (evidence: `security-analyzer/app.py`)
- Analyzer Service → Pwned Passwords: checks hashes (evidence: `security-analyzer/app.py`)
- Analyzer Service → XposedOrNot: checks exposure (evidence: `security-analyzer/app.py`)
- User → Desktop Launcher: launches (evidence: `desktop/main.py`)
- Desktop Launcher → Workspace Pages: opens guide (evidence: `desktop/main.py`)
