# arpitkanani/rag-project_docmind architecture

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

- Interactive diagram: https://gitdiagram.com/arpitkanani/rag-project_docmind
- Repository: https://github.com/arpitkanani/rag-project_docmind

## Overview

DocuVortex is a document- and YouTube-aware RAG workspace. Users authenticate, upload files or submit video URLs, then query the resulting collections in persistent chat sessions; the backend retrieves context and returns grounded answers with citations. The graph preserves the documented ingestion, agentic query, authentication, collection, and session capabilities. Some routes and graph nodes are unsampled, so only README- or index-supported connections are shown; optional provider links are marked unverified.

Main entry points: [`app.py`](https://github.com/arpitkanani/rag-project_docmind/blob/main/app.py) (FastAPI application), [`src/pipelines/ingestion_pipeline.py`](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/pipelines/ingestion_pipeline.py) (Ingestion pipeline), [`src/components/memory_manager.py`](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/components/memory_manager.py) (Chat memory and attachments), [`src/components/vector_store.py`](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/components/vector_store.py) (Qdrant vector store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and Web"]
  node_web["Web workspace<br/>[app_new.js]"]
  node_auth_ui["Web authentication<br/>[auth.js]"]
  node_app["FastAPI application<br/>[app.py]"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_upload["File upload routes<br/>[upload.py]"]
  node_youtube["YouTube routes<br/>[youtube.py]"]
  node_query["Query routes<br/>[query.py]"]
  node_sessions["Session routes<br/>[sessions.py]"]
  node_collections["Collection routes<br/>[collections.py]"]
end

subgraph group_ingest["Content Ingestion"]
  node_ingest_pipeline["Ingestion pipeline"]
  node_loader["Document and transcript loading<br/>[document_loader.py]"]
  node_splitter["Text chunking<br/>[text_splitter.py]"]
  node_file_helpers["File handling<br/>[file_helper.py]"]
  node_youtube_helpers["YouTube utilities<br/>[youtube_helper.py]"]
end

subgraph group_rag["Agentic RAG"]
  node_graph_builder["RAG graph<br/>[builder.py]"]
  node_agent_nodes["Agent workflow nodes<br/>[nodes_agentic.py]"]
  node_retrieve_node["Context retrieval node<br/>[retrieve.py]"]
  node_generate_node["Answer generation node<br/>[generate.py]"]
  node_qa_chain["Grounded answer and citations<br/>[qa_chain.py]"]
  node_retriever["Semantic retrieval and reranking<br/>[retriever.py]"]
  node_state_schema["RAG state schema<br/>[state.py]"]
  node_chitchat["Chitchat subgraph"]
end

subgraph group_state["Identity and State"]
  node_auth["API key and token resolver<br/>[auth.py]"]
  node_memory["Chat memory and attachments<br/>[memory_manager.py]"]
  node_db["Session and user database access<br/>[db.py]"]
end

subgraph group_infra["Shared Services"]
  node_qdrant[("Qdrant vector store<br/>[vector_store.py]")]
  node_embedder["Embedding provider<br/>[embedder.py]"]
end

node_user(("User or API client"))
node_postgres[("PostgreSQL")]
node_llm["LLM provider"]

node_user -->|"uses workspace"| node_web
node_user -->|"calls REST API"| node_app
node_web -->|"sends REST requests"| node_app
node_web -.->|"uses authentication"| node_auth_ui
node_app -->|"registers"| node_auth_routes
node_app -->|"registers"| node_upload
node_app -->|"registers"| node_youtube
node_app -->|"registers"| node_query
node_app -->|"registers"| node_sessions
node_app -->|"registers"| node_collections
node_auth_routes -->|"validates credentials"| node_auth
node_auth -->|"looks up users"| node_db
node_upload -->|"starts ingestion"| node_ingest_pipeline
node_youtube -->|"starts ingestion"| node_ingest_pipeline
node_ingest_pipeline -->|"loads source"| node_loader
node_ingest_pipeline -->|"chunks documents"| node_splitter
node_ingest_pipeline -->|"adds chunks"| node_qdrant
node_ingest_pipeline -->|"validates and saves files"| node_file_helpers
node_loader -->|"uses URL utilities"| node_youtube_helpers
node_qdrant -->|"creates embeddings"| node_embedder
node_query -->|"invokes graph"| node_graph_builder
node_graph_builder -->|"assembles workflow"| node_agent_nodes
node_graph_builder -->|"uses state"| node_state_schema
node_agent_nodes -->|"dispatches retrieval"| node_retrieve_node
node_agent_nodes -->|"dispatches chat"| node_chitchat
node_retrieve_node -->|"loads history"| node_memory
node_retrieve_node -->|"searches collections"| node_retriever
node_retriever -->|"searches vectors"| node_qdrant
node_generate_node -->|"uses answer helpers"| node_qa_chain
node_generate_node -->|"uses chat history"| node_memory
node_qa_chain -.->|"generates responses"| node_llm
node_sessions -->|"manages sessions"| node_memory
node_query -->|"manages conversation"| node_memory
node_memory -->|"reads and writes messages"| node_db
node_db -->|"queries"| node_postgres
node_collections -->|"manages collections"| node_qdrant

click node_web "https://github.com/arpitkanani/rag-project_docmind/blob/main/templates/static/js/app_new.js"
click node_auth_ui "https://github.com/arpitkanani/rag-project_docmind/blob/main/templates/static/js/auth.js"
click node_app "https://github.com/arpitkanani/rag-project_docmind/blob/main/app.py"
click node_auth_routes "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/routers/auth.py"
click node_upload "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/routers/upload.py"
click node_youtube "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/routers/youtube.py"
click node_query "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/routers/query.py"
click node_sessions "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/routers/sessions.py"
click node_collections "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/routers/collections.py"
click node_ingest_pipeline "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/pipelines/ingestion_pipeline.py"
click node_loader "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/components/document_loader.py"
click node_splitter "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/components/text_splitter.py"
click node_file_helpers "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/utils/file_helper.py"
click node_youtube_helpers "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/utils/youtube_helper.py"
click node_graph_builder "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/graph/builder.py"
click node_agent_nodes "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/graph/nodes_agentic.py"
click node_retrieve_node "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/graph/nodes/retrieve.py"
click node_generate_node "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/graph/nodes/generate.py"
click node_qa_chain "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/chains/qa_chain.py"
click node_retriever "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/components/retriever.py"
click node_state_schema "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/graph/state.py"
click node_chitchat "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/graph/chitchat_subgraph.py"
click node_auth "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/auth.py"
click node_memory "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/components/memory_manager.py"
click node_db "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/database/db.py"
click node_qdrant "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/components/vector_store.py"
click node_embedder "https://github.com/arpitkanani/rag-project_docmind/blob/main/src/components/embedder.py"

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_web,node_auth_ui,node_app,node_auth_routes,node_upload,node_youtube,node_query,node_sessions,node_collections,node_user toneBlue
class node_ingest_pipeline,node_loader,node_splitter,node_file_helpers,node_youtube_helpers,node_postgres toneAmber
class node_graph_builder,node_agent_nodes,node_retrieve_node,node_generate_node,node_qa_chain,node_retriever,node_state_schema,node_chitchat toneMint
class node_auth,node_memory,node_db toneRose
class node_qdrant,node_embedder,node_llm toneIndigo
```

## Components

### API and Web

- [Web workspace](https://github.com/arpitkanani/rag-project_docmind/blob/main/templates/static/js/app_new.js): `templates/static/js/app_new.js`
- [Web authentication](https://github.com/arpitkanani/rag-project_docmind/blob/main/templates/static/js/auth.js): `templates/static/js/auth.js`
- [FastAPI application](https://github.com/arpitkanani/rag-project_docmind/blob/main/app.py): `app.py`
- [Authentication routes](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/routers/auth.py): `src/routers/auth.py`
- [File upload routes](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/routers/upload.py): `src/routers/upload.py`
- [YouTube routes](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/routers/youtube.py): `src/routers/youtube.py`
- [Query routes](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/routers/query.py): `src/routers/query.py`
- [Session routes](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/routers/sessions.py): `src/routers/sessions.py`
- [Collection routes](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/routers/collections.py): `src/routers/collections.py`

### Content Ingestion

- [Ingestion pipeline](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/pipelines/ingestion_pipeline.py): `src/pipelines/ingestion_pipeline.py`
- [Document and transcript loading](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/components/document_loader.py): `src/components/document_loader.py`
- [Text chunking](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/components/text_splitter.py): `src/components/text_splitter.py`
- [File handling](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/utils/file_helper.py): `src/utils/file_helper.py`
- [YouTube utilities](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/utils/youtube_helper.py): `src/utils/youtube_helper.py`

### Agentic RAG

- [RAG graph](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/graph/builder.py): `src/graph/builder.py`
- [Agent workflow nodes](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/graph/nodes_agentic.py): `src/graph/nodes_agentic.py`
- [Context retrieval node](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/graph/nodes/retrieve.py): `src/graph/nodes/retrieve.py`
- [Answer generation node](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/graph/nodes/generate.py): `src/graph/nodes/generate.py`
- [Grounded answer and citations](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/chains/qa_chain.py): `src/chains/qa_chain.py`
- [Semantic retrieval and reranking](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/components/retriever.py): `src/components/retriever.py`
- [RAG state schema](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/graph/state.py): `src/graph/state.py`
- [Chitchat subgraph](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/graph/chitchat_subgraph.py): `src/graph/chitchat_subgraph.py`

### Identity and State

- [API key and token resolver](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/auth.py): `src/auth.py`
- [Chat memory and attachments](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/components/memory_manager.py): `src/components/memory_manager.py`
- [Session and user database access](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/database/db.py): `src/database/db.py`

### Shared Services

- [Qdrant vector store](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/components/vector_store.py): `src/components/vector_store.py`
- [Embedding provider](https://github.com/arpitkanani/rag-project_docmind/blob/main/src/components/embedder.py): `src/components/embedder.py`

### Other components

- **User or API client**
- **PostgreSQL**
- **LLM provider**

## Connections

- User or API client → Web workspace: uses workspace
- User or API client → FastAPI application: calls REST API
- Web workspace → FastAPI application: sends REST requests
- Web workspace → Web authentication: uses authentication
- FastAPI application → Authentication routes: registers (evidence: `app.py`)
- FastAPI application → File upload routes: registers (evidence: `app.py`)
- FastAPI application → YouTube routes: registers (evidence: `app.py`)
- FastAPI application → Query routes: registers (evidence: `app.py`)
- FastAPI application → Session routes: registers (evidence: `app.py`)
- FastAPI application → Collection routes: registers (evidence: `app.py`)
- Authentication routes → API key and token resolver: validates credentials (evidence: `src/routers/auth.py`)
- API key and token resolver → Session and user database access: looks up users (evidence: `src/auth.py`)
- File upload routes → Ingestion pipeline: starts ingestion (evidence: `src/routers/upload.py`)
- YouTube routes → Ingestion pipeline: starts ingestion (evidence: `src/routers/youtube.py`)
- Ingestion pipeline → Document and transcript loading: loads source (evidence: `src/pipelines/ingestion_pipeline.py`)
- Ingestion pipeline → Text chunking: chunks documents (evidence: `src/pipelines/ingestion_pipeline.py`)
- Ingestion pipeline → Qdrant vector store: adds chunks (evidence: `src/pipelines/ingestion_pipeline.py`)
- Ingestion pipeline → File handling: validates and saves files (evidence: `src/pipelines/ingestion_pipeline.py`)
- Document and transcript loading → YouTube utilities: uses URL utilities (evidence: `src/components/document_loader.py`)
- Qdrant vector store → Embedding provider: creates embeddings (evidence: `src/components/vector_store.py`)
- Query routes → RAG graph: invokes graph (evidence: `src/routers/query.py`)
- RAG graph → Agent workflow nodes: assembles workflow (evidence: `src/graph/builder.py`)
- RAG graph → RAG state schema: uses state (evidence: `src/graph/builder.py`)
- Agent workflow nodes → Context retrieval node: dispatches retrieval (evidence: `src/graph/builder.py`)
- Agent workflow nodes → Chitchat subgraph: dispatches chat (evidence: `src/graph/nodes_agentic.py`)
- Context retrieval node → Chat memory and attachments: loads history (evidence: `src/graph/nodes/retrieve.py`)
- Context retrieval node → Semantic retrieval and reranking: searches collections (evidence: `src/graph/nodes/retrieve.py`)
- Semantic retrieval and reranking → Qdrant vector store: searches vectors (evidence: `src/components/retriever.py`)
- Answer generation node → Grounded answer and citations: uses answer helpers (evidence: `src/graph/nodes/generate.py`)
- Answer generation node → Chat memory and attachments: uses chat history (evidence: `src/graph/nodes/generate.py`)
- Grounded answer and citations → LLM provider: generates responses
- Session routes → Chat memory and attachments: manages sessions (evidence: `src/routers/sessions.py`)
- Query routes → Chat memory and attachments: manages conversation (evidence: `src/routers/query.py`)
- Chat memory and attachments → Session and user database access: reads and writes messages (evidence: `src/components/memory_manager.py`)
- Session and user database access → PostgreSQL: queries
- Collection routes → Qdrant vector store: manages collections (evidence: `src/routers/collections.py`)
