# nexacxlerate/brandshield architecture

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

- Interactive diagram: https://gitdiagram.com/nexacxlerate/brandshield
- Repository: https://github.com/nexacxlerate/brandshield

## Overview

ScamMind AI is a brand-protection workspace: analysts configure a brand, investigate suspected impersonators, review linked campaigns and evidence, and prepare takedown reports for human approval. The backend exposes the investigation and monitoring capabilities through FastAPI; its TrustMesh engine scores entities and clusters related suspects. The React workspace presents these capabilities and can fall back to bundled sample data when offline. Several feature-specific backend and frontend modules are indexed but not excerpted, so their internal connections are left unspecified.

Main entry points: [`backend/app/routers`](https://github.com/nexacxlerate/brandshield/tree/main/backend/app/routers) (Investigation and monitoring routes), [`backend/app/main.py`](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/services/analysis_service.py`](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/services/analysis_service.py) (Analysis persistence), [`backend/app/engine/analysis.py`](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/engine/analysis.py) (Scoring and campaign linking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Analyst workspace"]
  node_frontend["Workspace routes<br/>[App.tsx]"]
  node_feature_pages["Monitoring and analysis pages"]
  node_report_page["Reports page<br/>[ReportsPage.tsx]"]
  node_api_client["API client<br/>[client.ts]"]
  node_sample_data["Offline sample data<br/>[store.ts]"]
end

subgraph group_api["API and workflows"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_feature_routes["Investigation and monitoring routes"]
  node_report_routes["Report routes<br/>[reports.py]"]
end

subgraph group_services["Domain services"]
  node_analysis_service["Analysis persistence"]
  node_investigation_service["Investigation workflow"]
  node_dashboard_service["Dashboard aggregates"]
  node_app_analysis["App analysis<br/>[apk_service.py]"]
  node_report_service["Evidence-backed reporting<br/>[report_service.py]"]
  node_integrations["External integrations<br/>[integrations.py]"]
end

subgraph group_engine["TrustMesh engine"]
  node_engine_analysis["Scoring and campaign linking<br/>[analysis.py]"]
  node_detectors["Signal detectors<br/>[detectors.py]"]
  node_similarity["Similarity matching<br/>[similarity.py]"]
  node_explain["Risk explanations<br/>[explain.py]"]
end

subgraph group_state["Data and evidence"]
  node_database[("Application database<br/>[db.py]")]
  node_evidence_store["Evidence handling"]
end

node_analyst(("Analyst"))
node_human_approval(("Human reviewer"))

node_analyst -->|"uses"| node_frontend
node_frontend -->|"routes to"| node_feature_pages
node_feature_pages -.->|"requests data"| node_api_client
node_api_client -->|"falls back to"| node_sample_data
node_api_client -.->|"calls API"| node_api_app
node_api_app -->|"registers"| node_auth_routes
node_api_app -->|"registers"| node_feature_routes
node_api_app -->|"registers"| node_report_routes
node_feature_routes -->|"investigates app"| node_investigation_service
node_feature_routes -->|"scores app"| node_app_analysis
node_feature_routes -->|"stores upload"| node_evidence_store
node_feature_routes -.->|"uses analysis"| node_analysis_service
node_analysis_service -->|"runs scoring"| node_engine_analysis
node_engine_analysis -->|"computes signals"| node_detectors
node_engine_analysis -->|"matches entities"| node_similarity
node_investigation_service -->|"analyzes clues"| node_engine_analysis
node_investigation_service -->|"classifies clues"| node_explain
node_report_routes -.->|"prepares report"| node_report_service
node_report_service -->|"awaits approval"| node_human_approval
node_dashboard_service -->|"summarizes campaigns"| node_analysis_service
node_analysis_service -->|"persists results"| node_database
node_evidence_store -.->|"records evidence"| node_database
node_integrations -.->|"supports integrations"| node_api_app

click node_frontend "https://github.com/nexacxlerate/brandshield/blob/main/frontend/src/App.tsx"
click node_feature_pages "https://github.com/nexacxlerate/brandshield/tree/main/frontend/src/pages"
click node_report_page "https://github.com/nexacxlerate/brandshield/blob/main/frontend/src/pages/ReportsPage.tsx"
click node_api_client "https://github.com/nexacxlerate/brandshield/blob/main/frontend/src/api/client.ts"
click node_sample_data "https://github.com/nexacxlerate/brandshield/blob/main/frontend/src/data/store.ts"
click node_api_app "https://github.com/nexacxlerate/brandshield/blob/main/backend/app/main.py"
click node_auth_routes "https://github.com/nexacxlerate/brandshield/blob/main/backend/app/routers/auth.py"
click node_feature_routes "https://github.com/nexacxlerate/brandshield/tree/main/backend/app/routers"
click node_report_routes "https://github.com/nexacxlerate/brandshield/blob/main/backend/app/routers/reports.py"
click node_analysis_service "https://github.com/nexacxlerate/brandshield/blob/main/backend/app/services/analysis_service.py"
click node_investigation_service "https://github.com/nexacxlerate/brandshield/blob/main/backend/app/services/investigation_service.py"
click node_dashboard_service "https://github.com/nexacxlerate/brandshield/blob/main/backend/app/services/dashboard_service.py"
click node_app_analysis "https://github.com/nexacxlerate/brandshield/blob/main/backend/app/services/apk_service.py"
click node_report_service "https://github.com/nexacxlerate/brandshield/blob/main/backend/app/services/report_service.py"
click node_integrations "https://github.com/nexacxlerate/brandshield/blob/main/backend/app/services/integrations.py"
click node_engine_analysis "https://github.com/nexacxlerate/brandshield/blob/main/backend/app/engine/analysis.py"
click node_detectors "https://github.com/nexacxlerate/brandshield/blob/main/backend/app/engine/detectors.py"
click node_similarity "https://github.com/nexacxlerate/brandshield/blob/main/backend/app/engine/similarity.py"
click node_explain "https://github.com/nexacxlerate/brandshield/blob/main/backend/app/engine/explain.py"
click node_database "https://github.com/nexacxlerate/brandshield/blob/main/backend/app/db.py"
click node_evidence_store "https://github.com/nexacxlerate/brandshield/blob/main/backend/app/services/evidence_service.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_frontend,node_feature_pages,node_report_page,node_api_client,node_sample_data,node_human_approval toneBlue
class node_api_app,node_auth_routes,node_feature_routes,node_report_routes toneAmber
class node_analysis_service,node_investigation_service,node_dashboard_service,node_app_analysis,node_report_service,node_integrations toneMint
class node_engine_analysis,node_detectors,node_similarity,node_explain toneRose
class node_database,node_evidence_store,node_analyst toneIndigo
```

## Components

### Analyst workspace

- [Workspace routes](https://github.com/nexacxlerate/brandshield/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Monitoring and analysis pages](https://github.com/nexacxlerate/brandshield/tree/main/frontend/src/pages): `frontend/src/pages`
- [Reports page](https://github.com/nexacxlerate/brandshield/blob/main/frontend/src/pages/ReportsPage.tsx): `frontend/src/pages/ReportsPage.tsx`
- [API client](https://github.com/nexacxlerate/brandshield/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Offline sample data](https://github.com/nexacxlerate/brandshield/blob/main/frontend/src/data/store.ts): `frontend/src/data/store.ts`

### API and workflows

- [FastAPI application](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication routes](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Investigation and monitoring routes](https://github.com/nexacxlerate/brandshield/tree/main/backend/app/routers): `backend/app/routers`
- [Report routes](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/routers/reports.py): `backend/app/routers/reports.py`

### Domain services

- [Analysis persistence](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/services/analysis_service.py): `backend/app/services/analysis_service.py`
- [Investigation workflow](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/services/investigation_service.py): `backend/app/services/investigation_service.py`
- [Dashboard aggregates](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/services/dashboard_service.py): `backend/app/services/dashboard_service.py`
- [App analysis](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/services/apk_service.py): `backend/app/services/apk_service.py`
- [Evidence-backed reporting](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/services/report_service.py): `backend/app/services/report_service.py`
- [External integrations](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/services/integrations.py): `backend/app/services/integrations.py`

### TrustMesh engine

- [Scoring and campaign linking](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/engine/analysis.py): `backend/app/engine/analysis.py`
- [Signal detectors](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/engine/detectors.py): `backend/app/engine/detectors.py`
- [Similarity matching](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/engine/similarity.py): `backend/app/engine/similarity.py`
- [Risk explanations](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/engine/explain.py): `backend/app/engine/explain.py`

### Data and evidence

- [Application database](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/db.py): `backend/app/db.py`
- [Evidence handling](https://github.com/nexacxlerate/brandshield/blob/main/backend/app/services/evidence_service.py): `backend/app/services/evidence_service.py`

### Other components

- **Analyst**
- **Human reviewer**

## Connections

- Analyst → Workspace routes: uses (evidence: `README.md`)
- Workspace routes → Monitoring and analysis pages: routes to (evidence: `frontend/src/App.tsx`)
- Monitoring and analysis pages → API client: requests data
- API client → Offline sample data: falls back to (evidence: `frontend/src/api/client.ts`)
- API client → FastAPI application: calls API
- FastAPI application → Authentication routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Investigation and monitoring routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Report routes: registers (evidence: `backend/app/main.py`)
- Investigation and monitoring routes → Investigation workflow: investigates app (evidence: `backend/app/routers/apps.py`)
- Investigation and monitoring routes → App analysis: scores app (evidence: `backend/app/routers/apps.py`)
- Investigation and monitoring routes → Evidence handling: stores upload (evidence: `backend/app/routers/apps.py`)
- Investigation and monitoring routes → Analysis persistence: uses analysis
- Analysis persistence → Scoring and campaign linking: runs scoring (evidence: `backend/app/services/analysis_service.py`)
- Scoring and campaign linking → Signal detectors: computes signals (evidence: `backend/app/engine/analysis.py`)
- Scoring and campaign linking → Similarity matching: matches entities (evidence: `backend/app/engine/analysis.py`)
- Investigation workflow → Scoring and campaign linking: analyzes clues (evidence: `backend/app/services/investigation_service.py`)
- Investigation workflow → Risk explanations: classifies clues (evidence: `backend/app/services/investigation_service.py`)
- Report routes → Evidence-backed reporting: prepares report
- Evidence-backed reporting → Human reviewer: awaits approval (evidence: `README.md`)
- Dashboard aggregates → Analysis persistence: summarizes campaigns (evidence: `backend/app/services/dashboard_service.py`)
- Analysis persistence → Application database: persists results (evidence: `backend/app/services/analysis_service.py`)
- Evidence handling → Application database: records evidence
- External integrations → FastAPI application: supports integrations
