# ritecha/truetrail architecture

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

- Interactive diagram: https://gitdiagram.com/ritecha/truetrail
- Repository: https://github.com/ritecha/truetrail

## Overview

This repository combines a TrueTrail investigation workspace and evidence API with a transaction-network analysis engine; the README also describes a synthetic-data ML prototype, but its training and prediction modules are absent from the supplied tree. The main user flow is investigator sign-in, case selection, evidence upload and collaboration, with backend evidence integrity and case-grounded agent answers; a separate analysis UI presents network findings. Edges are limited to relationships shown in excerpts or the source index, so the unsampled TrueTrail adapter is left unconnected.

Main entry points: [`part4/frontend/src/components/WorkspaceView.jsx`](https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/components/WorkspaceView.jsx) (Case workspace), [`part4/frontend/src/App.jsx`](https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/App.jsx) (App shell), [`part4/backend/main.py`](https://github.com/ritecha/truetrail/blob/main/part4/backend/main.py) (Evidence API), [`part4/frontend/src/components/UploadCard.jsx`](https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/components/UploadCard.jsx) (Evidence uploader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Investigation workspace"]
  node_app["App shell<br/>[App.jsx]"]
  node_workspaces["Case workspaces<br/>[Workspaces.jsx]"]
  node_workspace["Case workspace<br/>[WorkspaceView.jsx]"]
  node_case_store_ui[("Browser case store<br/>[store.js]")]
  node_upload["Evidence uploader<br/>[UploadCard.jsx]"]
  node_ledger["Evidence ledger<br/>[Ledger.jsx]"]
  node_graphview["Graph view<br/>[GraphView.jsx]"]
  node_timeline["Timeline and map<br/>[TimeMap.jsx]"]
  node_agentchat["Case agent chat<br/>[AgentChat.jsx]"]
end

subgraph group_backend["Evidence and case API"]
  node_case_api["Evidence API<br/>[main.py]"]
  node_agent["Agent router<br/>[agent.py]"]
  node_case_store[("Case evidence store<br/>[case_store.py]")]
  node_integrity[("Integrity audit<br/>[integrity.py]")]
  node_report_api["PDF report endpoint<br/>[report.py]"]
end

subgraph group_analysis["Network analysis"]
  node_analysis_ui["Analysis dashboard<br/>[app.py]"]
  node_correlation["Network correlation"]
  node_data_source["Analysis data source<br/>[data_source.py]"]
  node_true_trail_adapter["TrueTrail adapter"]
end

subgraph group_reporting["Reporting"]
  node_lead_pack["Lead pack<br/>[lead_pack.py]"]
end

node_investigator(("Investigator"))
node_supabase[("Supabase storage")]
node_clerk["Clerk identity"]

node_investigator -->|"uses"| node_app
node_clerk -->|"authenticates"| node_app
node_app -->|"renders"| node_workspaces
node_app -->|"renders"| node_workspace
node_app -->|"loads cases"| node_case_store_ui
node_workspaces -->|"reads and updates"| node_case_store_ui
node_workspace -->|"updates case"| node_case_store_ui
node_workspace -->|"renders"| node_upload
node_workspace -->|"renders"| node_ledger
node_workspace -->|"renders"| node_graphview
node_workspace -->|"renders"| node_timeline
node_upload -->|"uploads evidence"| node_supabase
node_upload -->|"fallback upload"| node_case_api
node_agentchat -->|"uses API"| node_ledger
node_agentchat -.->|"asks questions"| node_agent
node_case_api -->|"mounts router"| node_agent
node_case_api -->|"hashes and audits"| node_integrity
node_case_api -->|"generates report"| node_report_api
node_agent -->|"queries evidence"| node_case_store
node_investigator -->|"reviews findings"| node_analysis_ui
node_analysis_ui -->|"runs analysis"| node_correlation
node_correlation -->|"loads inputs"| node_data_source
node_lead_pack -.->|"uses case evidence"| node_case_store

click node_app "https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/App.jsx"
click node_workspaces "https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/components/Workspaces.jsx"
click node_workspace "https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/components/WorkspaceView.jsx"
click node_case_store_ui "https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/store.js"
click node_upload "https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/components/UploadCard.jsx"
click node_ledger "https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/components/Ledger.jsx"
click node_graphview "https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/components/GraphView.jsx"
click node_timeline "https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/components/TimeMap.jsx"
click node_agentchat "https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/components/AgentChat.jsx"
click node_case_api "https://github.com/ritecha/truetrail/blob/main/part4/backend/main.py"
click node_agent "https://github.com/ritecha/truetrail/blob/main/part4/backend/agent.py"
click node_case_store "https://github.com/ritecha/truetrail/blob/main/part4/backend/case_store.py"
click node_integrity "https://github.com/ritecha/truetrail/blob/main/part4/backend/integrity.py"
click node_report_api "https://github.com/ritecha/truetrail/blob/main/part4/backend/report.py"
click node_analysis_ui "https://github.com/ritecha/truetrail/blob/main/ui/app.py"
click node_correlation "https://github.com/ritecha/truetrail/blob/main/engine/network_correlation.py"
click node_data_source "https://github.com/ritecha/truetrail/blob/main/engine/data_source.py"
click node_true_trail_adapter "https://github.com/ritecha/truetrail/blob/main/integration/trueTrail_adapter.py"
click node_lead_pack "https://github.com/ritecha/truetrail/blob/main/report/lead_pack.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_workspaces,node_workspace,node_case_store_ui,node_upload,node_ledger,node_graphview,node_timeline,node_agentchat toneBlue
class node_case_api,node_agent,node_case_store,node_integrity,node_report_api,node_supabase toneAmber
class node_analysis_ui,node_correlation,node_data_source,node_true_trail_adapter toneMint
class node_lead_pack toneRose
class node_investigator,node_clerk toneIndigo
```

## Components

### Investigation workspace

- [App shell](https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/App.jsx): `part4/frontend/src/App.jsx`
- [Case workspaces](https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/components/Workspaces.jsx): `part4/frontend/src/components/Workspaces.jsx`
- [Case workspace](https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/components/WorkspaceView.jsx): `part4/frontend/src/components/WorkspaceView.jsx`
- [Browser case store](https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/store.js): `part4/frontend/src/store.js`
- [Evidence uploader](https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/components/UploadCard.jsx): `part4/frontend/src/components/UploadCard.jsx`
- [Evidence ledger](https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/components/Ledger.jsx): `part4/frontend/src/components/Ledger.jsx`
- [Graph view](https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/components/GraphView.jsx): `part4/frontend/src/components/GraphView.jsx`
- [Timeline and map](https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/components/TimeMap.jsx): `part4/frontend/src/components/TimeMap.jsx`
- [Case agent chat](https://github.com/ritecha/truetrail/blob/main/part4/frontend/src/components/AgentChat.jsx): `part4/frontend/src/components/AgentChat.jsx`

### Evidence and case API

- [Evidence API](https://github.com/ritecha/truetrail/blob/main/part4/backend/main.py): `part4/backend/main.py`
- [Agent router](https://github.com/ritecha/truetrail/blob/main/part4/backend/agent.py): `part4/backend/agent.py`
- [Case evidence store](https://github.com/ritecha/truetrail/blob/main/part4/backend/case_store.py): `part4/backend/case_store.py`
- [Integrity audit](https://github.com/ritecha/truetrail/blob/main/part4/backend/integrity.py): `part4/backend/integrity.py`
- [PDF report endpoint](https://github.com/ritecha/truetrail/blob/main/part4/backend/report.py): `part4/backend/report.py`

### Network analysis

- [Analysis dashboard](https://github.com/ritecha/truetrail/blob/main/ui/app.py): `ui/app.py`
- [Network correlation](https://github.com/ritecha/truetrail/blob/main/engine/network_correlation.py): `engine/network_correlation.py`
- [Analysis data source](https://github.com/ritecha/truetrail/blob/main/engine/data_source.py): `engine/data_source.py`
- [TrueTrail adapter](https://github.com/ritecha/truetrail/blob/main/integration/trueTrail_adapter.py): `integration/trueTrail_adapter.py`

### Reporting

- [Lead pack](https://github.com/ritecha/truetrail/blob/main/report/lead_pack.py): `report/lead_pack.py`

### Other components

- **Investigator**
- **Supabase storage**
- **Clerk identity**

## Connections

- Investigator → App shell: uses (evidence: `part4/frontend/src/App.jsx`)
- Clerk identity → App shell: authenticates (evidence: `part4/frontend/src/App.jsx`)
- App shell → Case workspaces: renders (evidence: `part4/frontend/src/App.jsx`)
- App shell → Case workspace: renders (evidence: `part4/frontend/src/App.jsx`)
- App shell → Browser case store: loads cases (evidence: `part4/frontend/src/App.jsx`)
- Case workspaces → Browser case store: reads and updates (evidence: `part4/frontend/src/store.js`)
- Case workspace → Browser case store: updates case (evidence: `part4/frontend/src/components/WorkspaceView.jsx`)
- Case workspace → Evidence uploader: renders (evidence: `part4/frontend/src/components/WorkspaceView.jsx`)
- Case workspace → Evidence ledger: renders (evidence: `part4/frontend/src/components/WorkspaceView.jsx`)
- Case workspace → Graph view: renders (evidence: `part4/frontend/src/components/WorkspaceView.jsx`)
- Case workspace → Timeline and map: renders (evidence: `part4/frontend/src/components/WorkspaceView.jsx`)
- Evidence uploader → Supabase storage: uploads evidence (evidence: `part4/frontend/src/components/UploadCard.jsx`)
- Evidence uploader → Evidence API: fallback upload (evidence: `part4/frontend/src/components/UploadCard.jsx`)
- Case agent chat → Evidence ledger: uses API (evidence: `part4/frontend/src/components/AgentChat.jsx`)
- Case agent chat → Agent router: asks questions
- Evidence API → Agent router: mounts router (evidence: `part4/backend/main.py`)
- Evidence API → Integrity audit: hashes and audits (evidence: `part4/backend/main.py`)
- Evidence API → PDF report endpoint: generates report (evidence: `part4/backend/main.py`)
- Agent router → Case evidence store: queries evidence (evidence: `part4/backend/agent.py`)
- Investigator → Analysis dashboard: reviews findings (evidence: `ui/app.py`)
- Analysis dashboard → Network correlation: runs analysis (evidence: `ui/app.py`)
- Network correlation → Analysis data source: loads inputs (evidence: `engine/network_correlation.py`)
- Lead pack → Case evidence store: uses case evidence
