# vishwath26/trusthire architecture

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

- Interactive diagram: https://gitdiagram.com/vishwath26/trusthire
- Repository: https://github.com/vishwath26/trusthire

## Overview

TrustHire accepts recruitment links and uploaded evidence, extracts text, evaluates fraud indicators, persists investigation results, and presents risk reports, trust graphs, and threat intelligence. The sampled routes show investigation creation, retrieval, and graph generation; the README documents OCR/document parsing, network checks, and the scoring model. Frontend API calls are explicit, but their backend HTTP wiring is partly documented rather than shown in the API helper, so that boundary is cited to the README.

Main entry points: [`src/api.js`](https://github.com/vishwath26/trusthire/blob/main/src/api.js) (API client), [`src/App.jsx`](https://github.com/vishwath26/trusthire/blob/main/src/App.jsx) (Page router), [`backend/app/routers/investigations.py`](https://github.com/vishwath26/trusthire/blob/main/backend/app/routers/investigations.py) (Investigation routes), [`backend/app/routers/threats.py`](https://github.com/vishwath26/trusthire/blob/main/backend/app/routers/threats.py) (Threat routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Candidate workspace"]
  node_app["Page router<br/>[App.jsx]"]
  node_intake["Evidence intake<br/>[investigate.jsx]"]
  node_client["API client<br/>[api.js]"]
  node_dashboard["Investigation dashboard"]
  node_myinvestigations["Investigation history"]
  node_riskreport["Risk assessment<br/>[RiskAssessment.jsx]"]
  node_trustgraph["Trust graph view<br/>[TrustGraph.jsx]"]
  node_threatview["Threat intelligence view"]
end

subgraph group_api["API and persistence"]
  node_server["FastAPI application<br/>[main.py]"]
  node_investigations["Investigation routes<br/>[investigations.py]"]
  node_threatsroute["Threat routes<br/>[threats.py]"]
  node_database[("SQLite database<br/>[database.py]")]
  node_records["Investigation records<br/>[models.py]"]
end

subgraph group_analysis["Evidence intelligence"]
  node_extract["Evidence extraction<br/>[extract.py]"]
  node_analyzer["Risk analyzer<br/>[analyzer.py]"]
  node_ml["Bayesian NLP<br/>[ai_analyzer.py]"]
end

subgraph group_insight["Risk insights"]
  node_graphbuilder["Graph construction<br/>[graph.py]"]
  node_threatservice["Threat aggregation<br/>[threats.py]"]
end

node_candidate(("Candidate"))

node_candidate -->|"submits evidence"| node_intake
node_app -->|"routes to"| node_intake
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_riskreport
node_app -->|"routes to"| node_trustgraph
node_app -->|"routes to"| node_threatview
node_intake -->|"creates investigation"| node_client
node_dashboard -->|"fetches investigation"| node_client
node_myinvestigations -->|"requests history"| node_client
node_riskreport -->|"requests report"| node_client
node_trustgraph -->|"requests graph"| node_client
node_threatview -->|"requests intelligence"| node_client
node_client -->|"calls API"| node_investigations
node_client -->|"calls API"| node_threatsroute
node_server -->|"registers routes"| node_investigations
node_server -->|"registers routes"| node_threatsroute
node_server -->|"ensures schema"| node_database
node_investigations -->|"runs analysis"| node_analyzer
node_investigations -->|"builds graph"| node_graphbuilder
node_investigations -->|"reads and writes"| node_records
node_threatsroute -->|"builds intelligence"| node_threatservice
node_threatsroute -->|"opens session"| node_database
node_database -->|"maps schema"| node_records
node_analyzer -->|"uses extracted text"| node_extract
node_analyzer -->|"requests review"| node_ml
node_graphbuilder -->|"reads investigation"| node_records
node_threatservice -->|"aggregates records"| node_records

click node_app "https://github.com/vishwath26/trusthire/blob/main/src/App.jsx"
click node_intake "https://github.com/vishwath26/trusthire/blob/main/src/pages/investigate.jsx"
click node_client "https://github.com/vishwath26/trusthire/blob/main/src/api.js"
click node_dashboard "https://github.com/vishwath26/trusthire/blob/main/src/pages/InvestigationDashboard.jsx"
click node_myinvestigations "https://github.com/vishwath26/trusthire/blob/main/src/pages/MyInvestigations.jsx"
click node_riskreport "https://github.com/vishwath26/trusthire/blob/main/src/pages/RiskAssessment.jsx"
click node_trustgraph "https://github.com/vishwath26/trusthire/blob/main/src/pages/TrustGraph.jsx"
click node_threatview "https://github.com/vishwath26/trusthire/blob/main/src/pages/ThreatIntelligence.jsx"
click node_server "https://github.com/vishwath26/trusthire/blob/main/backend/app/main.py"
click node_investigations "https://github.com/vishwath26/trusthire/blob/main/backend/app/routers/investigations.py"
click node_threatsroute "https://github.com/vishwath26/trusthire/blob/main/backend/app/routers/threats.py"
click node_database "https://github.com/vishwath26/trusthire/blob/main/backend/app/database.py"
click node_records "https://github.com/vishwath26/trusthire/blob/main/backend/app/models.py"
click node_extract "https://github.com/vishwath26/trusthire/blob/main/backend/app/services/extract.py"
click node_analyzer "https://github.com/vishwath26/trusthire/blob/main/backend/app/services/analyzer.py"
click node_ml "https://github.com/vishwath26/trusthire/blob/main/backend/app/services/ai_analyzer.py"
click node_graphbuilder "https://github.com/vishwath26/trusthire/blob/main/backend/app/services/graph.py"
click node_threatservice "https://github.com/vishwath26/trusthire/blob/main/backend/app/services/threats.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_app,node_intake,node_client,node_dashboard,node_myinvestigations,node_riskreport,node_trustgraph,node_threatview toneBlue
class node_server,node_investigations,node_threatsroute,node_database,node_records toneAmber
class node_extract,node_analyzer,node_ml toneMint
class node_graphbuilder,node_threatservice toneRose
class node_candidate toneIndigo
```

## Components

### Candidate workspace

- [Page router](https://github.com/vishwath26/trusthire/blob/main/src/App.jsx): `src/App.jsx`
- [Evidence intake](https://github.com/vishwath26/trusthire/blob/main/src/pages/investigate.jsx): `src/pages/investigate.jsx`
- [API client](https://github.com/vishwath26/trusthire/blob/main/src/api.js): `src/api.js`
- [Investigation dashboard](https://github.com/vishwath26/trusthire/blob/main/src/pages/InvestigationDashboard.jsx): `src/pages/InvestigationDashboard.jsx`
- [Investigation history](https://github.com/vishwath26/trusthire/blob/main/src/pages/MyInvestigations.jsx): `src/pages/MyInvestigations.jsx`
- [Risk assessment](https://github.com/vishwath26/trusthire/blob/main/src/pages/RiskAssessment.jsx): `src/pages/RiskAssessment.jsx`
- [Trust graph view](https://github.com/vishwath26/trusthire/blob/main/src/pages/TrustGraph.jsx): `src/pages/TrustGraph.jsx`
- [Threat intelligence view](https://github.com/vishwath26/trusthire/blob/main/src/pages/ThreatIntelligence.jsx): `src/pages/ThreatIntelligence.jsx`

### API and persistence

- [FastAPI application](https://github.com/vishwath26/trusthire/blob/main/backend/app/main.py): `backend/app/main.py`
- [Investigation routes](https://github.com/vishwath26/trusthire/blob/main/backend/app/routers/investigations.py): `backend/app/routers/investigations.py`
- [Threat routes](https://github.com/vishwath26/trusthire/blob/main/backend/app/routers/threats.py): `backend/app/routers/threats.py`
- [SQLite database](https://github.com/vishwath26/trusthire/blob/main/backend/app/database.py): `backend/app/database.py`
- [Investigation records](https://github.com/vishwath26/trusthire/blob/main/backend/app/models.py): `backend/app/models.py`

### Evidence intelligence

- [Evidence extraction](https://github.com/vishwath26/trusthire/blob/main/backend/app/services/extract.py): `backend/app/services/extract.py`
- [Risk analyzer](https://github.com/vishwath26/trusthire/blob/main/backend/app/services/analyzer.py): `backend/app/services/analyzer.py`
- [Bayesian NLP](https://github.com/vishwath26/trusthire/blob/main/backend/app/services/ai_analyzer.py): `backend/app/services/ai_analyzer.py`

### Risk insights

- [Graph construction](https://github.com/vishwath26/trusthire/blob/main/backend/app/services/graph.py): `backend/app/services/graph.py`
- [Threat aggregation](https://github.com/vishwath26/trusthire/blob/main/backend/app/services/threats.py): `backend/app/services/threats.py`

### Other components

- **Candidate**

## Connections

- Candidate → Evidence intake: submits evidence (evidence: `README.md`)
- Page router → Evidence intake: routes to (evidence: `src/App.jsx`)
- Page router → Investigation dashboard: routes to (evidence: `src/App.jsx`)
- Page router → Risk assessment: routes to (evidence: `src/App.jsx`)
- Page router → Trust graph view: routes to (evidence: `src/App.jsx`)
- Page router → Threat intelligence view: routes to (evidence: `src/App.jsx`)
- Evidence intake → API client: creates investigation (evidence: `src/pages/investigate.jsx`)
- Investigation dashboard → API client: fetches investigation (evidence: `src/pages/InvestigationDashboard.jsx`)
- Investigation history → API client: requests history (evidence: `src/pages/MyInvestigations.jsx`)
- Risk assessment → API client: requests report (evidence: `src/pages/RiskAssessment.jsx`)
- Trust graph view → API client: requests graph (evidence: `src/pages/TrustGraph.jsx`)
- Threat intelligence view → API client: requests intelligence (evidence: `src/pages/ThreatIntelligence.jsx`)
- API client → Investigation routes: calls API (evidence: `README.md`)
- API client → Threat routes: calls API (evidence: `README.md`)
- FastAPI application → Investigation routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Threat routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → SQLite database: ensures schema (evidence: `backend/app/main.py`)
- Investigation routes → Risk analyzer: runs analysis (evidence: `backend/app/routers/investigations.py`)
- Investigation routes → Graph construction: builds graph (evidence: `backend/app/routers/investigations.py`)
- Investigation routes → Investigation records: reads and writes (evidence: `backend/app/routers/investigations.py`)
- Threat routes → Threat aggregation: builds intelligence (evidence: `backend/app/routers/threats.py`)
- Threat routes → SQLite database: opens session (evidence: `backend/app/routers/threats.py`)
- SQLite database → Investigation records: maps schema (evidence: `backend/app/database.py`)
- Risk analyzer → Evidence extraction: uses extracted text (evidence: `backend/app/services/analyzer.py`)
- Risk analyzer → Bayesian NLP: requests review (evidence: `backend/app/services/analyzer.py`)
- Graph construction → Investigation records: reads investigation (evidence: `backend/app/services/graph.py`)
- Threat aggregation → Investigation records: aggregates records (evidence: `backend/app/services/threats.py`)
