# sherinovia19/nexora-ai architecture

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

- Interactive diagram: https://gitdiagram.com/sherinovia19/nexora-ai
- Repository: https://github.com/sherinovia19/nexora-ai

## Overview

Nexora AI’s main workflow runs from a user’s browser through the Flask chat endpoint to a Gemini response, then displays that response in the conversation. The backend validates requests and assigns conversation IDs; the chatbot builds bounded context from per-conversation in-memory history and supplies a fixed system prompt to Gemini. The README also documents the web interface, error handling, and environment-based API-key configuration. Source excerpts show the backend and chatbot calls; the browser-to-endpoint link is visible in the JavaScript. Other UI wiring is not shown in the excerpts.

Main entry points: [`app.py`](https://github.com/sherinovia19/nexora-ai/blob/main/app.py) (Chat API), [`chatbot.py`](https://github.com/sherinovia19/nexora-ai/blob/main/chatbot.py) (Chat orchestration), [`static/script.js`](https://github.com/sherinovia19/nexora-ai/blob/main/static/script.js) (Chat interaction), [`templates/index.html`](https://github.com/sherinovia19/nexora-ai/blob/main/templates/index.html) (Chat page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_view["Chat page<br/>[index.html]"]
  node_browser["Chat interaction<br/>[script.js]"]
end

subgraph group_backend["Flask backend"]
  node_endpoint["Chat API<br/>[app.py]"]
  node_validation["Request validation<br/>[app.py]"]
  node_errors["API error handling<br/>[app.py]"]
end

subgraph group_chat["Conversation and AI"]
  node_chatbot["Chat orchestration<br/>[chatbot.py]"]
  node_context["Context and prompt<br/>[chatbot.py]"]
  node_memory["Conversation history<br/>[chatbot.py]"]
end

node_user(("Chat user"))
node_gemini{{"Gemini API"}}

node_user -->|"sends messages"| node_browser
node_endpoint -->|"renders page"| node_view
node_browser -->|"posts message"| node_endpoint
node_endpoint -->|"validates input"| node_validation
node_endpoint -->|"calls chat"| node_chatbot
node_endpoint -->|"handles failures"| node_errors
node_chatbot -->|"builds context"| node_context
node_chatbot -->|"reads and writes"| node_memory
node_chatbot -->|"sends prompt and context"| node_gemini
node_gemini -->|"returns response"| node_chatbot

click node_view "https://github.com/sherinovia19/nexora-ai/blob/main/templates/index.html"
click node_browser "https://github.com/sherinovia19/nexora-ai/blob/main/static/script.js"
click node_endpoint "https://github.com/sherinovia19/nexora-ai/blob/main/app.py"
click node_validation "https://github.com/sherinovia19/nexora-ai/blob/main/app.py"
click node_errors "https://github.com/sherinovia19/nexora-ai/blob/main/app.py"
click node_chatbot "https://github.com/sherinovia19/nexora-ai/blob/main/chatbot.py"
click node_context "https://github.com/sherinovia19/nexora-ai/blob/main/chatbot.py"
click node_memory "https://github.com/sherinovia19/nexora-ai/blob/main/chatbot.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_view,node_browser,node_user toneBlue
class node_endpoint,node_validation,node_errors toneAmber
class node_chatbot,node_context,node_memory,node_gemini toneMint
```

## Components

### Web interface

- [Chat page](https://github.com/sherinovia19/nexora-ai/blob/main/templates/index.html): `templates/index.html`
- [Chat interaction](https://github.com/sherinovia19/nexora-ai/blob/main/static/script.js): `static/script.js`

### Flask backend

- [Chat API](https://github.com/sherinovia19/nexora-ai/blob/main/app.py): `app.py`
- [Request validation](https://github.com/sherinovia19/nexora-ai/blob/main/app.py): `app.py`
- [API error handling](https://github.com/sherinovia19/nexora-ai/blob/main/app.py): `app.py`

### Conversation and AI

- [Chat orchestration](https://github.com/sherinovia19/nexora-ai/blob/main/chatbot.py): `chatbot.py`
- [Context and prompt](https://github.com/sherinovia19/nexora-ai/blob/main/chatbot.py): `chatbot.py`
- [Conversation history](https://github.com/sherinovia19/nexora-ai/blob/main/chatbot.py): `chatbot.py`

### Other components

- **Chat user**
- **Gemini API**

## Connections

- Chat user → Chat interaction: sends messages (evidence: `README.md`)
- Chat API → Chat page: renders page (evidence: `app.py`)
- Chat interaction → Chat API: posts message (evidence: `static/script.js`)
- Chat API → Request validation: validates input (evidence: `app.py`)
- Chat API → Chat orchestration: calls chat (evidence: `app.py`)
- Chat API → API error handling: handles failures (evidence: `app.py`)
- Chat orchestration → Context and prompt: builds context (evidence: `chatbot.py`)
- Chat orchestration → Conversation history: reads and writes (evidence: `chatbot.py`)
- Chat orchestration → Gemini API: sends prompt and context (evidence: `chatbot.py`)
- Gemini API → Chat orchestration: returns response (evidence: `chatbot.py`)
