# beni-miansi/nexaa architecture

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

- Interactive diagram: https://gitdiagram.com/beni-miansi/nexaa
- Repository: https://github.com/beni-miansi/nexaa

## Overview

NexaAI is a web chatbot with account authentication, configurable specialist assistants and models, streamed AI replies, and persisted, searchable conversations. Users register or log in, then enter the protected chat, manage conversations and settings, and send messages; the chat page handles the streamed response. The React client calls an Express API, which implements authentication, chat, and conversation/history endpoints backed by SQLite and the Groq API. The graph reflects documented capabilities, but unsampled server and database details are not expanded beyond the evidence shown.

Main entry points: [`src/pages/ChatPage.jsx`](https://github.com/beni-miansi/nexaa/blob/main/src/pages/ChatPage.jsx) (Chat page), [`src/App.jsx`](https://github.com/beni-miansi/nexaa/blob/main/src/App.jsx) (Route application), [`src/api.js`](https://github.com/beni-miansi/nexaa/blob/main/src/api.js) (API client), [`db.js`](https://github.com/beni-miansi/nexaa/blob/main/db.js) (Database access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React application"]
  node_app["Route application<br/>[App.jsx]"]
  node_context["App state<br/>[AppContext.jsx]"]
  node_login["Login page<br/>[LoginPage.jsx]"]
  node_register["Registration page<br/>[RegisterPage.jsx]"]
  node_chatpage["Chat page<br/>[ChatPage.jsx]"]
  node_api["API client<br/>[api.js]"]
end

subgraph group_interface["Chat interface"]
  node_sidebar["Chat sidebar<br/>[Sidebar.jsx]"]
  node_conversations["Conversation list"]
  node_messages["Message display<br/>[ChatMessages.jsx]"]
  node_input["Message input<br/>[MessageInput.jsx]"]
  node_empty["Empty chat state<br/>[EmptyState.jsx]"]
  node_profile["Profile settings<br/>[ProfileModal.jsx]"]
  node_toast["Toast notifications<br/>[Toast.jsx]"]
end

subgraph group_backend["API and domain"]
  node_auth["Authentication routes<br/>[server.js]"]
  node_chat["Chat and streaming<br/>[server.js]"]
  node_history["Conversation and history routes<br/>[server.js]"]
end

subgraph group_services["Persistence and AI"]
  node_db["Database access<br/>[db.js]"]
  node_sqlite[("SQLite database")]
  node_groq{{"Groq API"}}
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"reads session"| node_context
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_register
node_app -->|"guards route"| node_chatpage
node_app -->|"renders"| node_toast
node_login -->|"calls login"| node_api
node_register -->|"calls register"| node_api
node_login -->|"sets user"| node_context
node_register -->|"sets user"| node_context
node_chatpage -->|"calls endpoints"| node_api
node_chatpage -->|"renders"| node_sidebar
node_chatpage -->|"renders"| node_messages
node_chatpage -->|"renders"| node_input
node_chatpage -->|"renders"| node_empty
node_chatpage -->|"renders"| node_profile
node_sidebar -->|"renders"| node_conversations
node_api -->|"HTTP requests"| node_auth
node_api -->|"streams request"| node_chat
node_api -->|"HTTP requests"| node_history
node_auth -->|"reads and writes"| node_db
node_history -->|"reads and writes"| node_db
node_chat -->|"loads messages"| node_db
node_db -->|"persists data"| node_sqlite
node_chat -.->|"requests AI"| node_groq

click node_app "https://github.com/beni-miansi/nexaa/blob/main/src/App.jsx"
click node_context "https://github.com/beni-miansi/nexaa/blob/main/src/context/AppContext.jsx"
click node_login "https://github.com/beni-miansi/nexaa/blob/main/src/pages/LoginPage.jsx"
click node_register "https://github.com/beni-miansi/nexaa/blob/main/src/pages/RegisterPage.jsx"
click node_chatpage "https://github.com/beni-miansi/nexaa/blob/main/src/pages/ChatPage.jsx"
click node_api "https://github.com/beni-miansi/nexaa/blob/main/src/api.js"
click node_sidebar "https://github.com/beni-miansi/nexaa/blob/main/src/components/Sidebar.jsx"
click node_conversations "https://github.com/beni-miansi/nexaa/blob/main/src/components/ConversationList.jsx"
click node_messages "https://github.com/beni-miansi/nexaa/blob/main/src/components/ChatMessages.jsx"
click node_input "https://github.com/beni-miansi/nexaa/blob/main/src/components/MessageInput.jsx"
click node_empty "https://github.com/beni-miansi/nexaa/blob/main/src/components/EmptyState.jsx"
click node_profile "https://github.com/beni-miansi/nexaa/blob/main/src/components/ProfileModal.jsx"
click node_toast "https://github.com/beni-miansi/nexaa/blob/main/src/components/Toast.jsx"
click node_auth "https://github.com/beni-miansi/nexaa/blob/main/server.js"
click node_chat "https://github.com/beni-miansi/nexaa/blob/main/server.js"
click node_history "https://github.com/beni-miansi/nexaa/blob/main/server.js"
click node_db "https://github.com/beni-miansi/nexaa/blob/main/db.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_context,node_login,node_register,node_chatpage,node_api,node_user toneBlue
class node_sidebar,node_conversations,node_messages,node_input,node_empty,node_profile,node_toast toneAmber
class node_auth,node_chat,node_history toneMint
class node_db,node_sqlite,node_groq toneRose
```

## Components

### React application

- [Route application](https://github.com/beni-miansi/nexaa/blob/main/src/App.jsx): `src/App.jsx`
- [App state](https://github.com/beni-miansi/nexaa/blob/main/src/context/AppContext.jsx): `src/context/AppContext.jsx`
- [Login page](https://github.com/beni-miansi/nexaa/blob/main/src/pages/LoginPage.jsx): `src/pages/LoginPage.jsx`
- [Registration page](https://github.com/beni-miansi/nexaa/blob/main/src/pages/RegisterPage.jsx): `src/pages/RegisterPage.jsx`
- [Chat page](https://github.com/beni-miansi/nexaa/blob/main/src/pages/ChatPage.jsx): `src/pages/ChatPage.jsx`
- [API client](https://github.com/beni-miansi/nexaa/blob/main/src/api.js): `src/api.js`

### Chat interface

- [Chat sidebar](https://github.com/beni-miansi/nexaa/blob/main/src/components/Sidebar.jsx): `src/components/Sidebar.jsx`
- [Conversation list](https://github.com/beni-miansi/nexaa/blob/main/src/components/ConversationList.jsx): `src/components/ConversationList.jsx`
- [Message display](https://github.com/beni-miansi/nexaa/blob/main/src/components/ChatMessages.jsx): `src/components/ChatMessages.jsx`
- [Message input](https://github.com/beni-miansi/nexaa/blob/main/src/components/MessageInput.jsx): `src/components/MessageInput.jsx`
- [Empty chat state](https://github.com/beni-miansi/nexaa/blob/main/src/components/EmptyState.jsx): `src/components/EmptyState.jsx`
- [Profile settings](https://github.com/beni-miansi/nexaa/blob/main/src/components/ProfileModal.jsx): `src/components/ProfileModal.jsx`
- [Toast notifications](https://github.com/beni-miansi/nexaa/blob/main/src/components/Toast.jsx): `src/components/Toast.jsx`

### API and domain

- [Authentication routes](https://github.com/beni-miansi/nexaa/blob/main/server.js): `server.js`
- [Chat and streaming](https://github.com/beni-miansi/nexaa/blob/main/server.js): `server.js`
- [Conversation and history routes](https://github.com/beni-miansi/nexaa/blob/main/server.js): `server.js`

### Persistence and AI

- [Database access](https://github.com/beni-miansi/nexaa/blob/main/db.js): `db.js`
- **SQLite database**
- **Groq API**

### Other components

- **User**

## Connections

- User → Route application: uses (evidence: `src/App.jsx`)
- Route application → App state: reads session (evidence: `src/App.jsx`)
- Route application → Login page: routes to (evidence: `src/App.jsx`)
- Route application → Registration page: routes to (evidence: `src/App.jsx`)
- Route application → Chat page: guards route (evidence: `src/App.jsx`)
- Route application → Toast notifications: renders (evidence: `src/App.jsx`)
- Login page → API client: calls login (evidence: `src/pages/LoginPage.jsx`)
- Registration page → API client: calls register (evidence: `src/pages/RegisterPage.jsx`)
- Login page → App state: sets user (evidence: `src/pages/LoginPage.jsx`)
- Registration page → App state: sets user (evidence: `src/pages/RegisterPage.jsx`)
- Chat page → API client: calls endpoints (evidence: `src/pages/ChatPage.jsx`)
- Chat page → Chat sidebar: renders (evidence: `src/pages/ChatPage.jsx`)
- Chat page → Message display: renders (evidence: `src/pages/ChatPage.jsx`)
- Chat page → Message input: renders (evidence: `src/pages/ChatPage.jsx`)
- Chat page → Empty chat state: renders (evidence: `src/pages/ChatPage.jsx`)
- Chat page → Profile settings: renders (evidence: `src/pages/ChatPage.jsx`)
- Chat sidebar → Conversation list: renders (evidence: `src/components/Sidebar.jsx`)
- API client → Authentication routes: HTTP requests (evidence: `src/api.js`)
- API client → Chat and streaming: streams request (evidence: `src/api.js`)
- API client → Conversation and history routes: HTTP requests (evidence: `src/api.js`)
- Authentication routes → Database access: reads and writes (evidence: `server.js`)
- Conversation and history routes → Database access: reads and writes (evidence: `server.js`)
- Chat and streaming → Database access: loads messages (evidence: `server.js`)
- Database access → SQLite database: persists data (evidence: `db.js`)
- Chat and streaming → Groq API: requests AI (evidence: `README.md`)
