# naina-r/safespaceshield architecture

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

- Interactive diagram: https://gitdiagram.com/naina-r/safespaceshield
- Repository: https://github.com/naina-r/safespaceshield

## Overview

SafeSpace Shield is a local Streamlit phishing-awareness app. A user enters a message or selects a demonstration sample, submits it for analysis, and receives a risk assessment, detected indicators, explanations, and safety guidance. The app invokes separate analyzer functions for keyword detection, URL-pattern detection, IP-based URL detection, risk scoring, and explanations. The README documents the broader capabilities; analyzer.py was not excerpted, so its internal implementation and any finer-grained dependencies are not shown.

Main entry points: [`app.py`](https://github.com/naina-r/safespaceshield/blob/master/app.py) (Analysis orchestration), [`analyzer.py`](https://github.com/naina-r/safespaceshield/blob/master/analyzer.py) (Keyword detection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_message_ui["Message entry<br/>[app.py]"]
  node_sample_picker["Sample selector<br/>[app.py]"]
  node_analysis_flow["Analysis orchestration<br/>[app.py]"]
end

subgraph group_analysis["Message analysis"]
  node_keyword_detection["Keyword detection<br/>[analyzer.py]"]
  node_url_detection["URL pattern detection<br/>[analyzer.py]"]
  node_ip_detection["IP URL detection<br/>[analyzer.py]"]
  node_risk_scoring["Risk scoring<br/>[analyzer.py]"]
  node_explanations["Explanations and guidance<br/>[analyzer.py]"]
end

subgraph group_results["Assessment results"]
  node_report["Analysis report<br/>[app.py]"]
end

node_user(("User"))

node_user -->|"enters message"| node_message_ui
node_user -->|"selects sample"| node_sample_picker
node_sample_picker -->|"loads sample"| node_message_ui
node_message_ui -->|"submits message"| node_analysis_flow
node_analysis_flow -->|"detects keywords"| node_keyword_detection
node_analysis_flow -->|"detects URL patterns"| node_url_detection
node_analysis_flow -->|"detects IP URLs"| node_ip_detection
node_analysis_flow -->|"calculates risk"| node_risk_scoring
node_analysis_flow -->|"generates explanation"| node_explanations
node_analysis_flow -->|"renders results"| node_report
node_keyword_detection -->|"displays detections"| node_report
node_url_detection -->|"displays detections"| node_report
node_ip_detection -->|"displays detections"| node_report
node_risk_scoring -->|"displays assessment"| node_report
node_explanations -->|"displays guidance"| node_report

click node_message_ui "https://github.com/naina-r/safespaceshield/blob/master/app.py"
click node_sample_picker "https://github.com/naina-r/safespaceshield/blob/master/app.py"
click node_analysis_flow "https://github.com/naina-r/safespaceshield/blob/master/app.py"
click node_keyword_detection "https://github.com/naina-r/safespaceshield/blob/master/analyzer.py"
click node_url_detection "https://github.com/naina-r/safespaceshield/blob/master/analyzer.py"
click node_ip_detection "https://github.com/naina-r/safespaceshield/blob/master/analyzer.py"
click node_risk_scoring "https://github.com/naina-r/safespaceshield/blob/master/analyzer.py"
click node_explanations "https://github.com/naina-r/safespaceshield/blob/master/analyzer.py"
click node_report "https://github.com/naina-r/safespaceshield/blob/master/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_message_ui,node_sample_picker,node_analysis_flow,node_user toneBlue
class node_keyword_detection,node_url_detection,node_ip_detection,node_risk_scoring,node_explanations toneAmber
class node_report toneMint
```

## Components

### User interface

- [Message entry](https://github.com/naina-r/safespaceshield/blob/master/app.py): `app.py`
- [Sample selector](https://github.com/naina-r/safespaceshield/blob/master/app.py): `app.py`
- [Analysis orchestration](https://github.com/naina-r/safespaceshield/blob/master/app.py): `app.py`

### Message analysis

- [Keyword detection](https://github.com/naina-r/safespaceshield/blob/master/analyzer.py): `analyzer.py`
- [URL pattern detection](https://github.com/naina-r/safespaceshield/blob/master/analyzer.py): `analyzer.py`
- [IP URL detection](https://github.com/naina-r/safespaceshield/blob/master/analyzer.py): `analyzer.py`
- [Risk scoring](https://github.com/naina-r/safespaceshield/blob/master/analyzer.py): `analyzer.py`
- [Explanations and guidance](https://github.com/naina-r/safespaceshield/blob/master/analyzer.py): `analyzer.py`

### Assessment results

- [Analysis report](https://github.com/naina-r/safespaceshield/blob/master/app.py): `app.py`

### Other components

- **User**

## Connections

- User → Message entry: enters message (evidence: `README.md`)
- User → Sample selector: selects sample (evidence: `app.py`)
- Sample selector → Message entry: loads sample (evidence: `app.py`)
- Message entry → Analysis orchestration: submits message (evidence: `app.py`)
- Analysis orchestration → Keyword detection: detects keywords (evidence: `app.py`)
- Analysis orchestration → URL pattern detection: detects URL patterns (evidence: `app.py`)
- Analysis orchestration → IP URL detection: detects IP URLs (evidence: `app.py`)
- Analysis orchestration → Risk scoring: calculates risk (evidence: `app.py`)
- Analysis orchestration → Explanations and guidance: generates explanation (evidence: `app.py`)
- Analysis orchestration → Analysis report: renders results (evidence: `app.py`)
- Keyword detection → Analysis report: displays detections (evidence: `app.py`)
- URL pattern detection → Analysis report: displays detections (evidence: `app.py`)
- IP URL detection → Analysis report: displays detections (evidence: `app.py`)
- Risk scoring → Analysis report: displays assessment (evidence: `app.py`)
- Explanations and guidance → Analysis report: displays guidance (evidence: `README.md`)
