# skveer1902/student-information-chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/skveer1902/student-information-chatbot
- Repository: https://github.com/skveer1902/student-information-chatbot

## Overview

This is a role-aware university information chatbot: users log in, ask questions in the React chat, and receive information retrieved through role-specific API endpoints. The backend asks OpenAI to select an endpoint, calls that endpoint, and formats its response. The routers query MySQL through SQLAlchemy. The README also describes natural-language-to-SQL capability, but the sampled chat path uses endpoint dispatch instead; its implementation is not connected by the available evidence. Frontend component imports beyond App.js were not shown, so some UI relationships are omitted.

Main entry points: [`chatbot-env/backend/app/main.py`](https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/main.py) (FastAPI entry), [`chatbot-env/backend/app/database.py`](https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/database.py) (SQLAlchemy access), [`chatbot-env/frontend/src/App.js`](https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/frontend/src/App.js) (Chat application), [`chatbot-env/backend/app/routers/student.py`](https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/routers/student.py) (Student endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web interface"]
  node_app["Chat application<br/>[App.js]"]
  node_login["Role login<br/>[LoginPage.js]"]
  node_chat["Chat views"]
  node_panels["Profile and help panels"]
end

subgraph group_api["API and conversation"]
  node_api["FastAPI entry<br/>[main.py]"]
  node_session["Session and login<br/>[main.py]"]
  node_dispatch["GPT endpoint dispatch<br/>[main.py]"]
end

subgraph group_domain["Role information"]
  node_student["Student endpoints<br/>[student.py]"]
  node_faculty["Faculty endpoints<br/>[faculty.py]"]
  node_admin["Admin endpoints<br/>[admin.py]"]
  node_nl_sql["NL-to-SQL logic<br/>[nl_to_sql.py]"]
end

subgraph group_data["Persistence"]
  node_db_access["SQLAlchemy access<br/>[database.py]"]
  node_schema[("Information schema<br/>[models.py]")]
end

node_user(("Student or staff"))
node_openai{{"OpenAI service"}}
node_mysql[("MySQL database")]

node_user -->|"submits credentials"| node_login
node_login -->|"posts login"| node_api
node_app -->|"renders"| node_login
node_app -->|"renders"| node_chat
node_app -->|"renders"| node_panels
node_user -->|"asks question"| node_chat
node_app -->|"posts chat"| node_api
node_api -->|"handles login"| node_session
node_api -->|"handles chat"| node_dispatch
node_dispatch -->|"requests endpoint"| node_openai
node_dispatch -->|"calls selected route"| node_student
node_dispatch -->|"calls selected route"| node_faculty
node_dispatch -->|"calls selected route"| node_admin
node_api -->|"registers router"| node_student
node_api -->|"registers router"| node_faculty
node_api -->|"registers router"| node_admin
node_session -->|"queries credentials"| node_db_access
node_student -->|"gets sessions"| node_db_access
node_faculty -->|"gets sessions"| node_db_access
node_admin -->|"gets sessions"| node_db_access
node_db_access -->|"connects"| node_mysql
node_student -->|"queries models"| node_schema
node_faculty -->|"queries models"| node_schema
node_admin -->|"queries models"| node_schema
node_schema -.->|"maps tables"| node_mysql

click node_app "https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/frontend/src/App.js"
click node_login "https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/frontend/src/component/Auth/LoginPage.js"
click node_chat "https://github.com/skveer1902/student-information-chatbot/tree/main/chatbot-env/frontend/src/component/Chat"
click node_panels "https://github.com/skveer1902/student-information-chatbot/tree/main/chatbot-env/frontend/src/component/Panels"
click node_api "https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/main.py"
click node_session "https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/main.py"
click node_dispatch "https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/main.py"
click node_student "https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/routers/student.py"
click node_faculty "https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/routers/faculty.py"
click node_admin "https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/routers/admin.py"
click node_nl_sql "https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/nl_to_sql.py"
click node_db_access "https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/database.py"
click node_schema "https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/models.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_app,node_login,node_chat,node_panels toneBlue
class node_api,node_session,node_dispatch,node_mysql toneAmber
class node_student,node_faculty,node_admin,node_nl_sql toneMint
class node_db_access,node_schema toneRose
class node_user,node_openai toneIndigo
```

## Components

### Web interface

- [Chat application](https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/frontend/src/App.js): `chatbot-env/frontend/src/App.js`
- [Role login](https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/frontend/src/component/Auth/LoginPage.js): `chatbot-env/frontend/src/component/Auth/LoginPage.js`
- [Chat views](https://github.com/skveer1902/student-information-chatbot/tree/main/chatbot-env/frontend/src/component/Chat): `chatbot-env/frontend/src/component/Chat`
- [Profile and help panels](https://github.com/skveer1902/student-information-chatbot/tree/main/chatbot-env/frontend/src/component/Panels): `chatbot-env/frontend/src/component/Panels`

### API and conversation

- [FastAPI entry](https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/main.py): `chatbot-env/backend/app/main.py`
- [Session and login](https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/main.py): `chatbot-env/backend/app/main.py`
- [GPT endpoint dispatch](https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/main.py): `chatbot-env/backend/app/main.py`

### Role information

- [Student endpoints](https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/routers/student.py): `chatbot-env/backend/app/routers/student.py`
- [Faculty endpoints](https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/routers/faculty.py): `chatbot-env/backend/app/routers/faculty.py`
- [Admin endpoints](https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/routers/admin.py): `chatbot-env/backend/app/routers/admin.py`
- [NL-to-SQL logic](https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/nl_to_sql.py): `chatbot-env/backend/app/nl_to_sql.py`

### Persistence

- [SQLAlchemy access](https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/database.py): `chatbot-env/backend/app/database.py`
- [Information schema](https://github.com/skveer1902/student-information-chatbot/blob/main/chatbot-env/backend/app/models.py): `chatbot-env/backend/app/models.py`

### Other components

- **Student or staff**
- **OpenAI service**
- **MySQL database**

## Connections

- Student or staff → Role login: submits credentials (evidence: `chatbot-env/frontend/src/component/Auth/LoginPage.js`)
- Role login → FastAPI entry: posts login (evidence: `chatbot-env/frontend/src/component/Auth/LoginPage.js`)
- Chat application → Role login: renders (evidence: `chatbot-env/frontend/src/App.js`)
- Chat application → Chat views: renders (evidence: `chatbot-env/frontend/src/App.js`)
- Chat application → Profile and help panels: renders (evidence: `chatbot-env/frontend/src/App.js`)
- Student or staff → Chat views: asks question
- Chat application → FastAPI entry: posts chat (evidence: `chatbot-env/frontend/src/App.js`)
- FastAPI entry → Session and login: handles login (evidence: `chatbot-env/backend/app/main.py`)
- FastAPI entry → GPT endpoint dispatch: handles chat (evidence: `chatbot-env/backend/app/main.py`)
- GPT endpoint dispatch → OpenAI service: requests endpoint (evidence: `chatbot-env/backend/app/main.py`)
- GPT endpoint dispatch → Student endpoints: calls selected route (evidence: `chatbot-env/backend/app/main.py`)
- GPT endpoint dispatch → Faculty endpoints: calls selected route (evidence: `chatbot-env/backend/app/main.py`)
- GPT endpoint dispatch → Admin endpoints: calls selected route (evidence: `chatbot-env/backend/app/main.py`)
- FastAPI entry → Student endpoints: registers router (evidence: `chatbot-env/backend/app/main.py`)
- FastAPI entry → Faculty endpoints: registers router (evidence: `chatbot-env/backend/app/main.py`)
- FastAPI entry → Admin endpoints: registers router (evidence: `chatbot-env/backend/app/main.py`)
- Session and login → SQLAlchemy access: queries credentials (evidence: `chatbot-env/backend/app/main.py`)
- Student endpoints → SQLAlchemy access: gets sessions (evidence: `chatbot-env/backend/app/routers/student.py`)
- Faculty endpoints → SQLAlchemy access: gets sessions (evidence: `chatbot-env/backend/app/routers/faculty.py`)
- Admin endpoints → SQLAlchemy access: gets sessions (evidence: `chatbot-env/backend/app/routers/admin.py`)
- SQLAlchemy access → MySQL database: connects (evidence: `chatbot-env/backend/app/database.py`)
- Student endpoints → Information schema: queries models (evidence: `chatbot-env/backend/app/routers/student.py`)
- Faculty endpoints → Information schema: queries models (evidence: `chatbot-env/backend/app/routers/faculty.py`)
- Admin endpoints → Information schema: queries models (evidence: `chatbot-env/backend/app/routers/admin.py`)
- Information schema → MySQL database: maps tables
