# learncodewithdurgesh/docmind-rag-based-project architecture

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

- Interactive diagram: https://gitdiagram.com/learncodewithdurgesh/docmind-rag-based-project
- Repository: https://github.com/learncodewithdurgesh/docmind-rag-based-project

## Overview

DocMind is a web application for uploading documents, indexing their text, and asking questions or running semantic searches over the indexed content. The main workflow is upload → parse → chunk and index → retrieve relevant chunks → return answers with citations. Users can also register and log in, manage documents and conversations, view chunks, and stream chat responses. The upload, retrieval, and authentication paths are supported by sampled source; several frontend and persistence connections are inferred only from the module names and are therefore omitted.

Main entry points: [`frontend/docmind-frontend/src/App.tsx`](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/frontend/docmind-frontend/src/App.tsx) (Application shell), [`src/main/java/com/substring/docmind/service/DocumentMetadataService.java`](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/service/DocumentMetadataService.java) (Document management), [`src/main/java/com/substring/docmind/service/RagService.java`](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/service/RagService.java) (RAG and search), [`src/main/java/com/substring/docmind/controller/AuthController.java`](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/controller/AuthController.java) (Auth endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web frontend"]
  node_app["Application shell<br/>[App.tsx]"]
  node_doc_ui["Document views<br/>[Sidebar.tsx]"]
  node_upload_ui["Upload dialog<br/>[UploadDialog.tsx]"]
  node_chat_ui["Chat view<br/>[ChatView.tsx]"]
  node_search_ui["Search view<br/>[SearchView.tsx]"]
  node_chunks_ui["Chunks view<br/>[ChunksView.tsx]"]
  node_auth_ui["Login and register<br/>[Login.tsx]"]
end

subgraph group_auth["Authentication"]
  node_auth_api["Auth endpoints"]
  node_user_service["User service<br/>[UserService.java]"]
  node_jwt["JWT service<br/>[JwtService.java]"]
  node_security["JWT security filter"]
end

subgraph group_documents["Document indexing"]
  node_doc_api["Document endpoints"]
  node_metadata_service["Document management"]
  node_parser["Document parser"]
  node_ingestion["Chunk and index"]
end

subgraph group_rag["Retrieval and chat"]
  node_chat_api["Chat endpoints"]
  node_rag_service["RAG and search<br/>[RagService.java]"]
  node_chat_memory["Chat memory<br/>[JpaChatMemory.java]"]
end

subgraph group_persistence["Persistence and models"]
  node_metadata_repo["Document metadata repository"]
  node_conversation_repo["Conversation repository"]
  node_message_repo["Chat message repository"]
  node_vector_db[("Vector store")]
  node_relational_db[("Relational database")]
end

node_user(("User"))
node_chat_model{{"Chat model"}}

node_user -->|"uses"| node_app
node_app -->|"renders"| node_doc_ui
node_app -->|"opens"| node_upload_ui
node_app -->|"renders"| node_chat_ui
node_app -->|"renders"| node_search_ui
node_app -->|"renders"| node_chunks_ui
node_user -->|"submits credentials"| node_auth_ui
node_auth_ui -->|"authenticates"| node_auth_api
node_auth_api -->|"registers users"| node_user_service
node_auth_api -->|"creates token"| node_jwt
node_security -->|"validates token"| node_jwt
node_user -->|"selects files"| node_upload_ui
node_upload_ui -->|"uploads files"| node_doc_api
node_doc_api -->|"manages documents"| node_metadata_service
node_metadata_service -->|"parses file"| node_parser
node_metadata_service -->|"indexes parsed text"| node_ingestion
node_metadata_service -->|"saves metadata"| node_metadata_repo
node_ingestion -->|"writes chunks"| node_vector_db
node_ingestion -->|"updates status"| node_metadata_repo
node_doc_api -->|"lists and deletes"| node_metadata_service
node_user -->|"asks question"| node_chat_ui
node_chat_ui -->|"submits question"| node_chat_api
node_search_ui -->|"searches chunks"| node_chat_api
node_chat_api -->|"dispatches request"| node_rag_service
node_rag_service -->|"retrieves matches"| node_vector_db
node_rag_service -->|"generates answer"| node_chat_model
node_rag_service -->|"manages conversations"| node_conversation_repo
node_chat_memory -->|"loads and stores messages"| node_message_repo
node_rag_service -->|"uses memory"| node_chat_memory
node_metadata_repo -->|"reads and writes"| node_relational_db
node_conversation_repo -->|"reads and writes"| node_relational_db
node_message_repo -->|"reads and writes"| node_relational_db
node_metadata_service -->|"purges document vectors"| node_vector_db

click node_app "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/frontend/docmind-frontend/src/App.tsx"
click node_doc_ui "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/frontend/docmind-frontend/src/components/Sidebar.tsx"
click node_upload_ui "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/frontend/docmind-frontend/src/components/UploadDialog.tsx"
click node_chat_ui "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/frontend/docmind-frontend/src/components/ChatView.tsx"
click node_search_ui "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/frontend/docmind-frontend/src/components/SearchView.tsx"
click node_chunks_ui "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/frontend/docmind-frontend/src/components/ChunksView.tsx"
click node_auth_ui "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/frontend/docmind-frontend/src/pages/Login.tsx"
click node_auth_api "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/controller/AuthController.java"
click node_user_service "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/service/UserService.java"
click node_jwt "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/service/JwtService.java"
click node_security "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/config/JwtAuthenticationFilter.java"
click node_doc_api "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/controller/DocumentController.java"
click node_metadata_service "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/service/DocumentMetadataService.java"
click node_parser "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/service/DocumentParserService.java"
click node_ingestion "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/service/DocumentIngestionService.java"
click node_chat_api "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/controller/ChatController.java"
click node_rag_service "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/service/RagService.java"
click node_chat_memory "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/service/JpaChatMemory.java"
click node_metadata_repo "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/repository/DocumentMetadataRepo.java"
click node_conversation_repo "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/repository/ConversationRepository.java"
click node_message_repo "https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/repository/ChatMessageRepository.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_app,node_doc_ui,node_upload_ui,node_chat_ui,node_search_ui,node_chunks_ui,node_auth_ui,node_user toneBlue
class node_auth_api,node_user_service,node_jwt,node_security toneAmber
class node_doc_api,node_metadata_service,node_parser,node_ingestion toneMint
class node_chat_api,node_rag_service,node_chat_memory toneRose
class node_metadata_repo,node_conversation_repo,node_message_repo,node_vector_db,node_relational_db,node_chat_model toneIndigo
```

## Components

### Web frontend

- [Application shell](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/frontend/docmind-frontend/src/App.tsx): `frontend/docmind-frontend/src/App.tsx`
- [Document views](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/frontend/docmind-frontend/src/components/Sidebar.tsx): `frontend/docmind-frontend/src/components/Sidebar.tsx`
- [Upload dialog](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/frontend/docmind-frontend/src/components/UploadDialog.tsx): `frontend/docmind-frontend/src/components/UploadDialog.tsx`
- [Chat view](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/frontend/docmind-frontend/src/components/ChatView.tsx): `frontend/docmind-frontend/src/components/ChatView.tsx`
- [Search view](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/frontend/docmind-frontend/src/components/SearchView.tsx): `frontend/docmind-frontend/src/components/SearchView.tsx`
- [Chunks view](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/frontend/docmind-frontend/src/components/ChunksView.tsx): `frontend/docmind-frontend/src/components/ChunksView.tsx`
- [Login and register](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/frontend/docmind-frontend/src/pages/Login.tsx): `frontend/docmind-frontend/src/pages/Login.tsx`

### Authentication

- [Auth endpoints](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/controller/AuthController.java): `src/main/java/com/substring/docmind/controller/AuthController.java`
- [User service](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/service/UserService.java): `src/main/java/com/substring/docmind/service/UserService.java`
- [JWT service](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/service/JwtService.java): `src/main/java/com/substring/docmind/service/JwtService.java`
- [JWT security filter](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/config/JwtAuthenticationFilter.java): `src/main/java/com/substring/docmind/config/JwtAuthenticationFilter.java`

### Document indexing

- [Document endpoints](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/controller/DocumentController.java): `src/main/java/com/substring/docmind/controller/DocumentController.java`
- [Document management](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/service/DocumentMetadataService.java): `src/main/java/com/substring/docmind/service/DocumentMetadataService.java`
- [Document parser](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/service/DocumentParserService.java): `src/main/java/com/substring/docmind/service/DocumentParserService.java`
- [Chunk and index](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/service/DocumentIngestionService.java): `src/main/java/com/substring/docmind/service/DocumentIngestionService.java`

### Retrieval and chat

- [Chat endpoints](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/controller/ChatController.java): `src/main/java/com/substring/docmind/controller/ChatController.java`
- [RAG and search](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/service/RagService.java): `src/main/java/com/substring/docmind/service/RagService.java`
- [Chat memory](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/service/JpaChatMemory.java): `src/main/java/com/substring/docmind/service/JpaChatMemory.java`

### Persistence and models

- [Document metadata repository](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/repository/DocumentMetadataRepo.java): `src/main/java/com/substring/docmind/repository/DocumentMetadataRepo.java`
- [Conversation repository](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/repository/ConversationRepository.java): `src/main/java/com/substring/docmind/repository/ConversationRepository.java`
- [Chat message repository](https://github.com/learncodewithdurgesh/docmind-rag-based-project/blob/main/src/main/java/com/substring/docmind/repository/ChatMessageRepository.java): `src/main/java/com/substring/docmind/repository/ChatMessageRepository.java`
- **Vector store**
- **Relational database**

### Other components

- **User**
- **Chat model**

## Connections

- User → Application shell: uses
- Application shell → Document views: renders
- Application shell → Upload dialog: opens
- Application shell → Chat view: renders
- Application shell → Search view: renders
- Application shell → Chunks view: renders
- User → Login and register: submits credentials
- Login and register → Auth endpoints: authenticates
- Auth endpoints → User service: registers users
- Auth endpoints → JWT service: creates token
- JWT security filter → JWT service: validates token
- User → Upload dialog: selects files
- Upload dialog → Document endpoints: uploads files
- Document endpoints → Document management: manages documents
- Document management → Document parser: parses file
- Document management → Chunk and index: indexes parsed text
- Document management → Document metadata repository: saves metadata
- Chunk and index → Vector store: writes chunks
- Chunk and index → Document metadata repository: updates status
- Document endpoints → Document management: lists and deletes
- User → Chat view: asks question
- Chat view → Chat endpoints: submits question
- Search view → Chat endpoints: searches chunks
- Chat endpoints → RAG and search: dispatches request
- RAG and search → Vector store: retrieves matches
- RAG and search → Chat model: generates answer
- RAG and search → Conversation repository: manages conversations
- Chat memory → Chat message repository: loads and stores messages
- RAG and search → Chat memory: uses memory
- Document metadata repository → Relational database: reads and writes
- Conversation repository → Relational database: reads and writes
- Chat message repository → Relational database: reads and writes
- Document management → Vector store: purges document vectors
