# omrajnexus31173/nexus-ai-powered-student-chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/omrajnexus31173/nexus-ai-powered-student-chatbot
- Repository: https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot

## Overview

GSFC Campus AI is a campus-question chat application: users ask in the web interface, conversation state prepares bounded context, the backend validates and orchestrates a request to a configured AI provider, and the reply returns to the conversation UI. The graph includes the documented chat, persistence, retry, sample-migration, and UI capabilities. Evidence is limited to the README and indexed excerpts; unsampled subsystem links are omitted unless documented.

Main entry points: [`src/App.tsx`](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/App.tsx) (App shell), [`backend/server.mjs`](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/server.mjs) (HTTP server), [`src/hooks/useConversations.ts`](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/hooks/useConversations.ts) (Conversation controller), [`backend/ai/aiService.mjs`](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/ai/aiService.mjs) (Response orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Chat interface"]
  node_app["App shell<br/>[App.tsx]"]
  node_sidebar["Conversation sidebar<br/>[Sidebar.tsx]"]
  node_welcome["Welcome screen<br/>[WelcomeScreen.tsx]"]
  node_input["Chat input<br/>[ChatInput.tsx]"]
  node_messages["Message display<br/>[Messages.tsx]"]
  node_panel["Settings panels<br/>[PanelDialog.tsx]"]
  node_brand["Brand mark<br/>[Brand.tsx]"]
end

subgraph group_conversation["Conversation state"]
  node_conversation_hook["Conversation controller"]
  node_conversation_utils["Conversation migration<br/>[conversations.ts]"]
  node_samples["Sample conversations<br/>[samples.ts]"]
  node_browser_storage[("Browser local storage")]
  node_chat_client["Chat API client<br/>[chat.ts]"]
end

subgraph group_api["HTTP API"]
  node_api_app["API middleware<br/>[app.mjs]"]
  node_chat_route["Chat route<br/>[chat.mjs]"]
  node_validation["Request validation<br/>[validation.mjs]"]
end

subgraph group_ai["AI response"]
  node_ai_service["Response orchestration<br/>[aiService.mjs]"]
  node_prompt["GSFC system prompt<br/>[prompts.mjs]"]
  node_provider["AI transport<br/>[provider.mjs]"]
end

subgraph group_runtime["Application runtime"]
  node_server["HTTP server<br/>[server.mjs]"]
  node_config["AI configuration<br/>[config.mjs]"]
end

node_student(("Student"))
node_api_request(("Chat requester"))
node_external_ai(("Configured AI provider"))

node_student -->|"uses"| node_app
node_app -->|"renders"| node_sidebar
node_app -->|"renders"| node_welcome
node_app -->|"renders"| node_input
node_app -->|"renders"| node_messages
node_app -->|"renders"| node_panel
node_messages -->|"renders"| node_brand
node_app -->|"uses"| node_conversation_hook
node_conversation_hook -->|"requests reply"| node_chat_client
node_conversation_hook -->|"loads history"| node_conversation_utils
node_conversation_utils -->|"loads fallback"| node_samples
node_conversation_hook -->|"persists chats"| node_browser_storage
node_app -->|"checks readiness"| node_api_app
node_chat_client -->|"posts request"| node_api_request
node_api_request -->|"sends JSON"| node_api_app
node_server -->|"loads settings"| node_config
node_server -->|"creates transport"| node_provider
node_server -->|"creates service"| node_ai_service
node_server -->|"starts app"| node_api_app
node_api_app -->|"mounts route"| node_chat_route
node_chat_route -->|"validates input"| node_validation
node_chat_route -->|"generates reply"| node_ai_service
node_ai_service -->|"uses instructions"| node_prompt
node_ai_service -->|"requests completion"| node_provider
node_provider -->|"sends completion"| node_external_ai
node_config -->|"configures transport"| node_provider

click node_app "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/App.tsx"
click node_sidebar "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/components/Sidebar.tsx"
click node_welcome "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/components/WelcomeScreen.tsx"
click node_input "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/components/ChatInput.tsx"
click node_messages "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/components/Messages.tsx"
click node_panel "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/components/PanelDialog.tsx"
click node_brand "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/components/Brand.tsx"
click node_conversation_hook "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/hooks/useConversations.ts"
click node_conversation_utils "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/utils/conversations.ts"
click node_samples "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/services/samples.ts"
click node_chat_client "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/services/chat.ts"
click node_server "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/server.mjs"
click node_config "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/config.mjs"
click node_api_app "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/app.mjs"
click node_chat_route "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/routes/chat.mjs"
click node_validation "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/middleware/validation.mjs"
click node_ai_service "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/ai/aiService.mjs"
click node_prompt "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/ai/prompts.mjs"
click node_provider "https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/ai/provider.mjs"

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_sidebar,node_welcome,node_input,node_messages,node_panel,node_brand toneBlue
class node_conversation_hook,node_conversation_utils,node_samples,node_browser_storage,node_chat_client toneAmber
class node_api_app,node_chat_route,node_validation,node_api_request toneMint
class node_ai_service,node_prompt,node_provider toneRose
class node_server,node_config,node_student,node_external_ai toneIndigo
```

## Components

### Chat interface

- [App shell](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/App.tsx): `src/App.tsx`
- [Conversation sidebar](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/components/Sidebar.tsx): `src/components/Sidebar.tsx`
- [Welcome screen](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/components/WelcomeScreen.tsx): `src/components/WelcomeScreen.tsx`
- [Chat input](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/components/ChatInput.tsx): `src/components/ChatInput.tsx`
- [Message display](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/components/Messages.tsx): `src/components/Messages.tsx`
- [Settings panels](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/components/PanelDialog.tsx): `src/components/PanelDialog.tsx`
- [Brand mark](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/components/Brand.tsx): `src/components/Brand.tsx`

### Conversation state

- [Conversation controller](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/hooks/useConversations.ts): `src/hooks/useConversations.ts`
- [Conversation migration](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/utils/conversations.ts): `src/utils/conversations.ts`
- [Sample conversations](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/services/samples.ts): `src/services/samples.ts`
- **Browser local storage**
- [Chat API client](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/src/services/chat.ts): `src/services/chat.ts`

### HTTP API

- [API middleware](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/app.mjs): `backend/app.mjs`
- [Chat route](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/routes/chat.mjs): `backend/routes/chat.mjs`
- [Request validation](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/middleware/validation.mjs): `backend/middleware/validation.mjs`

### AI response

- [Response orchestration](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/ai/aiService.mjs): `backend/ai/aiService.mjs`
- [GSFC system prompt](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/ai/prompts.mjs): `backend/ai/prompts.mjs`
- [AI transport](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/ai/provider.mjs): `backend/ai/provider.mjs`

### Application runtime

- [HTTP server](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/server.mjs): `backend/server.mjs`
- [AI configuration](https://github.com/omrajnexus31173/nexus-ai-powered-student-chatbot/blob/main/backend/config.mjs): `backend/config.mjs`

### Other components

- **Student**
- **Chat requester**
- **Configured AI provider**

## Connections

- Student → App shell: uses (evidence: `README.md`)
- App shell → Conversation sidebar: renders (evidence: `src/App.tsx`)
- App shell → Welcome screen: renders (evidence: `src/App.tsx`)
- App shell → Chat input: renders (evidence: `src/App.tsx`)
- App shell → Message display: renders (evidence: `src/App.tsx`)
- App shell → Settings panels: renders (evidence: `src/App.tsx`)
- Message display → Brand mark: renders (evidence: `src/components/Messages.tsx`)
- App shell → Conversation controller: uses (evidence: `src/App.tsx`)
- Conversation controller → Chat API client: requests reply (evidence: `src/hooks/useConversations.ts`)
- Conversation controller → Conversation migration: loads history (evidence: `src/hooks/useConversations.ts`)
- Conversation migration → Sample conversations: loads fallback (evidence: `src/utils/conversations.ts`)
- Conversation controller → Browser local storage: persists chats (evidence: `README.md`)
- App shell → API middleware: checks readiness (evidence: `src/App.tsx`)
- Chat API client → Chat requester: posts request (evidence: `src/services/chat.ts`)
- Chat requester → API middleware: sends JSON (evidence: `README.md`)
- HTTP server → AI configuration: loads settings (evidence: `backend/server.mjs`)
- HTTP server → AI transport: creates transport (evidence: `backend/server.mjs`)
- HTTP server → Response orchestration: creates service (evidence: `backend/server.mjs`)
- HTTP server → API middleware: starts app (evidence: `backend/server.mjs`)
- API middleware → Chat route: mounts route (evidence: `backend/app.mjs`)
- Chat route → Request validation: validates input (evidence: `backend/routes/chat.mjs`)
- Chat route → Response orchestration: generates reply (evidence: `backend/routes/chat.mjs`)
- Response orchestration → GSFC system prompt: uses instructions (evidence: `backend/ai/aiService.mjs`)
- Response orchestration → AI transport: requests completion (evidence: `backend/ai/aiService.mjs`)
- AI transport → Configured AI provider: sends completion (evidence: `README.md`)
- AI configuration → AI transport: configures transport (evidence: `backend/server.mjs`)
