# shauryasri07/crimenet-ai architecture

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

- Interactive diagram: https://gitdiagram.com/shauryasri07/crimenet-ai
- Repository: https://github.com/shauryasri07/crimenet-ai

## Overview

CrimeNet AI is an investigator-facing criminal-network intelligence application. Investigators sign in, manage investigations, submit intelligence text for AI extraction, and explore validated entities and relationships through search, graph analytics, pattern detection, dashboards, and reports. The README documents Convex-backed storage and Gemini-powered extraction/insights; sampled frontend code confirms routing, auth, and graph rendering. Backend implementation details were not sampled, so backend links below rely on documented API and pipeline behavior.

Main entry points: [`src/convex/schema.ts`](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/schema.ts) (Convex data store), [`src/convex/ai.ts`](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/ai.ts) (AI extraction and insights), [`src/pages/InvestigationDetail.tsx`](https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/InvestigationDetail.tsx) (Investigation detail), [`src/main.tsx`](https://github.com/shauryasri07/crimenet-ai/blob/main/src/main.tsx) (Application routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and shell"]
  node_app["Application routes<br/>[main.tsx]"]
  node_authpage["Sign-in<br/>[Auth.tsx]"]
  node_shell["App shell<br/>[AppLayout.tsx]"]
end

subgraph group_investigation["Investigation workflow"]
  node_investigations["Investigation management<br/>[Investigations.tsx]"]
  node_detail["Investigation detail"]
  node_upload["Intelligence upload"]
  node_entitiespage["Entity explorer<br/>[Entities.tsx]"]
  node_relationships["Relationship explorer"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_reports["Reports<br/>[Reports.tsx]"]
  node_auditpage["Audit logs<br/>[AuditLogs.tsx]"]
end

subgraph group_analysis["Network analysis"]
  node_networkpage["Criminal network"]
  node_graphview["Interactive graph<br/>[NetworkGraph.tsx]"]
  node_patterns["Pattern detection"]
  node_insightspage["AI insights<br/>[AIInsights.tsx]"]
  node_charts["Dashboard charts"]
end

subgraph group_backend["Convex backend"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_documents["Document handling<br/>[documents.ts]"]
  node_ai["AI extraction and insights<br/>[ai.ts]"]
  node_investigationapi["Investigation records<br/>[investigations.ts]"]
  node_entityapi["Entity records and search<br/>[entities.ts]"]
  node_relationshipapi["Relationship records<br/>[relationships.ts]"]
  node_store[("Convex data store<br/>[schema.ts]")]
  node_networkapi["Graph and metrics<br/>[network.ts]"]
  node_patternapi["Pattern engine<br/>[patterns.ts]"]
  node_insightsapi["Insight records<br/>[insights.ts]"]
  node_dashboardapi["Dashboard statistics<br/>[dashboard.ts]"]
  node_reportapi["Report generation<br/>[reports.ts]"]
  node_auditapi["Audit trail<br/>[audit.ts]"]
  node_searchapi["Global search<br/>[search.ts]"]
  node_demo["Synthetic demo data<br/>[demo.ts]"]
end

node_investigator(("Investigator"))
node_gemini{{"Google Gemini"}}

node_investigator -->|"opens"| node_app
node_app -->|"routes to"| node_authpage
node_authpage -.->|"signs in"| node_auth
node_app -->|"loads protected pages"| node_shell
node_shell -.->|"navigates to"| node_investigations
node_investigator -->|"submits text"| node_upload
node_upload -.->|"submits document"| node_documents
node_upload -.->|"requests extraction"| node_ai
node_ai -->|"extracts entities and relationships"| node_gemini
node_ai -.->|"normalizes entities"| node_entityapi
node_ai -.->|"normalizes relationships"| node_relationshipapi
node_investigations -->|"manages records"| node_investigationapi
node_detail -.->|"loads investigation"| node_investigationapi
node_entitiespage -->|"searches entities"| node_entityapi
node_relationships -->|"lists relationships"| node_relationshipapi
node_dashboard -->|"loads statistics"| node_dashboardapi
node_dashboard -.->|"renders charts"| node_charts
node_detail -.->|"loads graph data"| node_networkapi
node_detail -->|"renders charts"| node_charts
node_detail -->|"renders graph"| node_graphview
node_networkpage -.->|"requests graph"| node_networkapi
node_networkpage -->|"renders graph"| node_graphview
node_networkapi -->|"reads graph records"| node_store
node_patterns -->|"runs detection"| node_patternapi
node_patternapi -.->|"detects from records"| node_store
node_insightspage -.->|"requests insights"| node_ai
node_ai -.->|"stores insights"| node_insightsapi
node_reports -->|"requests report data"| node_reportapi
node_auditpage -->|"lists audit logs"| node_auditapi
node_shell -.->|"queries global search"| node_searchapi
node_investigator -->|"loads demo dataset"| node_demo
node_investigationapi -.->|"reads and writes records"| node_store
node_entityapi -.->|"reads and writes records"| node_store
node_relationshipapi -.->|"reads and writes records"| node_store
node_dashboardapi -.->|"reads statistics"| node_store
node_reportapi -.->|"reads report data"| node_store
node_auditapi -.->|"reads audit data"| node_store

click node_app "https://github.com/shauryasri07/crimenet-ai/blob/main/src/main.tsx"
click node_authpage "https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/Auth.tsx"
click node_auth "https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/auth.ts"
click node_shell "https://github.com/shauryasri07/crimenet-ai/blob/main/src/components/AppLayout.tsx"
click node_investigations "https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/Investigations.tsx"
click node_detail "https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/InvestigationDetail.tsx"
click node_upload "https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/IntelligenceUpload.tsx"
click node_entitiespage "https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/Entities.tsx"
click node_relationships "https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/RelationshipExplorer.tsx"
click node_dashboard "https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/Dashboard.tsx"
click node_reports "https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/Reports.tsx"
click node_auditpage "https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/AuditLogs.tsx"
click node_documents "https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/documents.ts"
click node_ai "https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/ai.ts"
click node_investigationapi "https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/investigations.ts"
click node_entityapi "https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/entities.ts"
click node_relationshipapi "https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/relationships.ts"
click node_store "https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/schema.ts"
click node_networkapi "https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/network.ts"
click node_networkpage "https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/CriminalNetwork.tsx"
click node_graphview "https://github.com/shauryasri07/crimenet-ai/blob/main/src/components/NetworkGraph.tsx"
click node_patterns "https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/PatternDetection.tsx"
click node_patternapi "https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/patterns.ts"
click node_insightspage "https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/AIInsights.tsx"
click node_insightsapi "https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/insights.ts"
click node_charts "https://github.com/shauryasri07/crimenet-ai/blob/main/src/components/DashboardCharts.tsx"
click node_dashboardapi "https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/dashboard.ts"
click node_reportapi "https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/reports.ts"
click node_auditapi "https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/audit.ts"
click node_searchapi "https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/search.ts"
click node_demo "https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/demo.ts"

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_authpage,node_shell toneBlue
class node_investigations,node_detail,node_upload,node_entitiespage,node_relationships,node_dashboard,node_reports,node_auditpage toneAmber
class node_networkpage,node_graphview,node_patterns,node_insightspage,node_charts toneMint
class node_auth,node_documents,node_ai,node_investigationapi,node_entityapi,node_relationshipapi,node_store,node_networkapi,node_patternapi,node_insightsapi,node_dashboardapi,node_reportapi,node_auditapi,node_searchapi,node_demo toneRose
class node_investigator,node_gemini toneIndigo
```

## Components

### Access and shell

- [Application routes](https://github.com/shauryasri07/crimenet-ai/blob/main/src/main.tsx): `src/main.tsx`
- [Sign-in](https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/Auth.tsx): `src/pages/Auth.tsx`
- [App shell](https://github.com/shauryasri07/crimenet-ai/blob/main/src/components/AppLayout.tsx): `src/components/AppLayout.tsx`

### Investigation workflow

- [Investigation management](https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/Investigations.tsx): `src/pages/Investigations.tsx`
- [Investigation detail](https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/InvestigationDetail.tsx): `src/pages/InvestigationDetail.tsx`
- [Intelligence upload](https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/IntelligenceUpload.tsx): `src/pages/IntelligenceUpload.tsx`
- [Entity explorer](https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/Entities.tsx): `src/pages/Entities.tsx`
- [Relationship explorer](https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/RelationshipExplorer.tsx): `src/pages/RelationshipExplorer.tsx`
- [Dashboard](https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/Dashboard.tsx): `src/pages/Dashboard.tsx`
- [Reports](https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/Reports.tsx): `src/pages/Reports.tsx`
- [Audit logs](https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/AuditLogs.tsx): `src/pages/AuditLogs.tsx`

### Network analysis

- [Criminal network](https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/CriminalNetwork.tsx): `src/pages/CriminalNetwork.tsx`
- [Interactive graph](https://github.com/shauryasri07/crimenet-ai/blob/main/src/components/NetworkGraph.tsx): `src/components/NetworkGraph.tsx`
- [Pattern detection](https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/PatternDetection.tsx): `src/pages/PatternDetection.tsx`
- [AI insights](https://github.com/shauryasri07/crimenet-ai/blob/main/src/pages/AIInsights.tsx): `src/pages/AIInsights.tsx`
- [Dashboard charts](https://github.com/shauryasri07/crimenet-ai/blob/main/src/components/DashboardCharts.tsx): `src/components/DashboardCharts.tsx`

### Convex backend

- [Authentication](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/auth.ts): `src/convex/auth.ts`
- [Document handling](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/documents.ts): `src/convex/documents.ts`
- [AI extraction and insights](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/ai.ts): `src/convex/ai.ts`
- [Investigation records](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/investigations.ts): `src/convex/investigations.ts`
- [Entity records and search](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/entities.ts): `src/convex/entities.ts`
- [Relationship records](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/relationships.ts): `src/convex/relationships.ts`
- [Convex data store](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/schema.ts): `src/convex/schema.ts`
- [Graph and metrics](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/network.ts): `src/convex/network.ts`
- [Pattern engine](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/patterns.ts): `src/convex/patterns.ts`
- [Insight records](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/insights.ts): `src/convex/insights.ts`
- [Dashboard statistics](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/dashboard.ts): `src/convex/dashboard.ts`
- [Report generation](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/reports.ts): `src/convex/reports.ts`
- [Audit trail](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/audit.ts): `src/convex/audit.ts`
- [Global search](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/search.ts): `src/convex/search.ts`
- [Synthetic demo data](https://github.com/shauryasri07/crimenet-ai/blob/main/src/convex/demo.ts): `src/convex/demo.ts`

### Other components

- **Investigator**
- **Google Gemini**

## Connections

- Investigator → Application routes: opens (evidence: `src/main.tsx`)
- Application routes → Sign-in: routes to (evidence: `src/main.tsx`)
- Sign-in → Authentication: signs in
- Application routes → App shell: loads protected pages (evidence: `src/main.tsx`)
- App shell → Investigation management: navigates to (evidence: `src/pages/Investigations.tsx`)
- Investigator → Intelligence upload: submits text (evidence: `README.md`)
- Intelligence upload → Document handling: submits document
- Intelligence upload → AI extraction and insights: requests extraction
- AI extraction and insights → Google Gemini: extracts entities and relationships (evidence: `README.md`)
- AI extraction and insights → Entity records and search: normalizes entities
- AI extraction and insights → Relationship records: normalizes relationships
- Investigation management → Investigation records: manages records (evidence: `README.md`)
- Investigation detail → Investigation records: loads investigation
- Entity explorer → Entity records and search: searches entities (evidence: `README.md`)
- Relationship explorer → Relationship records: lists relationships (evidence: `README.md`)
- Dashboard → Dashboard statistics: loads statistics (evidence: `README.md`)
- Dashboard → Dashboard charts: renders charts
- Investigation detail → Graph and metrics: loads graph data
- Investigation detail → Dashboard charts: renders charts (evidence: `src/pages/InvestigationDetail.tsx`)
- Investigation detail → Interactive graph: renders graph (evidence: `src/pages/InvestigationDetail.tsx`)
- Criminal network → Graph and metrics: requests graph
- Criminal network → Interactive graph: renders graph (evidence: `src/pages/CriminalNetwork.tsx`)
- Graph and metrics → Convex data store: reads graph records (evidence: `README.md`)
- Pattern detection → Pattern engine: runs detection (evidence: `README.md`)
- Pattern engine → Convex data store: detects from records
- AI insights → AI extraction and insights: requests insights
- AI extraction and insights → Insight records: stores insights
- Reports → Report generation: requests report data (evidence: `README.md`)
- Audit logs → Audit trail: lists audit logs (evidence: `README.md`)
- App shell → Global search: queries global search
- Investigator → Synthetic demo data: loads demo dataset (evidence: `README.md`)
- Investigation records → Convex data store: reads and writes records
- Entity records and search → Convex data store: reads and writes records
- Relationship records → Convex data store: reads and writes records
- Dashboard statistics → Convex data store: reads statistics
- Report generation → Convex data store: reads report data
- Audit trail → Convex data store: reads audit data
