# shakeer7/campusai architecture

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

- Interactive diagram: https://gitdiagram.com/shakeer7/campusai
- Repository: https://github.com/shakeer7/campusai

## Overview

CampusAI is a college-management assistant serving students, faculty, and administrators through a Next.js interface and FastAPI backend. Users access academic records and attendance tools, chat with a multilingual assistant, search academic documents, and submit or review attendance corrections. The backend combines role-based access, academic services, LLM tools, a PDF-to-vector retrieval flow, and persistent academic/workflow data. The README documents voice interaction, administrator monitoring, and the correction workflow; some implementation paths are unsampled, so those relationships are shown only where supported or marked unverified.

Main entry points: [`backend/app/main.py`](https://github.com/shakeer7/campusai/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/auth/dependencies.py`](https://github.com/shakeer7/campusai/blob/main/backend/app/auth/dependencies.py) (Identity and access control), [`backend/app/ai/bedrock_client.py`](https://github.com/shakeer7/campusai/blob/main/backend/app/ai/bedrock_client.py) (LLM and tool orchestration), [`backend/app/api/chat.py`](https://github.com/shakeer7/campusai/blob/main/backend/app/api/chat.py) (Chat API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_web["College portal"]
  node_chat_ui["Chat and voice UI"]
end

subgraph group_api["API and workflows"]
  node_server["FastAPI application<br/>[main.py]"]
  node_auth_api["Authentication API<br/>[auth.py]"]
  node_student_api["Student API<br/>[students.py]"]
  node_faculty_api["Faculty API<br/>[faculty.py]"]
  node_admin_api["Admin API<br/>[admin.py]"]
  node_chat_api["Chat API<br/>[chat.py]"]
  node_voice_api["Voice API<br/>[voice.py]"]
  node_workflow_api["Correction workflow API<br/>[workflows.py]"]
  node_rag_api["Document API<br/>[rag.py]"]
  node_academic["Academic services and tools"]
  node_correction_agent["Correction state machine"]
end

subgraph group_intelligence["AI and retrieval"]
  node_bedrock["LLM and tool orchestration<br/>[bedrock_client.py]"]
  node_language["Multilingual processing<br/>[multilingual.py]"]
  node_rag_pipeline["PDF indexing pipeline"]
  node_retriever["Semantic retrieval<br/>[retriever.py]"]
end

subgraph group_data["Identity and data"]
  node_auth["Identity and access control<br/>[dependencies.py]"]
  node_models["Academic and workflow records"]
  node_database[("Relational and vector store<br/>[database.py]")]
end

subgraph group_integration["External services"]
  node_mcp["Academic MCP tools<br/>[server.py]"]
  node_llm_service{{"AWS Bedrock / Ollama"}}
  node_speech{{"Speech services"}}
end

node_users(("Students, faculty, admins"))

node_users -->|"use"| node_web
node_web -->|"offers chat"| node_chat_ui
node_web -.->|"calls API"| node_server
node_chat_ui -.->|"sends queries"| node_chat_api
node_chat_ui -.->|"voice requests"| node_voice_api
node_server -->|"routes to"| node_auth_api
node_server -->|"routes to"| node_student_api
node_server -->|"routes to"| node_faculty_api
node_server -->|"routes to"| node_admin_api
node_server -->|"routes to"| node_chat_api
node_server -->|"routes to"| node_voice_api
node_server -->|"routes to"| node_workflow_api
node_server -->|"routes to"| node_rag_api
node_auth_api -->|"authenticates"| node_auth
node_student_api -->|"checks roles"| node_auth
node_faculty_api -.->|"checks roles"| node_auth
node_admin_api -->|"checks roles"| node_auth
node_chat_api -->|"identifies user"| node_auth
node_chat_api -->|"requests response"| node_bedrock
node_bedrock -->|"executes tools"| node_academic
node_bedrock -.->|"invokes model"| node_llm_service
node_bedrock -->|"uses language detection"| node_language
node_voice_api -.->|"speech processing"| node_speech
node_academic -->|"queries records"| node_models
node_academic -->|"searches documents"| node_retriever
node_workflow_api -.->|"runs workflow"| node_correction_agent
node_correction_agent -.->|"updates attendance"| node_models
node_rag_api -->|"parses and chunks"| node_rag_pipeline
node_rag_api -->|"searches chunks"| node_retriever
node_rag_pipeline -.->|"stores embeddings"| node_database
node_retriever -->|"reads chunks"| node_database
node_retriever -->|"filters by profile"| node_models
node_server -->|"initializes schema"| node_database
node_database -->|"persists"| node_models
node_mcp -->|"exposes tools"| node_academic

click node_web "https://github.com/shakeer7/campusai/tree/main/frontend/src/app"
click node_chat_ui "https://github.com/shakeer7/campusai/tree/main/frontend/src/components"
click node_server "https://github.com/shakeer7/campusai/blob/main/backend/app/main.py"
click node_auth_api "https://github.com/shakeer7/campusai/blob/main/backend/app/api/auth.py"
click node_student_api "https://github.com/shakeer7/campusai/blob/main/backend/app/api/students.py"
click node_faculty_api "https://github.com/shakeer7/campusai/blob/main/backend/app/api/faculty.py"
click node_admin_api "https://github.com/shakeer7/campusai/blob/main/backend/app/api/admin.py"
click node_chat_api "https://github.com/shakeer7/campusai/blob/main/backend/app/api/chat.py"
click node_voice_api "https://github.com/shakeer7/campusai/blob/main/backend/app/api/voice.py"
click node_workflow_api "https://github.com/shakeer7/campusai/blob/main/backend/app/api/workflows.py"
click node_rag_api "https://github.com/shakeer7/campusai/blob/main/backend/app/api/rag.py"
click node_academic "https://github.com/shakeer7/campusai/blob/main/backend/app/services/academic_service.py"
click node_correction_agent "https://github.com/shakeer7/campusai/blob/main/backend/app/agents/attendance_correction.py"
click node_auth "https://github.com/shakeer7/campusai/blob/main/backend/app/auth/dependencies.py"
click node_models "https://github.com/shakeer7/campusai/tree/main/backend/app/models"
click node_database "https://github.com/shakeer7/campusai/blob/main/backend/app/core/database.py"
click node_bedrock "https://github.com/shakeer7/campusai/blob/main/backend/app/ai/bedrock_client.py"
click node_language "https://github.com/shakeer7/campusai/blob/main/backend/app/ai/multilingual.py"
click node_rag_pipeline "https://github.com/shakeer7/campusai/tree/main/backend/app/rag"
click node_retriever "https://github.com/shakeer7/campusai/blob/main/backend/app/rag/retriever.py"
click node_mcp "https://github.com/shakeer7/campusai/blob/main/mcp-server/server.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_web,node_chat_ui toneBlue
class node_server,node_auth_api,node_student_api,node_faculty_api,node_admin_api,node_chat_api,node_voice_api,node_workflow_api,node_rag_api,node_academic,node_correction_agent toneAmber
class node_bedrock,node_language,node_rag_pipeline,node_retriever toneMint
class node_auth,node_models,node_database toneRose
class node_mcp,node_llm_service,node_speech,node_users toneIndigo
```

## Components

### User experience

- [College portal](https://github.com/shakeer7/campusai/tree/main/frontend/src/app): `frontend/src/app`
- [Chat and voice UI](https://github.com/shakeer7/campusai/tree/main/frontend/src/components): `frontend/src/components`

### API and workflows

- [FastAPI application](https://github.com/shakeer7/campusai/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication API](https://github.com/shakeer7/campusai/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Student API](https://github.com/shakeer7/campusai/blob/main/backend/app/api/students.py): `backend/app/api/students.py`
- [Faculty API](https://github.com/shakeer7/campusai/blob/main/backend/app/api/faculty.py): `backend/app/api/faculty.py`
- [Admin API](https://github.com/shakeer7/campusai/blob/main/backend/app/api/admin.py): `backend/app/api/admin.py`
- [Chat API](https://github.com/shakeer7/campusai/blob/main/backend/app/api/chat.py): `backend/app/api/chat.py`
- [Voice API](https://github.com/shakeer7/campusai/blob/main/backend/app/api/voice.py): `backend/app/api/voice.py`
- [Correction workflow API](https://github.com/shakeer7/campusai/blob/main/backend/app/api/workflows.py): `backend/app/api/workflows.py`
- [Document API](https://github.com/shakeer7/campusai/blob/main/backend/app/api/rag.py): `backend/app/api/rag.py`
- [Academic services and tools](https://github.com/shakeer7/campusai/blob/main/backend/app/services/academic_service.py): `backend/app/services/academic_service.py`
- [Correction state machine](https://github.com/shakeer7/campusai/blob/main/backend/app/agents/attendance_correction.py): `backend/app/agents/attendance_correction.py`

### AI and retrieval

- [LLM and tool orchestration](https://github.com/shakeer7/campusai/blob/main/backend/app/ai/bedrock_client.py): `backend/app/ai/bedrock_client.py`
- [Multilingual processing](https://github.com/shakeer7/campusai/blob/main/backend/app/ai/multilingual.py): `backend/app/ai/multilingual.py`
- [PDF indexing pipeline](https://github.com/shakeer7/campusai/tree/main/backend/app/rag): `backend/app/rag`
- [Semantic retrieval](https://github.com/shakeer7/campusai/blob/main/backend/app/rag/retriever.py): `backend/app/rag/retriever.py`

### Identity and data

- [Identity and access control](https://github.com/shakeer7/campusai/blob/main/backend/app/auth/dependencies.py): `backend/app/auth/dependencies.py`
- [Academic and workflow records](https://github.com/shakeer7/campusai/tree/main/backend/app/models): `backend/app/models`
- [Relational and vector store](https://github.com/shakeer7/campusai/blob/main/backend/app/core/database.py): `backend/app/core/database.py`

### External services

- [Academic MCP tools](https://github.com/shakeer7/campusai/blob/main/mcp-server/server.py): `mcp-server/server.py`
- **AWS Bedrock / Ollama**
- **Speech services**

### Other components

- **Students, faculty, admins**

## Connections

- Students, faculty, admins → College portal: use (evidence: `README.md`)
- College portal → Chat and voice UI: offers chat (evidence: `README.md`)
- College portal → FastAPI application: calls API
- Chat and voice UI → Chat API: sends queries
- Chat and voice UI → Voice API: voice requests
- FastAPI application → Authentication API: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Student API: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Faculty API: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Admin API: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Chat API: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Voice API: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Correction workflow API: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Document API: routes to (evidence: `backend/app/main.py`)
- Authentication API → Identity and access control: authenticates (evidence: `backend/app/api/auth.py`)
- Student API → Identity and access control: checks roles
- Faculty API → Identity and access control: checks roles
- Admin API → Identity and access control: checks roles (evidence: `backend/app/api/admin.py`)
- Chat API → Identity and access control: identifies user (evidence: `backend/app/api/chat.py`)
- Chat API → LLM and tool orchestration: requests response (evidence: `backend/app/api/chat.py`)
- LLM and tool orchestration → Academic services and tools: executes tools (evidence: `backend/app/ai/bedrock_client.py`)
- LLM and tool orchestration → AWS Bedrock / Ollama: invokes model
- LLM and tool orchestration → Multilingual processing: uses language detection (evidence: `backend/app/ai/bedrock_client.py`)
- Voice API → Speech services: speech processing
- Academic services and tools → Academic and workflow records: queries records (evidence: `backend/app/services/academic_service.py`)
- Academic services and tools → Semantic retrieval: searches documents (evidence: `backend/app/tools/registry.py`)
- Correction workflow API → Correction state machine: runs workflow
- Correction state machine → Academic and workflow records: updates attendance
- Document API → PDF indexing pipeline: parses and chunks (evidence: `backend/app/api/rag.py`)
- Document API → Semantic retrieval: searches chunks (evidence: `backend/app/api/rag.py`)
- PDF indexing pipeline → Relational and vector store: stores embeddings
- Semantic retrieval → Relational and vector store: reads chunks (evidence: `backend/app/rag/retriever.py`)
- Semantic retrieval → Academic and workflow records: filters by profile (evidence: `backend/app/rag/retriever.py`)
- FastAPI application → Relational and vector store: initializes schema (evidence: `backend/app/main.py`)
- Relational and vector store → Academic and workflow records: persists (evidence: `backend/app/models/user.py`)
- Academic MCP tools → Academic services and tools: exposes tools
