# abdurrahim2705/cui-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/abdurrahim2705/cui-assistant
- Repository: https://github.com/abdurrahim2705/cui-assistant

## Overview

This is a COMSATS student portal with admin approval and policy-document management, plus an AI academic copilot. Students register or sign in, view profile/course/attendance data, manage tasks, and ask university questions; admins approve students and maintain indexed policy content. The React app calls a FastAPI API, which handles domain operations against PostgreSQL and delegates chat to an assistant using student context, task tools, and policy retrieval. The excerpts establish the main chat and ingestion integrations; some route internals are unsampled, so uncertain wiring is omitted.

Main entry points: [`backend/src/main.py`](https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/main.py) (Portal API), [`backend/src/db.py`](https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/db.py) (Database access), [`backend/src/assistant.py`](https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/assistant.py) (Academic assistant), [`backend/src/rag_loader.py`](https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/rag_loader.py) (Document indexing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["Portal interface<br/>[App.jsx]"]
  node_client["API client<br/>[api.js]"]
end

subgraph group_services["Portal services"]
  node_server["Portal API<br/>[main.py]"]
  node_auth["Account access<br/>[main.py]"]
  node_studentdata["Student records<br/>[main.py]"]
  node_tasks["Task management<br/>[main.py]"]
  node_adminops["Admin operations<br/>[main.py]"]
end

subgraph group_copilot["AI knowledge"]
  node_assistant["Academic assistant<br/>[assistant.py]"]
  node_ragloader["Document indexing<br/>[rag_loader.py]"]
  node_seedindex["Policy seed ingestion<br/>[ingest_docs.py]"]
  node_gemini{{"Gemini AI"}}
end

subgraph group_data["Data stores"]
  node_pinecone[("Pinecone index")]
  node_dbaccess["Database access<br/>[db.py]"]
  node_postgres[("PostgreSQL")]
end

node_student(("Student"))
node_admin(("Administrator"))

node_student -->|"uses"| node_app
node_admin -->|"uses"| node_app
node_app -->|"requests"| node_client
node_client -->|"HTTP calls"| node_server
node_server -->|"dispatches"| node_auth
node_server -->|"dispatches"| node_studentdata
node_server -->|"dispatches"| node_tasks
node_server -->|"dispatches"| node_adminops
node_server -->|"asks"| node_assistant
node_server -->|"indexes"| node_ragloader
node_auth -->|"queries"| node_dbaccess
node_studentdata -->|"queries"| node_dbaccess
node_tasks -->|"reads/writes"| node_dbaccess
node_adminops -->|"reads/writes"| node_dbaccess
node_assistant -->|"loads context"| node_dbaccess
node_assistant -->|"prompts"| node_gemini
node_assistant -->|"retrieves policies"| node_pinecone
node_assistant -->|"task tools"| node_tasks
node_ragloader -->|"embeds"| node_gemini
node_ragloader -->|"indexes chunks"| node_pinecone
node_seedindex -->|"embeds"| node_gemini
node_seedindex -->|"indexes documents"| node_pinecone
node_dbaccess -->|"queries"| node_postgres

click node_app "https://github.com/abdurrahim2705/cui-assistant/blob/main/frontend/src/App.jsx"
click node_client "https://github.com/abdurrahim2705/cui-assistant/blob/main/frontend/src/api.js"
click node_server "https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/main.py"
click node_auth "https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/main.py"
click node_studentdata "https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/main.py"
click node_tasks "https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/main.py"
click node_adminops "https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/main.py"
click node_assistant "https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/assistant.py"
click node_ragloader "https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/rag_loader.py"
click node_seedindex "https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/ingest_docs.py"
click node_dbaccess "https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/db.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_client toneBlue
class node_server,node_auth,node_studentdata,node_tasks,node_adminops toneAmber
class node_assistant,node_ragloader,node_seedindex,node_gemini toneMint
class node_pinecone,node_dbaccess,node_postgres toneRose
class node_student,node_admin toneIndigo
```

## Components

### Web experience

- [Portal interface](https://github.com/abdurrahim2705/cui-assistant/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/abdurrahim2705/cui-assistant/blob/main/frontend/src/api.js): `frontend/src/api.js`

### Portal services

- [Portal API](https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/main.py): `backend/src/main.py`
- [Account access](https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/main.py): `backend/src/main.py`
- [Student records](https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/main.py): `backend/src/main.py`
- [Task management](https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/main.py): `backend/src/main.py`
- [Admin operations](https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/main.py): `backend/src/main.py`

### AI knowledge

- [Academic assistant](https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/assistant.py): `backend/src/assistant.py`
- [Document indexing](https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/rag_loader.py): `backend/src/rag_loader.py`
- [Policy seed ingestion](https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/ingest_docs.py): `backend/src/ingest_docs.py`
- **Gemini AI**

### Data stores

- **Pinecone index**
- [Database access](https://github.com/abdurrahim2705/cui-assistant/blob/main/backend/src/db.py): `backend/src/db.py`
- **PostgreSQL**

### Other components

- **Student**
- **Administrator**

## Connections

- Student → Portal interface: uses
- Administrator → Portal interface: uses
- Portal interface → API client: requests
- API client → Portal API: HTTP calls
- Portal API → Account access: dispatches
- Portal API → Student records: dispatches
- Portal API → Task management: dispatches
- Portal API → Admin operations: dispatches
- Portal API → Academic assistant: asks
- Portal API → Document indexing: indexes
- Account access → Database access: queries
- Student records → Database access: queries
- Task management → Database access: reads/writes
- Admin operations → Database access: reads/writes
- Academic assistant → Database access: loads context
- Academic assistant → Gemini AI: prompts
- Academic assistant → Pinecone index: retrieves policies
- Academic assistant → Task management: task tools
- Document indexing → Gemini AI: embeds
- Document indexing → Pinecone index: indexes chunks
- Policy seed ingestion → Gemini AI: embeds
- Policy seed ingestion → Pinecone index: indexes documents
- Database access → PostgreSQL: queries
