# balamanikantatirunagaram-lgtm/docmind-ai architecture

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

- Interactive diagram: https://gitdiagram.com/balamanikantatirunagaram-lgtm/docmind-ai
- Repository: https://github.com/balamanikantatirunagaram-lgtm/docmind-ai

## Overview

DOCMIND AI turns uploaded documents into searchable, organized knowledge, with AI-assisted extraction, chat, reports, and a knowledge graph. The primary flow runs from document upload in the React app through authenticated API routes and document processing to database and file storage; users then browse or edit results and invoke AI features. The graph also preserves authentication, folders, and the documented NVIDIA integration. Some frontend and backend wiring is inferred from endpoint usage and documented architecture rather than sampled end-to-end, so those links are marked unverified.

Main entry points: [`frontend/src/services/api.ts`](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/services/api.ts) (API client), [`frontend/src/App.tsx`](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/App.tsx) (App routes), [`backend/src/services/DocumentService.ts`](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/services/DocumentService.ts) (Document processing), [`backend/src/routes/documents.routes.ts`](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/routes/documents.routes.ts) (Document routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["App routes<br/>[App.tsx]"]
  node_documents_ui["Document workspace<br/>[Documents.tsx]"]
  node_folder_ui["Folder views<br/>[Folders.tsx]"]
  node_dashboard_ui["Dashboard<br/>[Dashboard.tsx]"]
  node_chat_ui["AI chat<br/>[Chat.tsx]"]
  node_graph_ui["Knowledge graph<br/>[KnowledgeGraph.tsx]"]
  node_report_ui["AI reports<br/>[AIReport.tsx]"]
  node_auth_ui["Sign in/up<br/>[Login.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["Backend API"]
  node_document_routes["Document routes"]
  node_folder_routes["Folder routes<br/>[folders.routes.ts]"]
  node_ai_routes["AI routes<br/>[ai.routes.ts]"]
  node_auth_routes["Auth routes<br/>[auth.routes.ts]"]
  node_document_controller["Document handlers"]
  node_ai_controller["AI handlers<br/>[AIController.ts]"]
  node_auth_controller["Auth handlers<br/>[AuthController.ts]"]
  node_folder_controller["Folder handlers"]
  node_auth_middleware{{"JWT authentication<br/>[auth.ts]"}}
end

subgraph group_services["Domain services"]
  node_document_service["Document processing<br/>[DocumentService.ts]"]
  node_ai_service["AI capabilities<br/>[AIService.ts]"]
  node_auth_service["Identity service<br/>[AuthService.ts]"]
  node_storage_service["File storage<br/>[StorageService.ts]"]
end

subgraph group_data["Persistence"]
  node_database[("Supabase PostgreSQL<br/>[prisma.ts]")]
end

node_user(("User"))
node_nvidia{{"NVIDIA AI API"}}
node_supabase_storage[("Supabase Storage")]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_documents_ui
node_app -->|"routes to"| node_folder_ui
node_app -->|"routes to"| node_dashboard_ui
node_app -->|"routes to"| node_chat_ui
node_app -->|"routes to"| node_graph_ui
node_app -->|"routes to"| node_report_ui
node_app -->|"routes to"| node_auth_ui
node_documents_ui -->|"calls"| node_api_client
node_folder_ui -->|"calls"| node_api_client
node_dashboard_ui -->|"calls"| node_api_client
node_chat_ui -->|"calls"| node_api_client
node_graph_ui -->|"calls"| node_api_client
node_report_ui -->|"calls"| node_api_client
node_auth_ui -->|"calls"| node_api_client
node_api_client -.->|"requests"| node_document_routes
node_api_client -.->|"requests"| node_folder_routes
node_api_client -.->|"requests"| node_ai_routes
node_api_client -.->|"requests"| node_auth_routes
node_document_routes -->|"dispatches"| node_document_controller
node_folder_routes -->|"dispatches"| node_folder_controller
node_ai_routes -->|"dispatches"| node_ai_controller
node_auth_routes -->|"dispatches"| node_auth_controller
node_document_routes -->|"authenticates"| node_auth_middleware
node_folder_routes -->|"authenticates"| node_auth_middleware
node_ai_routes -->|"authenticates"| node_auth_middleware
node_document_controller -->|"delegates"| node_document_service
node_ai_controller -->|"calls"| node_ai_service
node_auth_controller -->|"delegates"| node_auth_service
node_document_service -->|"stores files"| node_storage_service
node_document_service -->|"processes with"| node_ai_service
node_document_service -->|"reads/writes"| node_database
node_auth_service -->|"reads/writes"| node_database
node_ai_controller -->|"reads/writes"| node_database
node_storage_service -->|"uploads/deletes"| node_supabase_storage
node_ai_service -.->|"AI requests"| node_nvidia

click node_app "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/App.tsx"
click node_documents_ui "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/pages/Documents.tsx"
click node_folder_ui "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/pages/Folders.tsx"
click node_dashboard_ui "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/pages/Dashboard.tsx"
click node_chat_ui "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/pages/Chat.tsx"
click node_graph_ui "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/pages/KnowledgeGraph.tsx"
click node_report_ui "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/pages/AIReport.tsx"
click node_auth_ui "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/pages/Login.tsx"
click node_api_client "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/services/api.ts"
click node_document_routes "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/routes/documents.routes.ts"
click node_folder_routes "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/routes/folders.routes.ts"
click node_ai_routes "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/routes/ai.routes.ts"
click node_auth_routes "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/routes/auth.routes.ts"
click node_document_controller "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/controllers/DocumentController.ts"
click node_ai_controller "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/controllers/AIController.ts"
click node_auth_controller "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/controllers/AuthController.ts"
click node_folder_controller "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/controllers/FolderController.ts"
click node_auth_middleware "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/middleware/auth.ts"
click node_document_service "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/services/DocumentService.ts"
click node_ai_service "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/services/AIService.ts"
click node_auth_service "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/services/AuthService.ts"
click node_storage_service "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/services/StorageService.ts"
click node_database "https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/lib/prisma.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_documents_ui,node_folder_ui,node_dashboard_ui,node_chat_ui,node_graph_ui,node_report_ui,node_auth_ui,node_api_client,node_user toneBlue
class node_document_routes,node_folder_routes,node_ai_routes,node_auth_routes,node_document_controller,node_ai_controller,node_auth_controller,node_folder_controller,node_auth_middleware,node_supabase_storage toneAmber
class node_document_service,node_ai_service,node_auth_service,node_storage_service,node_nvidia toneMint
class node_database toneRose
```

## Components

### Web application

- [App routes](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Document workspace](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/pages/Documents.tsx): `frontend/src/pages/Documents.tsx`
- [Folder views](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/pages/Folders.tsx): `frontend/src/pages/Folders.tsx`
- [Dashboard](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [AI chat](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/pages/Chat.tsx): `frontend/src/pages/Chat.tsx`
- [Knowledge graph](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/pages/KnowledgeGraph.tsx): `frontend/src/pages/KnowledgeGraph.tsx`
- [AI reports](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/pages/AIReport.tsx): `frontend/src/pages/AIReport.tsx`
- [Sign in/up](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/pages/Login.tsx): `frontend/src/pages/Login.tsx`
- [API client](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### Backend API

- [Document routes](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/routes/documents.routes.ts): `backend/src/routes/documents.routes.ts`
- [Folder routes](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/routes/folders.routes.ts): `backend/src/routes/folders.routes.ts`
- [AI routes](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/routes/ai.routes.ts): `backend/src/routes/ai.routes.ts`
- [Auth routes](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/routes/auth.routes.ts): `backend/src/routes/auth.routes.ts`
- [Document handlers](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/controllers/DocumentController.ts): `backend/src/controllers/DocumentController.ts`
- [AI handlers](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/controllers/AIController.ts): `backend/src/controllers/AIController.ts`
- [Auth handlers](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/controllers/AuthController.ts): `backend/src/controllers/AuthController.ts`
- [Folder handlers](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/controllers/FolderController.ts): `backend/src/controllers/FolderController.ts`
- [JWT authentication](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/middleware/auth.ts): `backend/src/middleware/auth.ts`

### Domain services

- [Document processing](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/services/DocumentService.ts): `backend/src/services/DocumentService.ts`
- [AI capabilities](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/services/AIService.ts): `backend/src/services/AIService.ts`
- [Identity service](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/services/AuthService.ts): `backend/src/services/AuthService.ts`
- [File storage](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/services/StorageService.ts): `backend/src/services/StorageService.ts`

### Persistence

- [Supabase PostgreSQL](https://github.com/balamanikantatirunagaram-lgtm/docmind-ai/blob/main/backend/src/lib/prisma.ts): `backend/src/lib/prisma.ts`

### Other components

- **User**
- **NVIDIA AI API**
- **Supabase Storage**

## Connections

- User → App routes: uses (evidence: `frontend/src/App.tsx`)
- App routes → Document workspace: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Folder views: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Dashboard: routes to (evidence: `frontend/src/App.tsx`)
- App routes → AI chat: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Knowledge graph: routes to (evidence: `frontend/src/App.tsx`)
- App routes → AI reports: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Sign in/up: routes to (evidence: `frontend/src/App.tsx`)
- Document workspace → API client: calls (evidence: `frontend/src/pages/Documents.tsx`)
- Folder views → API client: calls (evidence: `frontend/src/pages/Folders.tsx`)
- Dashboard → API client: calls (evidence: `frontend/src/pages/Dashboard.tsx`)
- AI chat → API client: calls (evidence: `frontend/src/pages/Chat.tsx`)
- Knowledge graph → API client: calls (evidence: `frontend/src/pages/KnowledgeGraph.tsx`)
- AI reports → API client: calls (evidence: `frontend/src/pages/AIReport.tsx`)
- Sign in/up → API client: calls (evidence: `frontend/src/pages/Login.tsx`)
- API client → Document routes: requests
- API client → Folder routes: requests
- API client → AI routes: requests
- API client → Auth routes: requests
- Document routes → Document handlers: dispatches (evidence: `backend/src/routes/documents.routes.ts`)
- Folder routes → Folder handlers: dispatches (evidence: `backend/src/routes/folders.routes.ts`)
- AI routes → AI handlers: dispatches (evidence: `backend/src/routes/ai.routes.ts`)
- Auth routes → Auth handlers: dispatches (evidence: `backend/src/routes/auth.routes.ts`)
- Document routes → JWT authentication: authenticates (evidence: `backend/src/routes/documents.routes.ts`)
- Folder routes → JWT authentication: authenticates (evidence: `backend/src/routes/folders.routes.ts`)
- AI routes → JWT authentication: authenticates (evidence: `backend/src/routes/ai.routes.ts`)
- Document handlers → Document processing: delegates (evidence: `backend/src/controllers/DocumentController.ts`)
- AI handlers → AI capabilities: calls (evidence: `backend/src/controllers/AIController.ts`)
- Auth handlers → Identity service: delegates (evidence: `backend/src/controllers/AuthController.ts`)
- Document processing → File storage: stores files (evidence: `backend/src/services/DocumentService.ts`)
- Document processing → AI capabilities: processes with (evidence: `backend/src/services/DocumentService.ts`)
- Document processing → Supabase PostgreSQL: reads/writes (evidence: `backend/src/services/DocumentService.ts`)
- Identity service → Supabase PostgreSQL: reads/writes (evidence: `backend/src/services/AuthService.ts`)
- AI handlers → Supabase PostgreSQL: reads/writes (evidence: `backend/src/controllers/AIController.ts`)
- File storage → Supabase Storage: uploads/deletes (evidence: `backend/src/services/StorageService.ts`)
- AI capabilities → NVIDIA AI API: AI requests (evidence: `README.md`)
