# rclalithkumar/nexaflow-ai architecture

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

- Interactive diagram: https://gitdiagram.com/rclalithkumar/nexaflow-ai
- Repository: https://github.com/rclalithkumar/nexaflow-ai

## Overview

NexaFlow AI is an enterprise support chatbot: users submit text or dictated messages, the backend classifies intent, generates a persona-specific reply, optionally creates a support ticket, saves the conversation, and returns the result. The UI also reloads history; separate ticket and analytics endpoints expose operational data. The sampled backend shows the classification, prompting, ticketing, and persistence logic in one server module. The dashboard exists but is documented as not yet routed. Edges reflect shown calls or README-described capabilities; unsampled integrations are not inferred.

Main entry points: [`backend/server.js`](https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js) (API and chat workflow), [`frontend/vite-project/src/pages/ChatPage.jsx`](https://github.com/rclalithkumar/nexaflow-ai/blob/main/frontend/vite-project/src/pages/ChatPage.jsx) (Chat interface), [`backend/models/Chat.js`](https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/models/Chat.js) (Chat records), [`backend/models/Ticket.js`](https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/models/Ticket.js) (Ticket records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Chat experience"]
  node_app["App shell<br/>[App.jsx]"]
  node_chat_ui["Chat interface<br/>[ChatPage.jsx]"]
  node_speech["Browser speech recognition"]
  node_dashboard["Analytics dashboard<br/>[Dashboard.jsx]"]
end

subgraph group_conversation["Conversation handling"]
  node_server["API and chat workflow<br/>[server.js]"]
  node_classifier["Intent classification<br/>[server.js]"]
  node_fallback["Keyword fallback<br/>[server.js]"]
  node_persona["Persona reply generation<br/>[server.js]"]
end

subgraph group_operations["Support operations"]
  node_ticket_workflow["Automatic ticketing<br/>[server.js]"]
  node_analytics_api["Analytics endpoint<br/>[server.js]"]
  node_ticket_api["Ticket listing endpoint<br/>[server.js]"]
  node_history_api["Chat history endpoint<br/>[server.js]"]
end

subgraph group_persistence["Persistence"]
  node_chat_model[("Chat records<br/>[Chat.js]")]
  node_ticket_model[("Ticket records<br/>[Ticket.js]")]
end

node_user(("Customer"))
node_groq["Groq LLM"]
node_mongodb[("MongoDB")]

node_user -->|"sends message"| node_chat_ui
node_app -->|"renders"| node_chat_ui
node_chat_ui -.->|"dictates input"| node_speech
node_chat_ui -->|"posts chat"| node_server
node_chat_ui -->|"loads history"| node_history_api
node_dashboard -->|"fetches metrics"| node_analytics_api
node_server -->|"classifies message"| node_classifier
node_classifier -->|"requests intent"| node_groq
node_classifier -->|"uses on failure"| node_fallback
node_server -->|"selects prompt"| node_persona
node_persona -->|"generates reply"| node_groq
node_server -->|"checks ticket rule"| node_ticket_workflow
node_ticket_workflow -->|"creates ticket"| node_ticket_model
node_server -->|"saves conversation"| node_chat_model
node_history_api -->|"queries history"| node_chat_model
node_ticket_api -->|"queries tickets"| node_ticket_model
node_analytics_api -->|"counts and groups"| node_chat_model
node_analytics_api -->|"counts tickets"| node_ticket_model
node_server -->|"connects to"| node_mongodb
node_chat_ui -->|"shows reply"| node_user

click node_app "https://github.com/rclalithkumar/nexaflow-ai/blob/main/frontend/vite-project/src/App.jsx"
click node_chat_ui "https://github.com/rclalithkumar/nexaflow-ai/blob/main/frontend/vite-project/src/pages/ChatPage.jsx"
click node_dashboard "https://github.com/rclalithkumar/nexaflow-ai/blob/main/frontend/vite-project/src/pages/Dashboard.jsx"
click node_server "https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js"
click node_classifier "https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js"
click node_fallback "https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js"
click node_persona "https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js"
click node_ticket_workflow "https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js"
click node_analytics_api "https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js"
click node_ticket_api "https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js"
click node_history_api "https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js"
click node_chat_model "https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/models/Chat.js"
click node_ticket_model "https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/models/Ticket.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_ui,node_speech,node_dashboard toneBlue
class node_server,node_classifier,node_fallback,node_persona,node_mongodb toneAmber
class node_ticket_workflow,node_analytics_api,node_ticket_api,node_history_api toneMint
class node_chat_model,node_ticket_model toneRose
class node_user,node_groq toneIndigo
```

## Components

### Chat experience

- [App shell](https://github.com/rclalithkumar/nexaflow-ai/blob/main/frontend/vite-project/src/App.jsx): `frontend/vite-project/src/App.jsx`
- [Chat interface](https://github.com/rclalithkumar/nexaflow-ai/blob/main/frontend/vite-project/src/pages/ChatPage.jsx): `frontend/vite-project/src/pages/ChatPage.jsx`
- **Browser speech recognition**
- [Analytics dashboard](https://github.com/rclalithkumar/nexaflow-ai/blob/main/frontend/vite-project/src/pages/Dashboard.jsx): `frontend/vite-project/src/pages/Dashboard.jsx`

### Conversation handling

- [API and chat workflow](https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js): `backend/server.js`
- [Intent classification](https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js): `backend/server.js`
- [Keyword fallback](https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js): `backend/server.js`
- [Persona reply generation](https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js): `backend/server.js`

### Support operations

- [Automatic ticketing](https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js): `backend/server.js`
- [Analytics endpoint](https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js): `backend/server.js`
- [Ticket listing endpoint](https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js): `backend/server.js`
- [Chat history endpoint](https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/server.js): `backend/server.js`

### Persistence

- [Chat records](https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/models/Chat.js): `backend/models/Chat.js`
- [Ticket records](https://github.com/rclalithkumar/nexaflow-ai/blob/main/backend/models/Ticket.js): `backend/models/Ticket.js`

### Other components

- **Customer**
- **Groq LLM**
- **MongoDB**

## Connections

- Customer → Chat interface: sends message (evidence: `frontend/vite-project/src/pages/ChatPage.jsx`)
- App shell → Chat interface: renders (evidence: `frontend/vite-project/src/App.jsx`)
- Chat interface → Browser speech recognition: dictates input (evidence: `README.md`)
- Chat interface → API and chat workflow: posts chat (evidence: `frontend/vite-project/src/pages/ChatPage.jsx`)
- Chat interface → Chat history endpoint: loads history (evidence: `frontend/vite-project/src/pages/ChatPage.jsx`)
- Analytics dashboard → Analytics endpoint: fetches metrics (evidence: `frontend/vite-project/src/pages/Dashboard.jsx`)
- API and chat workflow → Intent classification: classifies message (evidence: `backend/server.js`)
- Intent classification → Groq LLM: requests intent (evidence: `backend/server.js`)
- Intent classification → Keyword fallback: uses on failure (evidence: `backend/server.js`)
- API and chat workflow → Persona reply generation: selects prompt (evidence: `backend/server.js`)
- Persona reply generation → Groq LLM: generates reply (evidence: `backend/server.js`)
- API and chat workflow → Automatic ticketing: checks ticket rule (evidence: `backend/server.js`)
- Automatic ticketing → Ticket records: creates ticket (evidence: `backend/server.js`)
- API and chat workflow → Chat records: saves conversation (evidence: `backend/server.js`)
- Chat history endpoint → Chat records: queries history (evidence: `backend/server.js`)
- Ticket listing endpoint → Ticket records: queries tickets (evidence: `backend/server.js`)
- Analytics endpoint → Chat records: counts and groups (evidence: `backend/server.js`)
- Analytics endpoint → Ticket records: counts tickets (evidence: `backend/server.js`)
- API and chat workflow → MongoDB: connects to (evidence: `backend/server.js`)
- Chat interface → Customer: shows reply (evidence: `frontend/vite-project/src/pages/ChatPage.jsx`)
