# veerasairakeshpasupuleti/rag-knowledge-hub architecture

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

- Interactive diagram: https://gitdiagram.com/veerasairakeshpasupuleti/rag-knowledge-hub
- Repository: https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub

## Overview

RAG Knowledge Hub combines a Java API for users, collections, documents, and conversations with a Python retrieval-augmented generation service. The main content workflow is document upload and indexing, followed by collection-scoped question answering that returns an answer and mapped sources. The graph preserves authentication and collection/chat management as separate product branches. Several implementation files are not sampled, so links involving those implementations are omitted; the README offers no additional capability details.

Main entry points: [`ai-service/app/dependencies/services.py`](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/dependencies/services.py) (AI service wiring), [`ai-service/app/services/indexing_service.py`](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/services/indexing_service.py) (Document indexing), [`ai-service/app/services/query_service.py`](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/services/query_service.py) (Question service), [`backend/rag-ui/src/main/java/com/raghub/ragapi/service/impl/AuthService.java`](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/service/impl/AuthService.java) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Java API"]
  node_chat_api["Chat endpoints"]
  node_chat_service["Chat operations<br/>[ChatService.java]"]
  node_collection_api["Collection endpoints"]
  node_collection_service["Collection operations"]
end

subgraph group_content["Document management"]
  node_document_api["Document endpoints"]
  node_document_service["Document operations"]
  node_storage["File storage"]
  node_indexing["Document indexing"]
  node_loaders["Format loaders<br/>[loader_factory.py]"]
end

subgraph group_rag["AI retrieval and generation"]
  node_chunking["Text chunking"]
  node_embedding["Embedding generation"]
  node_vectorstore[("Vector search<br/>[chroma_service.py]")]
  node_query["Question service<br/>[query_service.py]"]
  node_rag_graph["RAG workflow<br/>[rag_graph.py]"]
  node_rag_nodes["Retrieval and answer nodes<br/>[rag_nodes.py]"]
  node_dependencies["AI service wiring<br/>[services.py]"]
  node_prompt["Prompt construction<br/>[prompt_builder.py]"]
  node_llm["Language model"]
  node_source_mapper["Source mapping<br/>[source_mapper.py]"]
end

subgraph group_identity["Authentication"]
  node_auth_service["Authentication<br/>[AuthService.java]"]
  node_users[("User records")]
  node_jwt["JWT creation<br/>[JwtService.java]"]
end

node_user(("User"))

node_user -->|"sends requests"| node_chat_api
node_chat_api -->|"delegates chat"| node_chat_service
node_user -->|"uploads documents"| node_document_api
node_document_api -->|"delegates document work"| node_document_service
node_indexing -->|"selects loaders"| node_loaders
node_indexing -->|"uses AI services"| node_dependencies
node_dependencies -->|"constructs service"| node_chunking
node_dependencies -->|"constructs service"| node_embedding
node_dependencies -->|"constructs service"| node_vectorstore
node_dependencies -->|"constructs builder"| node_prompt
node_dependencies -->|"constructs service"| node_llm
node_query -->|"invokes workflow"| node_rag_graph
node_query -->|"maps sources"| node_source_mapper
node_rag_nodes -->|"uses services"| node_dependencies
node_auth_service -->|"reads and saves users"| node_users
node_auth_service -->|"generates token"| node_jwt

click node_chat_api "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/controllers/ChatController.java"
click node_chat_service "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/service/ChatService.java"
click node_collection_api "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/controllers/CollectionController.java"
click node_collection_service "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/service/CollectionService.java"
click node_document_api "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/controllers/DocumentController.java"
click node_document_service "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/service/DocumentService.java"
click node_storage "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/service/StorageService.java"
click node_indexing "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/services/indexing_service.py"
click node_loaders "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/loaders/loader_factory.py"
click node_chunking "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/chunking/chunking_service.py"
click node_embedding "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/embeddings/embedding_service.py"
click node_vectorstore "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/vectorstore/chroma_service.py"
click node_query "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/services/query_service.py"
click node_rag_graph "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/graph/rag_graph.py"
click node_rag_nodes "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/graph/rag_nodes.py"
click node_dependencies "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/dependencies/services.py"
click node_prompt "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/prompt/prompt_builder.py"
click node_llm "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/llm/chatgroq_service.py"
click node_source_mapper "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/mapper/source_mapper.py"
click node_auth_service "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/service/impl/AuthService.java"
click node_users "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/repository/UserRepository.java"
click node_jwt "https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/service/impl/JwtService.java"

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_chat_api,node_chat_service,node_collection_api,node_collection_service,node_user toneBlue
class node_document_api,node_document_service,node_storage,node_indexing,node_loaders toneAmber
class node_chunking,node_embedding,node_vectorstore,node_query,node_rag_graph,node_rag_nodes,node_dependencies,node_prompt,node_llm,node_source_mapper toneMint
class node_auth_service,node_users,node_jwt toneRose
```

## Components

### Java API

- [Chat endpoints](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/controllers/ChatController.java): `backend/rag-ui/src/main/java/com/raghub/ragapi/controllers/ChatController.java`
- [Chat operations](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/service/ChatService.java): `backend/rag-ui/src/main/java/com/raghub/ragapi/service/ChatService.java`
- [Collection endpoints](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/controllers/CollectionController.java): `backend/rag-ui/src/main/java/com/raghub/ragapi/controllers/CollectionController.java`
- [Collection operations](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/service/CollectionService.java): `backend/rag-ui/src/main/java/com/raghub/ragapi/service/CollectionService.java`

### Document management

- [Document endpoints](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/controllers/DocumentController.java): `backend/rag-ui/src/main/java/com/raghub/ragapi/controllers/DocumentController.java`
- [Document operations](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/service/DocumentService.java): `backend/rag-ui/src/main/java/com/raghub/ragapi/service/DocumentService.java`
- [File storage](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/service/StorageService.java): `backend/rag-ui/src/main/java/com/raghub/ragapi/service/StorageService.java`
- [Document indexing](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/services/indexing_service.py): `ai-service/app/services/indexing_service.py`
- [Format loaders](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/loaders/loader_factory.py): `ai-service/app/loaders/loader_factory.py`

### AI retrieval and generation

- [Text chunking](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/chunking/chunking_service.py): `ai-service/app/chunking/chunking_service.py`
- [Embedding generation](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/embeddings/embedding_service.py): `ai-service/app/embeddings/embedding_service.py`
- [Vector search](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/vectorstore/chroma_service.py): `ai-service/app/vectorstore/chroma_service.py`
- [Question service](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/services/query_service.py): `ai-service/app/services/query_service.py`
- [RAG workflow](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/graph/rag_graph.py): `ai-service/app/graph/rag_graph.py`
- [Retrieval and answer nodes](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/graph/rag_nodes.py): `ai-service/app/graph/rag_nodes.py`
- [AI service wiring](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/dependencies/services.py): `ai-service/app/dependencies/services.py`
- [Prompt construction](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/prompt/prompt_builder.py): `ai-service/app/prompt/prompt_builder.py`
- [Language model](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/llm/chatgroq_service.py): `ai-service/app/llm/chatgroq_service.py`
- [Source mapping](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/ai-service/app/mapper/source_mapper.py): `ai-service/app/mapper/source_mapper.py`

### Authentication

- [Authentication](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/service/impl/AuthService.java): `backend/rag-ui/src/main/java/com/raghub/ragapi/service/impl/AuthService.java`
- [User records](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/repository/UserRepository.java): `backend/rag-ui/src/main/java/com/raghub/ragapi/repository/UserRepository.java`
- [JWT creation](https://github.com/veerasairakeshpasupuleti/rag-knowledge-hub/blob/main/backend/rag-ui/src/main/java/com/raghub/ragapi/service/impl/JwtService.java): `backend/rag-ui/src/main/java/com/raghub/ragapi/service/impl/JwtService.java`

### Other components

- **User**

## Connections

- User → Chat endpoints: sends requests (evidence: `backend/rag-ui/src/main/java/com/raghub/ragapi/controllers/ChatController.java`)
- Chat endpoints → Chat operations: delegates chat (evidence: `backend/rag-ui/src/main/java/com/raghub/ragapi/controllers/ChatController.java`)
- User → Document endpoints: uploads documents (evidence: `backend/rag-ui/src/main/java/com/raghub/ragapi/controllers/DocumentController.java`)
- Document endpoints → Document operations: delegates document work (evidence: `backend/rag-ui/src/main/java/com/raghub/ragapi/controllers/DocumentController.java`)
- Document indexing → Format loaders: selects loaders (evidence: `ai-service/app/services/indexing_service.py`)
- Document indexing → AI service wiring: uses AI services (evidence: `ai-service/app/services/indexing_service.py`)
- AI service wiring → Text chunking: constructs service (evidence: `ai-service/app/dependencies/services.py`)
- AI service wiring → Embedding generation: constructs service (evidence: `ai-service/app/dependencies/services.py`)
- AI service wiring → Vector search: constructs service (evidence: `ai-service/app/dependencies/services.py`)
- AI service wiring → Prompt construction: constructs builder (evidence: `ai-service/app/dependencies/services.py`)
- AI service wiring → Language model: constructs service (evidence: `ai-service/app/dependencies/services.py`)
- Question service → RAG workflow: invokes workflow (evidence: `ai-service/app/services/query_service.py`)
- Question service → Source mapping: maps sources (evidence: `ai-service/app/services/query_service.py`)
- Retrieval and answer nodes → AI service wiring: uses services (evidence: `ai-service/app/graph/rag_nodes.py`)
- Authentication → User records: reads and saves users (evidence: `backend/rag-ui/src/main/java/com/raghub/ragapi/service/impl/AuthService.java`)
- Authentication → JWT creation: generates token (evidence: `backend/rag-ui/src/main/java/com/raghub/ragapi/service/impl/AuthService.java`)
