# rahul-at-dev/ragging-document_chat_platform architecture

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

- Interactive diagram: https://gitdiagram.com/rahul-at-dev/ragging-document_chat_platform
- Repository: https://github.com/rahul-at-dev/ragging-document_chat_platform

## Overview

RAGGING lets anonymous users upload PDF/DOCX files, then chat with or summarize them, optionally adding web research. The main flow runs from the browser workspace through the API controller, which coordinates parsing, chunking, temporary session storage, retrieval, and model calls; answers and citations return to the workspace for display. The README also documents multi-document support, model selection, and page-linked PDF citations. Some service internals were not excerpted, so their connections are shown only where the source index or README supports them.

Main entry points: [`server/src/controllers/apiControllers.ts`](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/controllers/apiControllers.ts) (API controllers), [`client/src/pages/WorkspacePage.tsx`](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/pages/WorkspacePage.tsx) (Workspace page), [`client/src/components/ChatPanel.tsx`](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/components/ChatPanel.tsx) (Chat panel), [`client/src/services/api.ts`](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/services/api.ts) (HTTP API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Workspace client"]
  node_landing["Landing page<br/>[LandingPage.tsx]"]
  node_workspace["Workspace page<br/>[WorkspacePage.tsx]"]
  node_upload["Upload interface<br/>[UploadZone.tsx]"]
  node_chat["Chat panel<br/>[ChatPanel.tsx]"]
  node_viewer["Document viewers<br/>[PdfViewer.tsx]"]
  node_sources["Citation display<br/>[SourcesPanel.tsx]"]
  node_summaryui["Summary display<br/>[SummaryPanel.tsx]"]
  node_state["Workspace state"]
  node_clientapi["HTTP API client<br/>[api.ts]"]
end

subgraph group_api["API orchestration"]
  node_serverapp["Express app<br/>[app.ts]"]
  node_routes["API routes<br/>[api.ts]"]
  node_controller["API controllers<br/>[apiControllers.ts]"]
  node_uploadmw["Upload middleware<br/>[upload.ts]"]
end

subgraph group_documents["Document and session"]
  node_sessionstore[("RAM session store<br/>[store.ts]")]
  node_pdfparse["PDF extraction<br/>[pdfParser.ts]"]
  node_docxparse["DOCX extraction<br/>[docxParser.ts]"]
  node_chunker["Text chunking<br/>[chunker.ts]"]
end

subgraph group_intelligence["AI and research"]
  node_retrieval["Chunk retrieval<br/>[retrieval.ts]"]
  node_querygen["Search query builder<br/>[queryGenerator.ts]"]
  node_tavily["Web search<br/>[tavilyService.ts]"]
  node_openrouter["AI gateway<br/>[openRouter.ts]"]
  node_models["Model catalog<br/>[models.ts]"]
end

node_user(("User"))
node_openrouterext{{"OpenRouter service"}}
node_tavilyext{{"Tavily service"}}

node_user -->|"opens"| node_landing
node_user -->|"uses"| node_workspace
node_landing -->|"renders"| node_upload
node_landing -->|"fetches models"| node_clientapi
node_workspace -->|"loads workspace"| node_clientapi
node_workspace -->|"updates"| node_state
node_workspace -->|"renders"| node_chat
node_workspace -->|"renders"| node_viewer
node_upload -->|"uploads files"| node_clientapi
node_upload -->|"updates progress"| node_state
node_chat -->|"sends questions"| node_clientapi
node_chat -->|"reads and updates"| node_state
node_chat -->|"renders"| node_sources
node_chat -->|"renders"| node_summaryui
node_viewer -->|"reads citation page"| node_state
node_clientapi -->|"HTTP requests"| node_serverapp
node_serverapp -->|"mounts API"| node_routes
node_routes -->|"uses upload handling"| node_uploadmw
node_routes -->|"dispatches"| node_controller
node_controller -->|"reads and writes"| node_sessionstore
node_controller -->|"extracts PDF text"| node_pdfparse
node_controller -->|"extracts DOCX text"| node_docxparse
node_controller -->|"chunks text"| node_chunker
node_controller -->|"retrieves context"| node_retrieval
node_controller -->|"builds search query"| node_querygen
node_controller -->|"requests web results"| node_tavily
node_controller -->|"requests answers and summaries"| node_openrouter
node_controller -->|"selects configured model"| node_models
node_openrouter -->|"calls"| node_openrouterext
node_tavily -.->|"searches"| node_tavilyext

click node_landing "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/pages/LandingPage.tsx"
click node_workspace "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/pages/WorkspacePage.tsx"
click node_upload "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/components/UploadZone.tsx"
click node_chat "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/components/ChatPanel.tsx"
click node_viewer "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/components/PdfViewer.tsx"
click node_sources "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/components/SourcesPanel.tsx"
click node_summaryui "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/components/SummaryPanel.tsx"
click node_state "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/store/useWorkspaceStore.ts"
click node_clientapi "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/services/api.ts"
click node_serverapp "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/app.ts"
click node_routes "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/routes/api.ts"
click node_controller "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/controllers/apiControllers.ts"
click node_uploadmw "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/middleware/upload.ts"
click node_sessionstore "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/services/store.ts"
click node_pdfparse "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/services/pdfParser.ts"
click node_docxparse "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/services/docxParser.ts"
click node_chunker "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/services/chunker.ts"
click node_retrieval "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/services/retrieval.ts"
click node_querygen "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/services/queryGenerator.ts"
click node_tavily "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/services/tavilyService.ts"
click node_openrouter "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/services/openRouter.ts"
click node_models "https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/config/models.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_landing,node_workspace,node_upload,node_chat,node_viewer,node_sources,node_summaryui,node_state,node_clientapi,node_user toneBlue
class node_serverapp,node_routes,node_controller,node_uploadmw toneAmber
class node_sessionstore,node_pdfparse,node_docxparse,node_chunker,node_openrouterext toneMint
class node_retrieval,node_querygen,node_tavily,node_openrouter,node_models toneRose
class node_tavilyext toneIndigo
```

## Components

### Workspace client

- [Landing page](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/pages/LandingPage.tsx): `client/src/pages/LandingPage.tsx`
- [Workspace page](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/pages/WorkspacePage.tsx): `client/src/pages/WorkspacePage.tsx`
- [Upload interface](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/components/UploadZone.tsx): `client/src/components/UploadZone.tsx`
- [Chat panel](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/components/ChatPanel.tsx): `client/src/components/ChatPanel.tsx`
- [Document viewers](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/components/PdfViewer.tsx): `client/src/components/PdfViewer.tsx`
- [Citation display](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/components/SourcesPanel.tsx): `client/src/components/SourcesPanel.tsx`
- [Summary display](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/components/SummaryPanel.tsx): `client/src/components/SummaryPanel.tsx`
- [Workspace state](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/store/useWorkspaceStore.ts): `client/src/store/useWorkspaceStore.ts`
- [HTTP API client](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/client/src/services/api.ts): `client/src/services/api.ts`

### API orchestration

- [Express app](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/app.ts): `server/src/app.ts`
- [API routes](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/routes/api.ts): `server/src/routes/api.ts`
- [API controllers](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/controllers/apiControllers.ts): `server/src/controllers/apiControllers.ts`
- [Upload middleware](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/middleware/upload.ts): `server/src/middleware/upload.ts`

### Document and session

- [RAM session store](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/services/store.ts): `server/src/services/store.ts`
- [PDF extraction](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/services/pdfParser.ts): `server/src/services/pdfParser.ts`
- [DOCX extraction](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/services/docxParser.ts): `server/src/services/docxParser.ts`
- [Text chunking](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/services/chunker.ts): `server/src/services/chunker.ts`

### AI and research

- [Chunk retrieval](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/services/retrieval.ts): `server/src/services/retrieval.ts`
- [Search query builder](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/services/queryGenerator.ts): `server/src/services/queryGenerator.ts`
- [Web search](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/services/tavilyService.ts): `server/src/services/tavilyService.ts`
- [AI gateway](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/services/openRouter.ts): `server/src/services/openRouter.ts`
- [Model catalog](https://github.com/rahul-at-dev/ragging-document_chat_platform/blob/main/server/src/config/models.ts): `server/src/config/models.ts`

### Other components

- **User**
- **OpenRouter service**
- **Tavily service**

## Connections

- User → Landing page: opens
- User → Workspace page: uses
- Landing page → Upload interface: renders (evidence: `client/src/pages/LandingPage.tsx`)
- Landing page → HTTP API client: fetches models (evidence: `client/src/pages/LandingPage.tsx`)
- Workspace page → HTTP API client: loads workspace (evidence: `client/src/pages/WorkspacePage.tsx`)
- Workspace page → Workspace state: updates (evidence: `client/src/pages/WorkspacePage.tsx`)
- Workspace page → Chat panel: renders (evidence: `client/src/pages/WorkspacePage.tsx`)
- Workspace page → Document viewers: renders (evidence: `client/src/pages/WorkspacePage.tsx`)
- Upload interface → HTTP API client: uploads files (evidence: `client/src/components/UploadZone.tsx`)
- Upload interface → Workspace state: updates progress (evidence: `client/src/components/UploadZone.tsx`)
- Chat panel → HTTP API client: sends questions (evidence: `client/src/components/ChatPanel.tsx`)
- Chat panel → Workspace state: reads and updates (evidence: `client/src/components/ChatPanel.tsx`)
- Chat panel → Citation display: renders (evidence: `client/src/components/ChatPanel.tsx`)
- Chat panel → Summary display: renders (evidence: `client/src/components/ChatPanel.tsx`)
- Document viewers → Workspace state: reads citation page (evidence: `client/src/components/PdfViewer.tsx`)
- HTTP API client → Express app: HTTP requests (evidence: `client/src/services/api.ts`)
- Express app → API routes: mounts API (evidence: `server/src/app.ts`)
- API routes → Upload middleware: uses upload handling (evidence: `server/src/routes/api.ts`)
- API routes → API controllers: dispatches (evidence: `server/src/routes/api.ts`)
- API controllers → RAM session store: reads and writes (evidence: `server/src/controllers/apiControllers.ts`)
- API controllers → PDF extraction: extracts PDF text (evidence: `server/src/controllers/apiControllers.ts`)
- API controllers → DOCX extraction: extracts DOCX text (evidence: `server/src/controllers/apiControllers.ts`)
- API controllers → Text chunking: chunks text (evidence: `server/src/controllers/apiControllers.ts`)
- API controllers → Chunk retrieval: retrieves context (evidence: `server/src/controllers/apiControllers.ts`)
- API controllers → Search query builder: builds search query (evidence: `server/src/controllers/apiControllers.ts`)
- API controllers → Web search: requests web results (evidence: `server/src/controllers/apiControllers.ts`)
- API controllers → AI gateway: requests answers and summaries (evidence: `server/src/controllers/apiControllers.ts`)
- API controllers → Model catalog: selects configured model (evidence: `server/src/controllers/apiControllers.ts`)
- AI gateway → OpenRouter service: calls (evidence: `server/src/services/openRouter.ts`)
- Web search → Tavily service: searches
