# tusharkesarwani/ai-chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/tusharkesarwani/ai-chatbot
- Repository: https://github.com/tusharkesarwani/ai-chatbot

## Overview

This is an ed-tech course-question chatbot with a React client and Express/MongoDB backend. Users submit questions in the chat UI; the backend searches FAQ records and returns matching answers or a fallback message. The README also describes escalation, satisfaction feedback, sales follow-up, and performance monitoring. The excerpts show feedback endpoints and basic web-vitals reporting, but not a working client escalation/feedback flow or sales integration; those links are therefore documented or left unverified rather than presented as implemented calls.

Main entry points: [`chatbot-backend/controllers/chatbotController.js`](https://github.com/tusharkesarwani/ai-chatbot/blob/main/chatbot-backend/controllers/chatbotController.js) (Query and feedback), [`ai-chatbot-frontend/src/App.js`](https://github.com/tusharkesarwani/ai-chatbot/blob/main/ai-chatbot-frontend/src/App.js) (Chat app), [`ai-chatbot-frontend/src/components/ChatInterface.js`](https://github.com/tusharkesarwani/ai-chatbot/blob/main/ai-chatbot-frontend/src/components/ChatInterface.js) (Chat interface), [`chatbot-backend/server.js`](https://github.com/tusharkesarwani/ai-chatbot/blob/main/chatbot-backend/server.js) (HTTP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Chat client"]
  node_app["Chat app<br/>[App.js]"]
  node_chat["Chat interface<br/>[ChatInterface.js]"]
  node_vitals["Web vitals<br/>[reportWebVitals.js]"]
  node_monitoring["Performance monitoring<br/>[reportWebVitals.js]"]
end

subgraph group_api["Chat API"]
  node_server["HTTP server<br/>[server.js]"]
  node_routes["Chat routes<br/>[chatbotRoutes.js]"]
end

subgraph group_knowledge["FAQ and support"]
  node_query["Query and feedback"]
  node_faq[("FAQ records<br/>[FAQ.js]")]
  node_doubt["Doubt assistant"]
  node_sales["Sales follow-up"]
end

node_visitor(("Course seeker"))

node_visitor -->|"uses"| node_app
node_app -->|"renders"| node_chat
node_chat -->|"posts query"| node_server
node_server -->|"mounts"| node_routes
node_routes -->|"dispatches"| node_query
node_query -->|"searches"| node_faq
node_server -->|"connects store"| node_faq
node_routes -->|"routes feedback"| node_query
node_chat -.->|"escalates"| node_doubt
node_query -.->|"shares transcripts"| node_sales
node_app -->|"starts"| node_vitals
node_vitals -.->|"reports metrics"| node_monitoring

click node_app "https://github.com/tusharkesarwani/ai-chatbot/blob/main/ai-chatbot-frontend/src/App.js"
click node_chat "https://github.com/tusharkesarwani/ai-chatbot/blob/main/ai-chatbot-frontend/src/components/ChatInterface.js"
click node_vitals "https://github.com/tusharkesarwani/ai-chatbot/blob/main/ai-chatbot-frontend/src/reportWebVitals.js"
click node_server "https://github.com/tusharkesarwani/ai-chatbot/blob/main/chatbot-backend/server.js"
click node_routes "https://github.com/tusharkesarwani/ai-chatbot/blob/main/chatbot-backend/routes/chatbotRoutes.js"
click node_query "https://github.com/tusharkesarwani/ai-chatbot/blob/main/chatbot-backend/controllers/chatbotController.js"
click node_faq "https://github.com/tusharkesarwani/ai-chatbot/blob/main/chatbot-backend/models/FAQ.js"
click node_doubt "https://github.com/tusharkesarwani/ai-chatbot/blob/main/chatbot-backend/controllers/doubtAssistantController.js"
click node_sales "https://github.com/tusharkesarwani/ai-chatbot/tree/main/chatbot-backend"
click node_monitoring "https://github.com/tusharkesarwani/ai-chatbot/blob/main/ai-chatbot-frontend/src/reportWebVitals.js"

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_chat,node_vitals,node_monitoring toneBlue
class node_server,node_routes toneAmber
class node_query,node_faq,node_doubt,node_sales toneMint
class node_visitor toneIndigo
```

## Components

### Chat client

- [Chat app](https://github.com/tusharkesarwani/ai-chatbot/blob/main/ai-chatbot-frontend/src/App.js): `ai-chatbot-frontend/src/App.js`
- [Chat interface](https://github.com/tusharkesarwani/ai-chatbot/blob/main/ai-chatbot-frontend/src/components/ChatInterface.js): `ai-chatbot-frontend/src/components/ChatInterface.js`
- [Web vitals](https://github.com/tusharkesarwani/ai-chatbot/blob/main/ai-chatbot-frontend/src/reportWebVitals.js): `ai-chatbot-frontend/src/reportWebVitals.js`
- [Performance monitoring](https://github.com/tusharkesarwani/ai-chatbot/blob/main/ai-chatbot-frontend/src/reportWebVitals.js): `ai-chatbot-frontend/src/reportWebVitals.js`

### Chat API

- [HTTP server](https://github.com/tusharkesarwani/ai-chatbot/blob/main/chatbot-backend/server.js): `chatbot-backend/server.js`
- [Chat routes](https://github.com/tusharkesarwani/ai-chatbot/blob/main/chatbot-backend/routes/chatbotRoutes.js): `chatbot-backend/routes/chatbotRoutes.js`

### FAQ and support

- [Query and feedback](https://github.com/tusharkesarwani/ai-chatbot/blob/main/chatbot-backend/controllers/chatbotController.js): `chatbot-backend/controllers/chatbotController.js`
- [FAQ records](https://github.com/tusharkesarwani/ai-chatbot/blob/main/chatbot-backend/models/FAQ.js): `chatbot-backend/models/FAQ.js`
- [Doubt assistant](https://github.com/tusharkesarwani/ai-chatbot/blob/main/chatbot-backend/controllers/doubtAssistantController.js): `chatbot-backend/controllers/doubtAssistantController.js`
- [Sales follow-up](https://github.com/tusharkesarwani/ai-chatbot/tree/main/chatbot-backend): `chatbot-backend`

### Other components

- **Course seeker**

## Connections

- Course seeker → Chat app: uses (evidence: `Readme.md`)
- Chat app → Chat interface: renders (evidence: `ai-chatbot-frontend/src/App.js`)
- Chat interface → HTTP server: posts query (evidence: `ai-chatbot-frontend/src/components/ChatInterface.js`)
- HTTP server → Chat routes: mounts (evidence: `chatbot-backend/server.js`)
- Chat routes → Query and feedback: dispatches (evidence: `chatbot-backend/routes/chatbotRoutes.js`)
- Query and feedback → FAQ records: searches (evidence: `chatbot-backend/controllers/chatbotController.js`)
- HTTP server → FAQ records: connects store (evidence: `chatbot-backend/server.js`)
- Chat routes → Query and feedback: routes feedback (evidence: `chatbot-backend/routes/chatbotRoutes.js`)
- Chat interface → Doubt assistant: escalates (evidence: `Readme.md`)
- Query and feedback → Sales follow-up: shares transcripts (evidence: `Readme.md`)
- Chat app → Web vitals: starts (evidence: `ai-chatbot-frontend/src/index.js`)
- Web vitals → Performance monitoring: reports metrics (evidence: `ai-chatbot-frontend/src/reportWebVitals.js`)
