# skyuvaraj2007-web/esec-chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/skyuvaraj2007-web/esec-chatbot
- Repository: https://github.com/skyuvaraj2007-web/esec-chatbot

## Overview

VISIONAI is a web-based visual intelligence and multimodal chat platform. Users authenticate, capture or upload images, ask questions, and receive visual analysis and conversational responses; they can revisit conversations, compare images, view insights, and request speech or translation. The README documents these capabilities, while the sampled chat and vision code show orchestration of routed analysis and Gemini responses. Some frontend-to-API and persistence details are documented only at a high level, so unsupported internal links are omitted.

Main entry points: [`backend/app/main.py`](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/api/chat.py`](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/api/chat.py) (Chat API), [`backend/app/services/vision_service.py`](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/vision_service.py) (Vision analysis), [`frontend/src/lib/api.ts`](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/frontend/src/lib/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web experience"]
  node_workspace["Chat workspace"]
  node_camera["Camera capture<br/>[CameraCapture.tsx]"]
  node_comparison["Image comparison"]
  node_insights_ui["Insights dashboard<br/>[page.tsx]"]
  node_history_ui["Conversation history<br/>[page.tsx]"]
  node_auth_ui["Authentication UI<br/>[AuthContext.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["API and access"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_auth_api["Authentication API<br/>[auth.py]"]
  node_chat_api["Chat API<br/>[chat.py]"]
  node_image_api["Image API<br/>[images.py]"]
  node_compare_api["Comparison API<br/>[compare.py]"]
  node_insights_api["Insights API<br/>[insights.py]"]
  node_tts_api["Speech API<br/>[tts.py]"]
  node_security["Identity validation<br/>[security.py]"]
end

subgraph group_vision["Visual intelligence"]
  node_router["Task routing<br/>[task_router.py]"]
  node_vision_service["Vision analysis<br/>[vision_service.py]"]
  node_yolo["Object detection<br/>[yolo_service.py]"]
  node_ocr["Text extraction<br/>[ocr_service.py]"]
  node_gemini["Gemini reasoning<br/>[gemini_service.py]"]
  node_language["Language services"]
end

subgraph group_conversation["Conversation and media"]
  node_conversations[("Conversation memory")]
  node_storage[("Image storage<br/>[storage_service.py]")]
  node_tts["Speech synthesis<br/>[tts_service.py]"]
end

node_user(("User"))
node_supabase[("Supabase")]
node_gemini_external["Gemini service"]

node_user -->|"uses"| node_workspace
node_user -->|"captures image"| node_camera
node_user -->|"compares images"| node_comparison
node_user -->|"views insights"| node_insights_ui
node_user -->|"reviews history"| node_history_ui
node_user -->|"authenticates"| node_auth_ui
node_workspace -.->|"requests API"| node_api_client
node_comparison -.->|"requests comparison"| node_api_client
node_insights_ui -.->|"requests insights"| node_api_client
node_history_ui -.->|"requests history"| node_api_client
node_auth_ui -.->|"authenticates"| node_supabase
node_api_client -->|"calls API"| node_api_app
node_api_app -->|"routes to"| node_auth_api
node_api_app -->|"routes to"| node_chat_api
node_api_app -->|"routes to"| node_image_api
node_api_app -->|"routes to"| node_compare_api
node_api_app -->|"routes to"| node_insights_api
node_api_app -->|"routes to"| node_tts_api
node_auth_api -->|"validates identity"| node_security
node_chat_api -->|"validates identity"| node_security
node_chat_api -->|"loads and saves"| node_conversations
node_chat_api -->|"routes task"| node_router
node_chat_api -->|"requests analysis"| node_vision_service
node_chat_api -->|"generates response"| node_gemini
node_chat_api -->|"synthesizes speech"| node_tts
node_image_api -->|"requests analysis"| node_vision_service
node_image_api -->|"stores images"| node_storage
node_compare_api -->|"requests comparison"| node_gemini
node_compare_api -->|"loads images"| node_storage
node_insights_api -->|"reads statistics"| node_conversations
node_tts_api -->|"synthesizes speech"| node_tts
node_vision_service -->|"detects objects"| node_yolo
node_vision_service -->|"extracts text"| node_ocr
node_vision_service -->|"analyzes image"| node_gemini
node_storage -.->|"stores or retrieves"| node_supabase
node_conversations -.->|"persists records"| node_supabase
node_gemini -->|"sends requests"| node_gemini_external

click node_workspace "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/frontend/src/components/ConversationWorkspace.tsx"
click node_camera "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/frontend/src/components/CameraCapture.tsx"
click node_comparison "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/frontend/src/components/ImageComparisonModal.tsx"
click node_insights_ui "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/frontend/src/app/app/insights/page.tsx"
click node_history_ui "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/frontend/src/app/app/history/page.tsx"
click node_auth_ui "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/frontend/src/context/AuthContext.tsx"
click node_api_client "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/frontend/src/lib/api.ts"
click node_api_app "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/main.py"
click node_auth_api "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/api/auth.py"
click node_chat_api "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/api/chat.py"
click node_image_api "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/api/images.py"
click node_compare_api "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/api/compare.py"
click node_insights_api "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/api/insights.py"
click node_tts_api "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/api/tts.py"
click node_security "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/utils/security.py"
click node_router "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/task_router.py"
click node_vision_service "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/vision_service.py"
click node_yolo "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/yolo_service.py"
click node_ocr "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/ocr_service.py"
click node_gemini "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/gemini_service.py"
click node_language "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/language_service.py"
click node_conversations "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/conversation_service.py"
click node_storage "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/storage_service.py"
click node_tts "https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/tts_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_workspace,node_camera,node_comparison,node_insights_ui,node_history_ui,node_auth_ui,node_api_client,node_user toneBlue
class node_api_app,node_auth_api,node_chat_api,node_image_api,node_compare_api,node_insights_api,node_tts_api,node_security,node_supabase toneAmber
class node_router,node_vision_service,node_yolo,node_ocr,node_gemini,node_language toneMint
class node_conversations,node_storage,node_tts toneRose
class node_gemini_external toneIndigo
```

## Components

### Web experience

- [Chat workspace](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/frontend/src/components/ConversationWorkspace.tsx): `frontend/src/components/ConversationWorkspace.tsx`
- [Camera capture](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/frontend/src/components/CameraCapture.tsx): `frontend/src/components/CameraCapture.tsx`
- [Image comparison](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/frontend/src/components/ImageComparisonModal.tsx): `frontend/src/components/ImageComparisonModal.tsx`
- [Insights dashboard](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/frontend/src/app/app/insights/page.tsx): `frontend/src/app/app/insights/page.tsx`
- [Conversation history](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/frontend/src/app/app/history/page.tsx): `frontend/src/app/app/history/page.tsx`
- [Authentication UI](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [API client](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### API and access

- [FastAPI application](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication API](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Chat API](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/api/chat.py): `backend/app/api/chat.py`
- [Image API](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/api/images.py): `backend/app/api/images.py`
- [Comparison API](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/api/compare.py): `backend/app/api/compare.py`
- [Insights API](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/api/insights.py): `backend/app/api/insights.py`
- [Speech API](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/api/tts.py): `backend/app/api/tts.py`
- [Identity validation](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/utils/security.py): `backend/app/utils/security.py`

### Visual intelligence

- [Task routing](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/task_router.py): `backend/app/services/task_router.py`
- [Vision analysis](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/vision_service.py): `backend/app/services/vision_service.py`
- [Object detection](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/yolo_service.py): `backend/app/services/yolo_service.py`
- [Text extraction](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/ocr_service.py): `backend/app/services/ocr_service.py`
- [Gemini reasoning](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/gemini_service.py): `backend/app/services/gemini_service.py`
- [Language services](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/language_service.py): `backend/app/services/language_service.py`

### Conversation and media

- [Conversation memory](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/conversation_service.py): `backend/app/services/conversation_service.py`
- [Image storage](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/storage_service.py): `backend/app/services/storage_service.py`
- [Speech synthesis](https://github.com/skyuvaraj2007-web/esec-chatbot/blob/main/backend/app/services/tts_service.py): `backend/app/services/tts_service.py`

### Other components

- **User**
- **Supabase**
- **Gemini service**

## Connections

- User → Chat workspace: uses (evidence: `README.md`)
- User → Camera capture: captures image (evidence: `README.md`)
- User → Image comparison: compares images (evidence: `README.md`)
- User → Insights dashboard: views insights (evidence: `README.md`)
- User → Conversation history: reviews history (evidence: `README.md`)
- User → Authentication UI: authenticates (evidence: `README.md`)
- Chat workspace → API client: requests API
- Image comparison → API client: requests comparison
- Insights dashboard → API client: requests insights
- Conversation history → API client: requests history
- Authentication UI → Supabase: authenticates
- API client → FastAPI application: calls API (evidence: `README.md`)
- FastAPI application → Authentication API: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Chat API: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Image API: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Comparison API: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Insights API: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Speech API: routes to (evidence: `backend/app/main.py`)
- Authentication API → Identity validation: validates identity (evidence: `backend/app/api/auth.py`)
- Chat API → Identity validation: validates identity (evidence: `backend/app/api/chat.py`)
- Chat API → Conversation memory: loads and saves (evidence: `backend/app/api/chat.py`)
- Chat API → Task routing: routes task (evidence: `backend/app/api/chat.py`)
- Chat API → Vision analysis: requests analysis (evidence: `backend/app/api/chat.py`)
- Chat API → Gemini reasoning: generates response (evidence: `backend/app/api/chat.py`)
- Chat API → Speech synthesis: synthesizes speech (evidence: `backend/app/api/chat.py`)
- Image API → Vision analysis: requests analysis (evidence: `backend/app/api/images.py`)
- Image API → Image storage: stores images (evidence: `backend/app/api/images.py`)
- Comparison API → Gemini reasoning: requests comparison (evidence: `backend/app/api/compare.py`)
- Comparison API → Image storage: loads images (evidence: `backend/app/api/compare.py`)
- Insights API → Conversation memory: reads statistics (evidence: `backend/app/api/insights.py`)
- Speech API → Speech synthesis: synthesizes speech (evidence: `backend/app/api/tts.py`)
- Vision analysis → Object detection: detects objects (evidence: `backend/app/services/vision_service.py`)
- Vision analysis → Text extraction: extracts text (evidence: `backend/app/services/vision_service.py`)
- Vision analysis → Gemini reasoning: analyzes image (evidence: `backend/app/services/vision_service.py`)
- Image storage → Supabase: stores or retrieves (evidence: `backend/app/services/storage_service.py`)
- Conversation memory → Supabase: persists records (evidence: `README.md`)
- Gemini reasoning → Gemini service: sends requests (evidence: `backend/app/services/gemini_service.py`)
