# ajay-shekhawat-1/personal-rag architecture

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

- Interactive diagram: https://gitdiagram.com/ajay-shekhawat-1/personal-rag
- Repository: https://github.com/ajay-shekhawat-1/personal-rag

## Overview

Personal RAG is a document-grounded question-answering application. Users add PDF/DOCX files or website URLs, which the API extracts, chunks, embeds, and stores in Qdrant; they can manage indexed sources, search them, or ask questions answered by Groq using retrieved context. The frontend separates knowledge management from chat. The excerpts show the upload, search, and model-service flow, but the chat route and chat component were not excerpted, so some chat links remain unverified.

Main entry points: [`backend/app/routes/documents.py`](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/routes/documents.py) (Document routes), [`frontend/src/services/api.js`](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/frontend/src/services/api.js) (API client), [`backend/app/routes/chat.py`](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/routes/chat.py) (Chat route), [`backend/app/routes/search.py`](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/routes/search.py) (Search route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_app["App navigation<br/>[App.jsx]"]
  node_knowledge["Knowledge page<br/>[KnowledgePage.jsx]"]
  node_upload_ui["Upload sources<br/>[UploadDocument.jsx]"]
  node_document_ui["Document list<br/>[DocumentList.jsx]"]
  node_chat_page["Chat page<br/>[ChatPage.jsx]"]
  node_chat_ui["Chat interface<br/>[Chat.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["API routes"]
  node_fastapi["FastAPI app<br/>[main.py]"]
  node_documents_route["Document routes<br/>[documents.py]"]
  node_search_route["Search route<br/>[search.py]"]
  node_chat_route["Chat route<br/>[chat.py]"]
end

subgraph group_ingest["Knowledge ingestion"]
  node_document_extract["Text extraction"]
  node_chunking["Text chunking"]
end

subgraph group_retrieval["Retrieval and answers"]
  node_embedding["Embedding service"]
  node_qdrant[("Vector store<br/>[qdrant_service.py]")]
  node_llm["Answer generation<br/>[llm_service.py]"]
end

node_user(("User"))
node_groq{{"Groq model API"}}

node_user -->|"uses"| node_app
node_app -->|"shows"| node_knowledge
node_app -->|"shows"| node_chat_page
node_knowledge -->|"renders"| node_upload_ui
node_knowledge -->|"renders"| node_document_ui
node_chat_page -->|"renders"| node_chat_ui
node_upload_ui -->|"calls"| node_api_client
node_document_ui -->|"calls"| node_api_client
node_chat_ui -.->|"calls"| node_api_client
node_api_client -->|"HTTP requests"| node_documents_route
node_api_client -->|"HTTP requests"| node_search_route
node_api_client -->|"HTTP requests"| node_chat_route
node_fastapi -->|"registers"| node_documents_route
node_fastapi -->|"registers"| node_search_route
node_fastapi -->|"registers"| node_chat_route
node_documents_route -->|"extracts text"| node_document_extract
node_documents_route -->|"chunks text"| node_chunking
node_documents_route -->|"creates vectors"| node_embedding
node_documents_route -->|"stores and lists"| node_qdrant
node_document_extract --> node_groq
node_search_route -->|"embeds query"| node_embedding
node_search_route -->|"searches chunks"| node_qdrant
node_chat_route -->|"embeds query"| node_embedding
node_chat_route -->|"retrieves context"| node_qdrant
node_chat_route -->|"generates answer"| node_llm
node_llm -->|"requests completion"| node_groq

click node_app "https://github.com/ajay-shekhawat-1/personal-rag/blob/main/frontend/src/App.jsx"
click node_knowledge "https://github.com/ajay-shekhawat-1/personal-rag/blob/main/frontend/src/pages/KnowledgePage.jsx"
click node_upload_ui "https://github.com/ajay-shekhawat-1/personal-rag/blob/main/frontend/src/components/UploadDocument.jsx"
click node_document_ui "https://github.com/ajay-shekhawat-1/personal-rag/blob/main/frontend/src/components/DocumentList.jsx"
click node_chat_page "https://github.com/ajay-shekhawat-1/personal-rag/blob/main/frontend/src/pages/ChatPage.jsx"
click node_chat_ui "https://github.com/ajay-shekhawat-1/personal-rag/blob/main/frontend/src/components/Chat.jsx"
click node_api_client "https://github.com/ajay-shekhawat-1/personal-rag/blob/main/frontend/src/services/api.js"
click node_fastapi "https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/main.py"
click node_documents_route "https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/routes/documents.py"
click node_search_route "https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/routes/search.py"
click node_chat_route "https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/routes/chat.py"
click node_document_extract "https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/services/document_service.py"
click node_chunking "https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/services/chunking_service.py"
click node_embedding "https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/services/embedding_service.py"
click node_qdrant "https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/services/qdrant_service.py"
click node_llm "https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/services/llm_service.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_app,node_knowledge,node_upload_ui,node_document_ui,node_chat_page,node_chat_ui,node_api_client,node_user toneBlue
class node_fastapi,node_documents_route,node_search_route,node_chat_route toneAmber
class node_document_extract,node_chunking,node_groq toneMint
class node_embedding,node_qdrant,node_llm toneRose
```

## Components

### Web interface

- [App navigation](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Knowledge page](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/frontend/src/pages/KnowledgePage.jsx): `frontend/src/pages/KnowledgePage.jsx`
- [Upload sources](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/frontend/src/components/UploadDocument.jsx): `frontend/src/components/UploadDocument.jsx`
- [Document list](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/frontend/src/components/DocumentList.jsx): `frontend/src/components/DocumentList.jsx`
- [Chat page](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/frontend/src/pages/ChatPage.jsx): `frontend/src/pages/ChatPage.jsx`
- [Chat interface](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/frontend/src/components/Chat.jsx): `frontend/src/components/Chat.jsx`
- [API client](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### API routes

- [FastAPI app](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/main.py): `backend/app/main.py`
- [Document routes](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/routes/documents.py): `backend/app/routes/documents.py`
- [Search route](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/routes/search.py): `backend/app/routes/search.py`
- [Chat route](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/routes/chat.py): `backend/app/routes/chat.py`

### Knowledge ingestion

- [Text extraction](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/services/document_service.py): `backend/app/services/document_service.py`
- [Text chunking](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/services/chunking_service.py): `backend/app/services/chunking_service.py`

### Retrieval and answers

- [Embedding service](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/services/embedding_service.py): `backend/app/services/embedding_service.py`
- [Vector store](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/services/qdrant_service.py): `backend/app/services/qdrant_service.py`
- [Answer generation](https://github.com/ajay-shekhawat-1/personal-rag/blob/main/backend/app/services/llm_service.py): `backend/app/services/llm_service.py`

### Other components

- **User**
- **Groq model API**

## Connections

- User → App navigation: uses (evidence: `frontend/src/App.jsx`)
- App navigation → Knowledge page: shows (evidence: `frontend/src/App.jsx`)
- App navigation → Chat page: shows (evidence: `frontend/src/App.jsx`)
- Knowledge page → Upload sources: renders (evidence: `frontend/src/pages/KnowledgePage.jsx`)
- Knowledge page → Document list: renders (evidence: `frontend/src/pages/KnowledgePage.jsx`)
- Chat page → Chat interface: renders (evidence: `frontend/src/pages/ChatPage.jsx`)
- Upload sources → API client: calls (evidence: `frontend/src/components/UploadDocument.jsx`)
- Document list → API client: calls (evidence: `frontend/src/components/DocumentList.jsx`)
- Chat interface → API client: calls
- API client → Document routes: HTTP requests (evidence: `frontend/src/services/api.js`)
- API client → Search route: HTTP requests (evidence: `frontend/src/services/api.js`)
- API client → Chat route: HTTP requests (evidence: `frontend/src/services/api.js`)
- FastAPI app → Document routes: registers (evidence: `backend/app/main.py`)
- FastAPI app → Search route: registers (evidence: `backend/app/main.py`)
- FastAPI app → Chat route: registers (evidence: `backend/app/main.py`)
- Document routes → Text extraction: extracts text (evidence: `backend/app/routes/documents.py`)
- Document routes → Text chunking: chunks text (evidence: `backend/app/routes/documents.py`)
- Document routes → Embedding service: creates vectors (evidence: `backend/app/routes/documents.py`)
- Document routes → Vector store: stores and lists (evidence: `backend/app/routes/documents.py`)
- Text extraction → Groq model API
- Search route → Embedding service: embeds query (evidence: `backend/app/routes/search.py`)
- Search route → Vector store: searches chunks (evidence: `backend/app/routes/search.py`)
- Chat route → Embedding service: embeds query (evidence: `backend/app/routes/chat.py`)
- Chat route → Vector store: retrieves context (evidence: `backend/app/routes/chat.py`)
- Chat route → Answer generation: generates answer (evidence: `backend/app/routes/chat.py`)
- Answer generation → Groq model API: requests completion (evidence: `backend/app/services/llm_service.py`)
