# vijayarawat/ai_mentor architecture

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

- Interactive diagram: https://gitdiagram.com/vijayarawat/ai_mentor
- Repository: https://github.com/vijayarawat/ai_mentor

## Overview

AI Personal Mentor & Leadership Coach combines account access, retrieval-grounded coaching conversations, and dated chat history with session continuation and summaries. The frontend selects authentication or history/chat views; its components call the FastAPI backend, which handles requests and persists conversation messages. The README documents Gemini and FAISS retrieval, while the excerpts show the backend’s model/index imports and prompt generation. Some backend route implementations and retrieval details are omitted, so those internal links are not expanded beyond supported evidence.

Main entry points: [`backend/chatbot.py`](https://github.com/vijayarawat/ai_mentor/blob/main/backend/chatbot.py) (FastAPI coaching API), [`frontend/src/App.jsx`](https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/App.jsx) (Application router), [`frontend/src/config.js`](https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/config.js) (API endpoint config), [`frontend/src/Login.jsx`](https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/Login.jsx) (Login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["Application router<br/>[App.jsx]"]
  node_login["Login<br/>[Login.jsx]"]
  node_register["Registration<br/>[Register.jsx]"]
  node_chatui["Coaching chat"]
  node_historyui["Chat history<br/>[ChatHistory.jsx]"]
  node_legacychat["Name-based chat<br/>[chat.jsx]"]
  node_apiurl["API endpoint config<br/>[config.js]"]
end

subgraph group_api["API and coaching"]
  node_backend["FastAPI coaching API<br/>[chatbot.py]"]
end

subgraph group_knowledge["Knowledge retrieval"]
  node_embedding["Embedding generation"]
  node_knowledgefiles["Curated knowledge"]
  node_faiss[("FAISS vector index<br/>[faiss_index.bin]")]
end

subgraph group_persistence["Session and accounts"]
  node_db[("Accounts and chat store<br/>[db.py]")]
  node_redisclient["Redis history cache<br/>[redis_client.py]"]
end

node_visitor(("Mentor user"))
node_gemini["Google Gemini"]
node_redis[("Redis")]

node_visitor -->|"uses"| node_app
node_app -->|"shows"| node_login
node_app -->|"shows"| node_register
node_app -->|"shows"| node_historyui
node_app -->|"shows"| node_chatui
node_login -->|"reads URL"| node_apiurl
node_register -->|"reads URL"| node_apiurl
node_chatui -->|"reads URL"| node_apiurl
node_historyui -->|"reads URL"| node_apiurl
node_login -->|"posts login"| node_backend
node_register -->|"posts registration"| node_backend
node_chatui -->|"posts messages"| node_backend
node_historyui -->|"requests history and summary"| node_backend
node_legacychat -->|"reads URL"| node_apiurl
node_legacychat -->|"posts messages"| node_backend
node_backend -->|"auth and history calls"| node_db
node_backend -->|"saves messages"| node_redisclient
node_redisclient -->|"reads and writes"| node_redis
node_backend -.->|"generates responses"| node_gemini
node_backend -.->|"retrieves context"| node_faiss
node_embedding -.->|"embeds sources"| node_knowledgefiles
node_embedding -.->|"builds index"| node_faiss

click node_app "https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/Login.jsx"
click node_register "https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/Register.jsx"
click node_chatui "https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/ChatAuthenticated.jsx"
click node_historyui "https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/ChatHistory.jsx"
click node_legacychat "https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/chat.jsx"
click node_apiurl "https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/config.js"
click node_backend "https://github.com/vijayarawat/ai_mentor/blob/main/backend/chatbot.py"
click node_embedding "https://github.com/vijayarawat/ai_mentor/blob/main/backend/enbedding_generation.py"
click node_knowledgefiles "https://github.com/vijayarawat/ai_mentor/tree/main/backend/raw_data"
click node_faiss "https://github.com/vijayarawat/ai_mentor/blob/main/backend/faiss_index.bin"
click node_db "https://github.com/vijayarawat/ai_mentor/blob/main/backend/db.py"
click node_redisclient "https://github.com/vijayarawat/ai_mentor/blob/main/backend/redis_client.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_login,node_register,node_chatui,node_historyui,node_legacychat,node_apiurl,node_visitor toneBlue
class node_backend,node_redis toneAmber
class node_embedding,node_knowledgefiles,node_faiss toneMint
class node_db,node_redisclient toneRose
class node_gemini toneIndigo
```

## Components

### Web application

- [Application router](https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login](https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/Login.jsx): `frontend/src/Login.jsx`
- [Registration](https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/Register.jsx): `frontend/src/Register.jsx`
- [Coaching chat](https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/ChatAuthenticated.jsx): `frontend/src/ChatAuthenticated.jsx`
- [Chat history](https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/ChatHistory.jsx): `frontend/src/ChatHistory.jsx`
- [Name-based chat](https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/chat.jsx): `frontend/src/chat.jsx`
- [API endpoint config](https://github.com/vijayarawat/ai_mentor/blob/main/frontend/src/config.js): `frontend/src/config.js`

### API and coaching

- [FastAPI coaching API](https://github.com/vijayarawat/ai_mentor/blob/main/backend/chatbot.py): `backend/chatbot.py`

### Knowledge retrieval

- [Embedding generation](https://github.com/vijayarawat/ai_mentor/blob/main/backend/enbedding_generation.py): `backend/enbedding_generation.py`
- [Curated knowledge](https://github.com/vijayarawat/ai_mentor/tree/main/backend/raw_data): `backend/raw_data`
- [FAISS vector index](https://github.com/vijayarawat/ai_mentor/blob/main/backend/faiss_index.bin): `backend/faiss_index.bin`

### Session and accounts

- [Accounts and chat store](https://github.com/vijayarawat/ai_mentor/blob/main/backend/db.py): `backend/db.py`
- [Redis history cache](https://github.com/vijayarawat/ai_mentor/blob/main/backend/redis_client.py): `backend/redis_client.py`

### Other components

- **Mentor user**
- **Google Gemini**
- **Redis**

## Connections

- Mentor user → Application router: uses
- Application router → Login: shows (evidence: `frontend/src/App.jsx`)
- Application router → Registration: shows (evidence: `frontend/src/App.jsx`)
- Application router → Chat history: shows (evidence: `frontend/src/App.jsx`)
- Application router → Coaching chat: shows (evidence: `frontend/src/App.jsx`)
- Login → API endpoint config: reads URL (evidence: `frontend/src/Login.jsx`)
- Registration → API endpoint config: reads URL (evidence: `frontend/src/Register.jsx`)
- Coaching chat → API endpoint config: reads URL (evidence: `frontend/src/ChatAuthenticated.jsx`)
- Chat history → API endpoint config: reads URL (evidence: `frontend/src/ChatHistory.jsx`)
- Login → FastAPI coaching API: posts login (evidence: `frontend/src/Login.jsx`)
- Registration → FastAPI coaching API: posts registration (evidence: `frontend/src/Register.jsx`)
- Coaching chat → FastAPI coaching API: posts messages (evidence: `frontend/src/ChatAuthenticated.jsx`)
- Chat history → FastAPI coaching API: requests history and summary (evidence: `frontend/src/ChatHistory.jsx`)
- Name-based chat → API endpoint config: reads URL (evidence: `frontend/src/chat.jsx`)
- Name-based chat → FastAPI coaching API: posts messages (evidence: `frontend/src/chat.jsx`)
- FastAPI coaching API → Accounts and chat store: auth and history calls (evidence: `backend/chatbot.py`)
- FastAPI coaching API → Redis history cache: saves messages (evidence: `backend/chatbot.py`)
- Redis history cache → Redis: reads and writes (evidence: `backend/redis_client.py`)
- FastAPI coaching API → Google Gemini: generates responses (evidence: `README.md`)
- FastAPI coaching API → FAISS vector index: retrieves context (evidence: `README.md`)
- Embedding generation → Curated knowledge: embeds sources
- Embedding generation → FAISS vector index: builds index
