# thakurveersinghdhillon-pixel/ragforge architecture

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

- Interactive diagram: https://gitdiagram.com/thakurveersinghdhillon-pixel/ragforge
- Repository: https://github.com/thakurveersinghdhillon-pixel/ragforge

## Overview

RAGForge is a multi-tenant RAG search and research platform. Users select a workspace, upload documents for indexing, then search or chat against that workspace; the backend retrieves and generates answers, with optional reranking, compression, and verification. The product also exposes workspace management, analytics, evaluation, experiments, and research features. The graph combines README-documented pipeline stages with source-index-supported module relationships; unsampled implementation details and some internal call edges are omitted rather than inferred.

Main entry points: [`backend/app/rag/service.py`](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/rag/service.py) (RAG service), [`frontend/src/components/layout/AppShell.tsx`](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/frontend/src/components/layout/AppShell.tsx) (App shell), [`backend/app/api/v1/router.py`](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/api/v1/router.py) (API router), [`backend/app/services/ingestion_service.py`](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/services/ingestion_service.py) (Document ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_webshell["App shell<br/>[AppShell.tsx]"]
  node_workspacecontext["Workspace context"]
  node_searchpage["Search page<br/>[page.tsx]"]
  node_docspage["Documents page<br/>[page.tsx]"]
  node_webservices["Web API clients<br/>[rag.ts]"]
  node_evalui["Evaluation dashboard<br/>[page.tsx]"]
end

subgraph group_api["Backend API"]
  node_apirouter["API router<br/>[router.py]"]
end

subgraph group_rag["RAG pipeline"]
  node_ragservice["RAG service<br/>[service.py]"]
  node_retrieval["Retrieval strategies"]
  node_adaptive["Adaptive routing"]
  node_advanced["Advanced query processing<br/>[pipeline.py]"]
  node_reranking["Reranking"]
  node_compression["Context compression"]
  node_verification["Answer verification"]
  node_llm["LLM providers<br/>[factory.py]"]
end

subgraph group_content["Workspace content"]
  node_ingestion["Document ingestion"]
  node_storage["Upload storage<br/>[storage.py]"]
  node_docrepo["Document repository"]
  node_contentstore[("Workspace data<br/>[document.py]")]
end

subgraph group_research["Evaluation and research"]
  node_querylogs[("Query logs<br/>[query_log.py]")]
  node_evaluation["Evaluation runner<br/>[runner.py]"]
  node_analytics["Analytics and research"]
end

node_user(("User"))

node_user -->|"uses"| node_webshell
node_webshell -->|"reads workspace"| node_workspacecontext
node_webshell -->|"hosts"| node_searchpage
node_webshell -->|"hosts"| node_docspage
node_searchpage -->|"requests search"| node_webservices
node_docspage -->|"requests documents"| node_webservices
node_webservices -.->|"calls API"| node_apirouter
node_apirouter -.->|"routes documents"| node_ingestion
node_ingestion -->|"saves uploads"| node_storage
node_ingestion -->|"creates records"| node_docrepo
node_docrepo -.->|"persists documents"| node_contentstore
node_apirouter -.->|"routes RAG requests"| node_ragservice
node_user -->|"submits query"| node_searchpage
node_ragservice -->|"retrieves passages"| node_retrieval
node_ragservice -->|"routes query"| node_adaptive
node_ragservice -->|"reranks results"| node_reranking
node_ragservice -->|"compresses context"| node_compression
node_ragservice -->|"generates answer"| node_llm
node_ragservice -->|"verifies answer"| node_verification
node_ragservice -.->|"uses optional processing"| node_advanced
node_ragservice -.->|"records query metrics"| node_querylogs
node_user -->|"runs evaluations"| node_evalui
node_evalui -.->|"configures evaluation"| node_evaluation
node_user -->|"reviews insights"| node_analytics

click node_webshell "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/frontend/src/components/layout/AppShell.tsx"
click node_workspacecontext "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/frontend/src/context/WorkspaceContext.tsx"
click node_searchpage "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/frontend/src/app/search/page.tsx"
click node_docspage "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/frontend/src/app/documents/page.tsx"
click node_webservices "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/frontend/src/services/rag.ts"
click node_apirouter "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/api/v1/router.py"
click node_ingestion "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/services/ingestion_service.py"
click node_storage "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/services/storage.py"
click node_docrepo "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/repositories/document_repository.py"
click node_contentstore "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/models/document.py"
click node_ragservice "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/rag/service.py"
click node_retrieval "https://github.com/thakurveersinghdhillon-pixel/ragforge/tree/main/backend/app/rag/retrieval"
click node_adaptive "https://github.com/thakurveersinghdhillon-pixel/ragforge/tree/main/backend/app/rag/adaptive"
click node_advanced "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/rag/advanced/pipeline.py"
click node_reranking "https://github.com/thakurveersinghdhillon-pixel/ragforge/tree/main/backend/app/rag/reranking"
click node_compression "https://github.com/thakurveersinghdhillon-pixel/ragforge/tree/main/backend/app/rag/compression"
click node_verification "https://github.com/thakurveersinghdhillon-pixel/ragforge/tree/main/backend/app/rag/verification"
click node_llm "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/providers/llm/factory.py"
click node_querylogs "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/models/query_log.py"
click node_evaluation "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/evaluation/runner.py"
click node_analytics "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/services/analytics_service.py"
click node_evalui "https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/frontend/src/app/evaluation/page.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_webshell,node_workspacecontext,node_searchpage,node_docspage,node_webservices,node_evalui,node_user toneBlue
class node_apirouter toneAmber
class node_ragservice,node_retrieval,node_adaptive,node_advanced,node_reranking,node_compression,node_verification,node_llm toneMint
class node_ingestion,node_storage,node_docrepo,node_contentstore toneRose
class node_querylogs,node_evaluation,node_analytics toneIndigo
```

## Components

### Web application

- [App shell](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/frontend/src/components/layout/AppShell.tsx): `frontend/src/components/layout/AppShell.tsx`
- [Workspace context](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/frontend/src/context/WorkspaceContext.tsx): `frontend/src/context/WorkspaceContext.tsx`
- [Search page](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/frontend/src/app/search/page.tsx): `frontend/src/app/search/page.tsx`
- [Documents page](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/frontend/src/app/documents/page.tsx): `frontend/src/app/documents/page.tsx`
- [Web API clients](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/frontend/src/services/rag.ts): `frontend/src/services/rag.ts`
- [Evaluation dashboard](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/frontend/src/app/evaluation/page.tsx): `frontend/src/app/evaluation/page.tsx`

### Backend API

- [API router](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/api/v1/router.py): `backend/app/api/v1/router.py`

### RAG pipeline

- [RAG service](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/rag/service.py): `backend/app/rag/service.py`
- [Retrieval strategies](https://github.com/thakurveersinghdhillon-pixel/ragforge/tree/main/backend/app/rag/retrieval): `backend/app/rag/retrieval`
- [Adaptive routing](https://github.com/thakurveersinghdhillon-pixel/ragforge/tree/main/backend/app/rag/adaptive): `backend/app/rag/adaptive`
- [Advanced query processing](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/rag/advanced/pipeline.py): `backend/app/rag/advanced/pipeline.py`
- [Reranking](https://github.com/thakurveersinghdhillon-pixel/ragforge/tree/main/backend/app/rag/reranking): `backend/app/rag/reranking`
- [Context compression](https://github.com/thakurveersinghdhillon-pixel/ragforge/tree/main/backend/app/rag/compression): `backend/app/rag/compression`
- [Answer verification](https://github.com/thakurveersinghdhillon-pixel/ragforge/tree/main/backend/app/rag/verification): `backend/app/rag/verification`
- [LLM providers](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/providers/llm/factory.py): `backend/app/providers/llm/factory.py`

### Workspace content

- [Document ingestion](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/services/ingestion_service.py): `backend/app/services/ingestion_service.py`
- [Upload storage](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/services/storage.py): `backend/app/services/storage.py`
- [Document repository](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/repositories/document_repository.py): `backend/app/repositories/document_repository.py`
- [Workspace data](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/models/document.py): `backend/app/models/document.py`

### Evaluation and research

- [Query logs](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/models/query_log.py): `backend/app/models/query_log.py`
- [Evaluation runner](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/evaluation/runner.py): `backend/app/evaluation/runner.py`
- [Analytics and research](https://github.com/thakurveersinghdhillon-pixel/ragforge/blob/main/backend/app/services/analytics_service.py): `backend/app/services/analytics_service.py`

### Other components

- **User**

## Connections

- User → App shell: uses (evidence: `README.md`)
- App shell → Workspace context: reads workspace (evidence: `frontend/src/components/layout/AppShell.tsx`)
- App shell → Search page: hosts (evidence: `frontend/src/app/search/page.tsx`)
- App shell → Documents page: hosts (evidence: `frontend/src/app/documents/page.tsx`)
- Search page → Web API clients: requests search (evidence: `frontend/src/app/search/page.tsx`)
- Documents page → Web API clients: requests documents (evidence: `frontend/src/app/documents/page.tsx`)
- Web API clients → API router: calls API
- API router → Document ingestion: routes documents
- Document ingestion → Upload storage: saves uploads (evidence: `backend/app/services/ingestion_service.py`)
- Document ingestion → Document repository: creates records (evidence: `backend/app/services/ingestion_service.py`)
- Document repository → Workspace data: persists documents (evidence: `backend/app/repositories/document_repository.py`)
- API router → RAG service: routes RAG requests
- User → Search page: submits query (evidence: `README.md`)
- RAG service → Retrieval strategies: retrieves passages (evidence: `README.md`)
- RAG service → Adaptive routing: routes query (evidence: `README.md`)
- RAG service → Reranking: reranks results (evidence: `README.md`)
- RAG service → Context compression: compresses context (evidence: `README.md`)
- RAG service → LLM providers: generates answer (evidence: `README.md`)
- RAG service → Answer verification: verifies answer (evidence: `README.md`)
- RAG service → Advanced query processing: uses optional processing (evidence: `backend/app/rag/service.py`)
- RAG service → Query logs: records query metrics (evidence: `backend/app/rag/service.py`)
- User → Evaluation dashboard: runs evaluations (evidence: `README.md`)
- Evaluation dashboard → Evaluation runner: configures evaluation
- User → Analytics and research: reviews insights (evidence: `README.md`)
