# sanjaycharimadipelli/nova-ai-chatbot architecture

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

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

## Overview

This is Nova, a browser-based personal AI chat application. Users register or log in, create and manage conversations, send messages, and receive AI replies; the browser also provides voice input and speech output. The Express server serves the client and dispatches API requests, while route handlers use authentication and Firestore-backed persistence. Chat handling loads conversation history, saves the user message, calls Groq, and stores the assistant reply. The excerpts do not show the messages route or all client behavior, so those connections are kept conservative.

Main entry points: [`server/server.js`](https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/server.js) (Express server), [`server/config/index.js`](https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/config/index.js) (Database config), [`server/routes/chat.js`](https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/routes/chat.js) (Chat handler), [`client/script.js`](https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/client/script.js) (Chat client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser experience"]
  node_client["Chat client<br/>[script.js]"]
  node_webui["Chat interface<br/>[index.html]"]
end

subgraph group_api["API and identity"]
  node_server["Express server<br/>[server.js]"]
  node_authroutes["Auth routes<br/>[auth.js]"]
  node_auth["Auth middleware<br/>[auth.js]"]
end

subgraph group_chat["Conversation and AI"]
  node_convroutes["Conversation routes<br/>[conversations.js]"]
  node_chatroute["Chat handler<br/>[chat.js]"]
  node_messagesroute["Message routes<br/>[messages.js]"]
  node_groq["Groq service<br/>[groqService.js]"]
end

subgraph group_data["Persistence"]
  node_dbconfig["Database config<br/>[index.js]"]
  node_firebase["Firebase adapter<br/>[firebase.js]"]
end

node_user(("User"))
node_browser(("Browser"))
node_firestore[("Firestore")]
node_groqapi{{"Groq API"}}

node_user -->|"uses"| node_browser
node_browser -->|"loads"| node_client
node_client -->|"renders"| node_webui
node_client -->|"sends API requests"| node_server
node_server -->|"serves frontend"| node_client
node_server -->|"dispatches auth"| node_authroutes
node_server -->|"dispatches conversations"| node_convroutes
node_server -->|"dispatches messages"| node_messagesroute
node_server -->|"dispatches chat"| node_chatroute
node_authroutes -->|"gets database"| node_dbconfig
node_auth -->|"gets database"| node_dbconfig
node_convroutes -->|"checks identity"| node_auth
node_convroutes -->|"reads and writes"| node_dbconfig
node_messagesroute -->|"checks identity"| node_auth
node_chatroute -->|"checks identity"| node_auth
node_chatroute -->|"reads and writes"| node_dbconfig
node_chatroute -->|"requests reply"| node_groq
node_groq -->|"requests completion"| node_groqapi
node_dbconfig -->|"initializes and gets"| node_firebase
node_firebase -->|"connects"| node_firestore

click node_client "https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/client/script.js"
click node_webui "https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/client/index.html"
click node_server "https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/server.js"
click node_authroutes "https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/routes/auth.js"
click node_auth "https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/middleware/auth.js"
click node_convroutes "https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/routes/conversations.js"
click node_chatroute "https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/routes/chat.js"
click node_messagesroute "https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/routes/messages.js"
click node_groq "https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/ai/groqService.js"
click node_dbconfig "https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/config/index.js"
click node_firebase "https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/config/firebase.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_client,node_webui,node_user,node_browser toneBlue
class node_server,node_authroutes,node_auth,node_firestore toneAmber
class node_convroutes,node_chatroute,node_messagesroute,node_groq,node_groqapi toneMint
class node_dbconfig,node_firebase toneRose
```

## Components

### Browser experience

- [Chat client](https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/client/script.js): `client/script.js`
- [Chat interface](https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/client/index.html): `client/index.html`

### API and identity

- [Express server](https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/server.js): `server/server.js`
- [Auth routes](https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/routes/auth.js): `server/routes/auth.js`
- [Auth middleware](https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/middleware/auth.js): `server/middleware/auth.js`

### Conversation and AI

- [Conversation routes](https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/routes/conversations.js): `server/routes/conversations.js`
- [Chat handler](https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/routes/chat.js): `server/routes/chat.js`
- [Message routes](https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/routes/messages.js): `server/routes/messages.js`
- [Groq service](https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/ai/groqService.js): `server/ai/groqService.js`

### Persistence

- [Database config](https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/config/index.js): `server/config/index.js`
- [Firebase adapter](https://github.com/sanjaycharimadipelli/nova-ai-chatbot/blob/main/server/config/firebase.js): `server/config/firebase.js`

### Other components

- **User**
- **Browser**
- **Firestore**
- **Groq API**

## Connections

- User → Browser: uses
- Browser → Chat client: loads
- Chat client → Chat interface: renders
- Chat client → Express server: sends API requests
- Express server → Chat client: serves frontend
- Express server → Auth routes: dispatches auth
- Express server → Conversation routes: dispatches conversations
- Express server → Message routes: dispatches messages
- Express server → Chat handler: dispatches chat
- Auth routes → Database config: gets database
- Auth middleware → Database config: gets database
- Conversation routes → Auth middleware: checks identity
- Conversation routes → Database config: reads and writes
- Message routes → Auth middleware: checks identity
- Chat handler → Auth middleware: checks identity
- Chat handler → Database config: reads and writes
- Chat handler → Groq service: requests reply
- Groq service → Groq API: requests completion
- Database config → Firebase adapter: initializes and gets
- Firebase adapter → Firestore: connects
