# amano2/docintel architecture

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

- Interactive diagram: https://gitdiagram.com/amano2/docintel
- Repository: https://github.com/amano2/docintel

## Overview

DocIntel is a multi-tenant document-intelligence application for reviewing invoices, contracts, purchase orders, and compliance files. The primary workflow runs from authenticated upload through extraction, anomaly detection, and human review; users can also ask cited questions across their document corpus. Dashboard and benchmark views provide operational and evaluation capabilities. The README documents the serverless AI and Supabase architecture; sampled frontend excerpts show selected service calls, but not every API request or backend implementation detail.

Main entry points: [`src/lib/supabaseService.ts`](https://github.com/amano2/docintel/blob/master/src/lib/supabaseService.ts) (Document services), [`src/App.tsx`](https://github.com/amano2/docintel/blob/master/src/App.tsx) (Route application), [`src/pages/ReviewConsolePage.tsx`](https://github.com/amano2/docintel/blob/master/src/pages/ReviewConsolePage.tsx) (Review console), [`src/pages/DashboardPage.tsx`](https://github.com/amano2/docintel/blob/master/src/pages/DashboardPage.tsx) (Operations dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client application"]
  node_app["Route application<br/>[App.tsx]"]
  node_landing["Sign-in and landing<br/>[LandingPage.tsx]"]
  node_layout["Navigation layout<br/>[SidebarLayout.tsx]"]
end

subgraph group_processing["Document processing"]
  node_service["Document services<br/>[supabaseService.ts]"]
  node_extract["Extraction endpoint<br/>[extract.ts]"]
  node_query["Query endpoint<br/>[query.ts]"]
end

subgraph group_data["Data and identity"]
  node_auth["Session context<br/>[AuthContext.tsx]"]
end

subgraph group_operations["Review and insights"]
  node_dashboard["Operations dashboard<br/>[DashboardPage.tsx]"]
  node_review["Review console"]
  node_chat["Corpus Q&amp;A<br/>[ChatInterface.tsx]"]
  node_ask["Ask page<br/>[AskPage.tsx]"]
  node_benchmark["Benchmark view<br/>[BenchmarkPage.tsx]"]
end

node_operator(("Operator"))
node_llm{{"OpenRouter models"}}
node_supabase[("Supabase platform")]

node_operator -->|"signs in"| node_landing
node_landing -->|"authenticates"| node_auth
node_auth -->|"manages session"| node_supabase
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_review
node_app -->|"routes to"| node_ask
node_app -->|"routes to"| node_benchmark
node_app -->|"guards routes"| node_auth
node_operator -->|"views status"| node_dashboard
node_dashboard -->|"loads metrics"| node_service
node_operator -->|"uploads and reviews"| node_review
node_review -->|"loads documents"| node_service
node_review -->|"resolves anomalies"| node_service
node_service -->|"requests extraction"| node_extract
node_extract -->|"submits documents"| node_llm
node_service -->|"stores extracted fields"| node_supabase
node_operator -->|"asks questions"| node_ask
node_ask -->|"renders interface"| node_chat
node_chat -->|"queries corpus"| node_service
node_service -->|"requests answers"| node_query
node_query -->|"queries models"| node_llm
node_service -->|"reads and audits"| node_supabase
node_operator -->|"views evaluations"| node_benchmark
node_dashboard -->|"uses navigation"| node_layout
node_review -->|"uses navigation"| node_layout
node_benchmark -->|"uses navigation"| node_layout

click node_app "https://github.com/amano2/docintel/blob/master/src/App.tsx"
click node_landing "https://github.com/amano2/docintel/blob/master/src/pages/LandingPage.tsx"
click node_auth "https://github.com/amano2/docintel/blob/master/src/context/AuthContext.tsx"
click node_dashboard "https://github.com/amano2/docintel/blob/master/src/pages/DashboardPage.tsx"
click node_review "https://github.com/amano2/docintel/blob/master/src/pages/ReviewConsolePage.tsx"
click node_chat "https://github.com/amano2/docintel/blob/master/src/components/ChatInterface.tsx"
click node_ask "https://github.com/amano2/docintel/blob/master/src/pages/AskPage.tsx"
click node_benchmark "https://github.com/amano2/docintel/blob/master/src/pages/BenchmarkPage.tsx"
click node_service "https://github.com/amano2/docintel/blob/master/src/lib/supabaseService.ts"
click node_extract "https://github.com/amano2/docintel/blob/master/api/extract.ts"
click node_query "https://github.com/amano2/docintel/blob/master/api/query.ts"
click node_layout "https://github.com/amano2/docintel/blob/master/src/components/SidebarLayout.tsx"

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_landing,node_layout toneBlue
class node_service,node_extract,node_query,node_supabase toneAmber
class node_auth,node_llm toneMint
class node_dashboard,node_review,node_chat,node_ask,node_benchmark toneRose
class node_operator toneIndigo
```

## Components

### Client application

- [Route application](https://github.com/amano2/docintel/blob/master/src/App.tsx): `src/App.tsx`
- [Sign-in and landing](https://github.com/amano2/docintel/blob/master/src/pages/LandingPage.tsx): `src/pages/LandingPage.tsx`
- [Navigation layout](https://github.com/amano2/docintel/blob/master/src/components/SidebarLayout.tsx): `src/components/SidebarLayout.tsx`

### Document processing

- [Document services](https://github.com/amano2/docintel/blob/master/src/lib/supabaseService.ts): `src/lib/supabaseService.ts`
- [Extraction endpoint](https://github.com/amano2/docintel/blob/master/api/extract.ts): `api/extract.ts`
- [Query endpoint](https://github.com/amano2/docintel/blob/master/api/query.ts): `api/query.ts`

### Data and identity

- [Session context](https://github.com/amano2/docintel/blob/master/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`

### Review and insights

- [Operations dashboard](https://github.com/amano2/docintel/blob/master/src/pages/DashboardPage.tsx): `src/pages/DashboardPage.tsx`
- [Review console](https://github.com/amano2/docintel/blob/master/src/pages/ReviewConsolePage.tsx): `src/pages/ReviewConsolePage.tsx`
- [Corpus Q&A](https://github.com/amano2/docintel/blob/master/src/components/ChatInterface.tsx): `src/components/ChatInterface.tsx`
- [Ask page](https://github.com/amano2/docintel/blob/master/src/pages/AskPage.tsx): `src/pages/AskPage.tsx`
- [Benchmark view](https://github.com/amano2/docintel/blob/master/src/pages/BenchmarkPage.tsx): `src/pages/BenchmarkPage.tsx`

### Other components

- **Operator**
- **OpenRouter models**
- **Supabase platform**

## Connections

- Operator → Sign-in and landing: signs in (evidence: `src/pages/LandingPage.tsx`)
- Sign-in and landing → Session context: authenticates (evidence: `src/pages/LandingPage.tsx`)
- Session context → Supabase platform: manages session (evidence: `src/context/AuthContext.tsx`)
- Route application → Sign-in and landing: routes to (evidence: `src/App.tsx`)
- Route application → Operations dashboard: routes to (evidence: `src/App.tsx`)
- Route application → Review console: routes to (evidence: `src/App.tsx`)
- Route application → Ask page: routes to (evidence: `src/App.tsx`)
- Route application → Benchmark view: routes to (evidence: `src/App.tsx`)
- Route application → Session context: guards routes (evidence: `src/App.tsx`)
- Operator → Operations dashboard: views status (evidence: `README.md`)
- Operations dashboard → Document services: loads metrics (evidence: `src/pages/DashboardPage.tsx`)
- Operator → Review console: uploads and reviews (evidence: `README.md`)
- Review console → Document services: loads documents (evidence: `src/pages/ReviewConsolePage.tsx`)
- Review console → Document services: resolves anomalies (evidence: `src/pages/ReviewConsolePage.tsx`)
- Document services → Extraction endpoint: requests extraction (evidence: `README.md`)
- Extraction endpoint → OpenRouter models: submits documents (evidence: `README.md`)
- Document services → Supabase platform: stores extracted fields (evidence: `src/lib/supabaseService.ts`)
- Operator → Ask page: asks questions (evidence: `README.md`)
- Ask page → Corpus Q&A: renders interface (evidence: `src/pages/AskPage.tsx`)
- Corpus Q&A → Document services: queries corpus (evidence: `src/components/ChatInterface.tsx`)
- Document services → Query endpoint: requests answers (evidence: `README.md`)
- Query endpoint → OpenRouter models: queries models (evidence: `README.md`)
- Document services → Supabase platform: reads and audits (evidence: `src/lib/supabaseService.ts`)
- Operator → Benchmark view: views evaluations (evidence: `README.md`)
- Operations dashboard → Navigation layout: uses navigation (evidence: `src/pages/DashboardPage.tsx`)
- Review console → Navigation layout: uses navigation (evidence: `src/pages/ReviewConsolePage.tsx`)
- Benchmark view → Navigation layout: uses navigation (evidence: `README.md`)
