# anil29717/deepdoc architecture

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

- Interactive diagram: https://gitdiagram.com/anil29717/deepdoc
- Repository: https://github.com/anil29717/deepdoc

## Overview

DeepDoc AI lets users upload PDFs, organize them into folders, and ask questions over individual documents or folder collections. Its main flow runs from the React app through FastAPI document processing and RAG retrieval/generation, with MySQL for application records and ChromaDB for vectors. The graph also captures authentication and admin capabilities. Some backend routes are excerpted only in part, so edges for documented but unsampled chat and storage behavior cite the README rather than implying those route bodies were inspected.

Main entry points: [`backend/main.py`](https://github.com/anil29717/deepdoc/blob/main/backend/main.py) (API routes), [`backend/services/rag_engine.py`](https://github.com/anil29717/deepdoc/blob/main/backend/services/rag_engine.py) (RAG orchestration), [`frontend/src/services/api.js`](https://github.com/anil29717/deepdoc/blob/main/frontend/src/services/api.js) (API client), [`frontend/src/App.jsx`](https://github.com/anil29717/deepdoc/blob/main/frontend/src/App.jsx) (App and chat UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_webapp["App and chat UI<br/>[App.jsx]"]
  node_authui["Login and signup<br/>[LoginPage.jsx]"]
  node_adminui["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_authcontext["Session context<br/>[AuthContext.jsx]"]
  node_apiclient["API client<br/>[api.js]"]
end

subgraph group_api["Backend API"]
  node_fastapi["API routes<br/>[main.py]"]
  node_auth["JWT security<br/>[auth.py]"]
  node_models["Domain records<br/>[models.py]"]
end

subgraph group_rag["Document intelligence"]
  node_pdf["PDF extraction<br/>[pdf_processor.py]"]
  node_ragengine["RAG orchestration<br/>[rag_engine.py]"]
end

subgraph group_data["Persistence and providers"]
  node_mysql[("MySQL records<br/>[database.py]")]
  node_chroma[("Vector index<br/>[chroma.sqlite3]")]
end

node_user(("User"))
node_groq{{"Groq LLM"}}

node_user -->|"uses"| node_webapp
node_webapp -->|"sends requests"| node_apiclient
node_webapp -->|"checks session"| node_authcontext
node_authui -->|"submits credentials"| node_authcontext
node_authcontext -->|"calls auth routes"| node_apiclient
node_adminui -->|"calls admin routes"| node_apiclient
node_apiclient -->|"calls API"| node_fastapi
node_fastapi -->|"checks protected routes"| node_auth
node_fastapi -->|"queries records"| node_models
node_fastapi -->|"uses sessions"| node_mysql
node_models -->|"maps records"| node_mysql
node_fastapi -->|"processes uploads"| node_pdf
node_pdf -.->|"provides chunks"| node_ragengine
node_fastapi -->|"handles RAG queries"| node_ragengine
node_ragengine -->|"stores and searches vectors"| node_chroma
node_ragengine -->|"generates answers"| node_groq

click node_webapp "https://github.com/anil29717/deepdoc/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/anil29717/deepdoc/blob/main/frontend/src/pages/LoginPage.jsx"
click node_adminui "https://github.com/anil29717/deepdoc/blob/main/frontend/src/pages/AdminDashboard.jsx"
click node_authcontext "https://github.com/anil29717/deepdoc/blob/main/frontend/src/context/AuthContext.jsx"
click node_apiclient "https://github.com/anil29717/deepdoc/blob/main/frontend/src/services/api.js"
click node_fastapi "https://github.com/anil29717/deepdoc/blob/main/backend/main.py"
click node_auth "https://github.com/anil29717/deepdoc/blob/main/backend/auth.py"
click node_models "https://github.com/anil29717/deepdoc/blob/main/backend/models.py"
click node_pdf "https://github.com/anil29717/deepdoc/blob/main/backend/services/pdf_processor.py"
click node_ragengine "https://github.com/anil29717/deepdoc/blob/main/backend/services/rag_engine.py"
click node_mysql "https://github.com/anil29717/deepdoc/blob/main/backend/database.py"
click node_chroma "https://github.com/anil29717/deepdoc/blob/main/chroma_db/chroma.sqlite3"

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_webapp,node_authui,node_adminui,node_authcontext,node_apiclient,node_user toneBlue
class node_fastapi,node_auth,node_models toneAmber
class node_pdf,node_ragengine toneMint
class node_mysql,node_chroma toneRose
class node_groq toneIndigo
```

## Components

### Web application

- [App and chat UI](https://github.com/anil29717/deepdoc/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login and signup](https://github.com/anil29717/deepdoc/blob/main/frontend/src/pages/LoginPage.jsx): `frontend/src/pages/LoginPage.jsx`
- [Admin dashboard](https://github.com/anil29717/deepdoc/blob/main/frontend/src/pages/AdminDashboard.jsx): `frontend/src/pages/AdminDashboard.jsx`
- [Session context](https://github.com/anil29717/deepdoc/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [API client](https://github.com/anil29717/deepdoc/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### Backend API

- [API routes](https://github.com/anil29717/deepdoc/blob/main/backend/main.py): `backend/main.py`
- [JWT security](https://github.com/anil29717/deepdoc/blob/main/backend/auth.py): `backend/auth.py`
- [Domain records](https://github.com/anil29717/deepdoc/blob/main/backend/models.py): `backend/models.py`

### Document intelligence

- [PDF extraction](https://github.com/anil29717/deepdoc/blob/main/backend/services/pdf_processor.py): `backend/services/pdf_processor.py`
- [RAG orchestration](https://github.com/anil29717/deepdoc/blob/main/backend/services/rag_engine.py): `backend/services/rag_engine.py`

### Persistence and providers

- [MySQL records](https://github.com/anil29717/deepdoc/blob/main/backend/database.py): `backend/database.py`
- [Vector index](https://github.com/anil29717/deepdoc/blob/main/chroma_db/chroma.sqlite3): `chroma_db/chroma.sqlite3`

### Other components

- **User**
- **Groq LLM**

## Connections

- User → App and chat UI: uses (evidence: `README.md`)
- App and chat UI → API client: sends requests (evidence: `frontend/src/App.jsx`)
- App and chat UI → Session context: checks session (evidence: `frontend/src/App.jsx`)
- Login and signup → Session context: submits credentials (evidence: `frontend/src/pages/LoginPage.jsx`)
- Session context → API client: calls auth routes (evidence: `frontend/src/context/AuthContext.jsx`)
- Admin dashboard → API client: calls admin routes (evidence: `frontend/src/pages/AdminDashboard.jsx`)
- API client → API routes: calls API (evidence: `frontend/src/services/api.js`)
- API routes → JWT security: checks protected routes (evidence: `backend/main.py`)
- API routes → Domain records: queries records (evidence: `backend/main.py`)
- API routes → MySQL records: uses sessions (evidence: `backend/database.py`)
- Domain records → MySQL records: maps records (evidence: `backend/models.py`)
- API routes → PDF extraction: processes uploads (evidence: `backend/main.py`)
- PDF extraction → RAG orchestration: provides chunks
- API routes → RAG orchestration: handles RAG queries (evidence: `README.md`)
- RAG orchestration → Vector index: stores and searches vectors (evidence: `backend/services/rag_engine.py`)
- RAG orchestration → Groq LLM: generates answers (evidence: `backend/services/rag_engine.py`)
