# ahmedsheikh27/inquiro architecture

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

- Interactive diagram: https://gitdiagram.com/ahmedsheikh27/inquiro
- Repository: https://github.com/ahmedsheikh27/inquiro

## Overview

Inquiro is a full-stack research chat application. A user enters through the React interface, where guest or authenticated sessions can send questions or upload PDFs; the FastAPI API then dispatches queries to the research agent, which selects conversation-history or RAG processing and returns a generated answer. Chat history and user data are stored in MongoDB, while FAISS-backed indexes support retrieved context. The README also documents Wikipedia retrieval, but the sampled implementation does not establish its wiring; that integration is shown as optional and unverified.

Main entry points: [`backend/api/index.py`](https://github.com/ahmedsheikh27/inquiro/blob/main/backend/api/index.py) (FastAPI routes), [`backend/app/rag/rag_pipeline.py`](https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/rag/rag_pipeline.py) (RAG retrieval), [`chat-frontend/src/services/api.js`](https://github.com/ahmedsheikh27/inquiro/blob/main/chat-frontend/src/services/api.js) (API client), [`backend/app/agent/research_agent.py`](https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/agent/research_agent.py) (Research agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Chat experience"]
  node_web_ui["React application<br/>[App.jsx]"]
  node_chat_page["Chat page<br/>[App.jsx]"]
  node_chat_window["Chat composer<br/>[ChatWindow.jsx]"]
  node_auth_ui["Login and register<br/>[Login.jsx]"]
  node_auth_state["Auth context<br/>[AuthContext.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api_auth["API and identity"]
  node_fastapi["FastAPI routes<br/>[index.py]"]
  node_auth_routes["Auth routes<br/>[routes.py]"]
  node_auth_core["JWT and passwords<br/>[auth.py]"]
end

subgraph group_research["Research processing"]
  node_agent["Research agent<br/>[research_agent.py]"]
  node_rag["RAG retrieval<br/>[rag_pipeline.py]"]
  node_pdf_ingest["PDF indexing<br/>[pdf_chunks.py]"]
  node_chunker["Text chunker<br/>[chunker.py]"]
  node_web_search["Web search<br/>[tavily_client.py]"]
  node_wiki["Wikipedia source"]
end

subgraph group_persistence["Session and indexes"]
  node_memory["Chat memory<br/>[memory_manager.py]"]
  node_mongo[("MongoDB<br/>[mongo_client.py]")]
  node_vectors[("Vector store<br/>[vector_store.py]")]
end

node_person(("Chat user"))
node_gemini["Gemini model"]
node_faiss[("FAISS index")]

node_person -->|"uses"| node_web_ui
node_web_ui -->|"routes to"| node_chat_page
node_chat_page -->|"renders"| node_chat_window
node_chat_page -->|"loads sessions"| node_api_client
node_chat_window -->|"sends queries"| node_api_client
node_auth_ui -->|"calls auth"| node_api_client
node_auth_ui -->|"sets session"| node_auth_state
node_auth_state -->|"uses auth service"| node_api_client
node_api_client -->|"HTTP requests"| node_fastapi
node_fastapi -->|"mounts routes"| node_auth_routes
node_auth_routes -->|"hashes and signs"| node_auth_core
node_auth_routes -->|"reads and writes users"| node_mongo
node_fastapi -->|"dispatches query"| node_agent
node_fastapi -->|"manages sessions"| node_memory
node_fastapi -->|"indexes upload"| node_pdf_ingest
node_agent -->|"retrieves context"| node_rag
node_agent -->|"loads and saves history"| node_memory
node_agent -->|"invokes model"| node_gemini
node_rag -->|"searches web"| node_web_search
node_rag -->|"chunks results"| node_chunker
node_rag -->|"loads and creates indexes"| node_vectors
node_pdf_ingest -->|"chunks PDF text"| node_chunker
node_pdf_ingest -->|"creates PDF index"| node_vectors
node_memory -->|"stores conversations"| node_mongo
node_vectors -->|"persists vectors"| node_faiss
node_rag -.->|"may retrieve knowledge"| node_wiki

click node_web_ui "https://github.com/ahmedsheikh27/inquiro/blob/main/chat-frontend/src/App.jsx"
click node_chat_page "https://github.com/ahmedsheikh27/inquiro/blob/main/chat-frontend/src/pages/App.jsx"
click node_chat_window "https://github.com/ahmedsheikh27/inquiro/blob/main/chat-frontend/src/components/ChatWindow.jsx"
click node_auth_ui "https://github.com/ahmedsheikh27/inquiro/blob/main/chat-frontend/src/pages/Login.jsx"
click node_auth_state "https://github.com/ahmedsheikh27/inquiro/blob/main/chat-frontend/src/context/AuthContext.jsx"
click node_api_client "https://github.com/ahmedsheikh27/inquiro/blob/main/chat-frontend/src/services/api.js"
click node_fastapi "https://github.com/ahmedsheikh27/inquiro/blob/main/backend/api/index.py"
click node_auth_routes "https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/auth/routes.py"
click node_auth_core "https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/auth/auth.py"
click node_agent "https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/agent/research_agent.py"
click node_rag "https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/rag/rag_pipeline.py"
click node_pdf_ingest "https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/rag/pdf_chunks.py"
click node_chunker "https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/rag/chunker.py"
click node_web_search "https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/search/tavily_client.py"
click node_memory "https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/memory/memory_manager.py"
click node_mongo "https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/database/mongo_client.py"
click node_vectors "https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/database/vector_store.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_ui,node_chat_page,node_chat_window,node_auth_ui,node_auth_state,node_api_client,node_person toneBlue
class node_fastapi,node_auth_routes,node_auth_core,node_faiss toneAmber
class node_agent,node_rag,node_pdf_ingest,node_chunker,node_web_search,node_wiki toneMint
class node_memory,node_mongo,node_vectors toneRose
class node_gemini toneIndigo
```

## Components

### Chat experience

- [React application](https://github.com/ahmedsheikh27/inquiro/blob/main/chat-frontend/src/App.jsx): `chat-frontend/src/App.jsx`
- [Chat page](https://github.com/ahmedsheikh27/inquiro/blob/main/chat-frontend/src/pages/App.jsx): `chat-frontend/src/pages/App.jsx`
- [Chat composer](https://github.com/ahmedsheikh27/inquiro/blob/main/chat-frontend/src/components/ChatWindow.jsx): `chat-frontend/src/components/ChatWindow.jsx`
- [Login and register](https://github.com/ahmedsheikh27/inquiro/blob/main/chat-frontend/src/pages/Login.jsx): `chat-frontend/src/pages/Login.jsx`
- [Auth context](https://github.com/ahmedsheikh27/inquiro/blob/main/chat-frontend/src/context/AuthContext.jsx): `chat-frontend/src/context/AuthContext.jsx`
- [API client](https://github.com/ahmedsheikh27/inquiro/blob/main/chat-frontend/src/services/api.js): `chat-frontend/src/services/api.js`

### API and identity

- [FastAPI routes](https://github.com/ahmedsheikh27/inquiro/blob/main/backend/api/index.py): `backend/api/index.py`
- [Auth routes](https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/auth/routes.py): `backend/app/auth/routes.py`
- [JWT and passwords](https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/auth/auth.py): `backend/app/auth/auth.py`

### Research processing

- [Research agent](https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/agent/research_agent.py): `backend/app/agent/research_agent.py`
- [RAG retrieval](https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/rag/rag_pipeline.py): `backend/app/rag/rag_pipeline.py`
- [PDF indexing](https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/rag/pdf_chunks.py): `backend/app/rag/pdf_chunks.py`
- [Text chunker](https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/rag/chunker.py): `backend/app/rag/chunker.py`
- [Web search](https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/search/tavily_client.py): `backend/app/search/tavily_client.py`
- **Wikipedia source**

### Session and indexes

- [Chat memory](https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/memory/memory_manager.py): `backend/app/memory/memory_manager.py`
- [MongoDB](https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/database/mongo_client.py): `backend/app/database/mongo_client.py`
- [Vector store](https://github.com/ahmedsheikh27/inquiro/blob/main/backend/app/database/vector_store.py): `backend/app/database/vector_store.py`

### Other components

- **Chat user**
- **Gemini model**
- **FAISS index**

## Connections

- Chat user → React application: uses
- React application → Chat page: routes to (evidence: `chat-frontend/src/App.jsx`)
- Chat page → Chat composer: renders (evidence: `chat-frontend/src/pages/App.jsx`)
- Chat page → API client: loads sessions (evidence: `chat-frontend/src/pages/App.jsx`)
- Chat composer → API client: sends queries (evidence: `chat-frontend/src/components/ChatWindow.jsx`)
- Login and register → API client: calls auth (evidence: `chat-frontend/src/services/api.js`)
- Login and register → Auth context: sets session (evidence: `chat-frontend/src/context/AuthContext.jsx`)
- Auth context → API client: uses auth service (evidence: `chat-frontend/src/context/AuthContext.jsx`)
- API client → FastAPI routes: HTTP requests (evidence: `chat-frontend/src/services/api.js`)
- FastAPI routes → Auth routes: mounts routes (evidence: `backend/api/index.py`)
- Auth routes → JWT and passwords: hashes and signs (evidence: `backend/app/auth/routes.py`)
- Auth routes → MongoDB: reads and writes users (evidence: `backend/app/auth/routes.py`)
- FastAPI routes → Research agent: dispatches query (evidence: `backend/api/index.py`)
- FastAPI routes → Chat memory: manages sessions (evidence: `backend/api/index.py`)
- FastAPI routes → PDF indexing: indexes upload (evidence: `backend/api/index.py`)
- Research agent → RAG retrieval: retrieves context (evidence: `backend/app/agent/research_agent.py`)
- Research agent → Chat memory: loads and saves history (evidence: `backend/app/agent/research_agent.py`)
- Research agent → Gemini model: invokes model (evidence: `backend/app/agent/research_agent.py`)
- RAG retrieval → Web search: searches web (evidence: `backend/app/rag/rag_pipeline.py`)
- RAG retrieval → Text chunker: chunks results (evidence: `backend/app/rag/rag_pipeline.py`)
- RAG retrieval → Vector store: loads and creates indexes (evidence: `backend/app/rag/rag_pipeline.py`)
- PDF indexing → Text chunker: chunks PDF text (evidence: `backend/app/rag/pdf_chunks.py`)
- PDF indexing → Vector store: creates PDF index (evidence: `backend/app/rag/pdf_chunks.py`)
- Chat memory → MongoDB: stores conversations (evidence: `backend/app/memory/memory_manager.py`)
- Vector store → FAISS index: persists vectors
- RAG retrieval → Wikipedia source: may retrieve knowledge
