# shivamsingh5112004/studentskillhub architecture

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

- Interactive diagram: https://gitdiagram.com/shivamsingh5112004/studentskillhub
- Repository: https://github.com/shivamsingh5112004/studentskillhub

## Overview

StudentSkillHub combines student accounts and learning-progress APIs with AI mentoring and roadmap recommendations. A student signs in, accesses profile and skill/module progress, then can ask either the conversational mentor or the progress agent for personalized guidance. The agent uses a Genkit flow and MCP learning tools to consult roadmap and profile data; completion can update student progress. The tree and excerpts establish the main backend and agent wiring, but frontend API wiring and several implementation details were not sampled, so those links are omitted.

Main entry points: [`backend/server.js`](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/server.js) (Express API), [`backend/routes/aiRoutes.js`](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/routes/aiRoutes.js) (Mentor routes), [`backend/middleware/authMiddleware.js`](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/middleware/authMiddleware.js) (Token verification), [`backend/routes/studentRoutes.js`](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/routes/studentRoutes.js) (Student routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Student interface"]
  node_frontend["Next.js app<br/>[page.tsx]"]
  node_authform["Login and signup<br/>[AuthForm.tsx]"]
  node_authlib["Auth helpers<br/>[auth.ts]"]
  node_firebaseclient["Firebase client<br/>[firebase.ts]"]
end

subgraph group_api["Core API"]
  node_backend["Express API<br/>[server.js]"]
  node_studentroutes["Student routes<br/>[studentRoutes.js]"]
  node_studentcontroller["Student controller"]
  node_authmiddleware["Token verification<br/>[authMiddleware.js]"]
  node_contextmiddleware["Student context"]
  node_airoutes["Mentor routes<br/>[aiRoutes.js]"]
  node_usage["AI usage limits<br/>[aiUsage.js]"]
  node_genkitroutes["Agent routes<br/>[genkitRoutes.js]"]
end

subgraph group_ai["AI services"]
  node_aicontroller["AI mentor<br/>[aiController.js]"]
  node_gemini["Gemini client<br/>[gemini.js]"]
  node_genkitcontroller["Agent gateway"]
  node_genkitserver["Genkit HTTP service<br/>[server.ts]"]
  node_genkitflow["Mentor flow<br/>[index.ts]"]
  node_mcpserver["Learning tools<br/>[server.ts]"]
end

subgraph group_data["Learning data"]
  node_studentmodel["Student model<br/>[studentModel.js]"]
  node_firestore[("Firestore<br/>[firebase.js]")]
end

node_student(("Student"))
node_modelprovider["AI model providers"]
node_firebaseauth["Firebase Authentication"]

node_student -->|"uses"| node_frontend
node_authform -->|"calls"| node_authlib
node_authlib -.-> node_firebaseclient
node_frontend -.->|"API requests"| node_backend
node_backend -->|"mounts"| node_studentroutes
node_backend -->|"mounts"| node_airoutes
node_backend -->|"mounts"| node_genkitroutes
node_studentroutes -->|"verifies token"| node_authmiddleware
node_studentroutes -->|"dispatches"| node_studentcontroller
node_studentcontroller -->|"calls"| node_studentmodel
node_studentmodel -->|"reads and writes"| node_firestore
node_airoutes -->|"verifies token"| node_authmiddleware
node_airoutes -->|"loads context"| node_contextmiddleware
node_airoutes -->|"dispatches"| node_aicontroller
node_aicontroller -->|"generates response"| node_gemini
node_aicontroller -->|"reserves usage"| node_usage
node_genkitroutes -->|"verifies token"| node_authmiddleware
node_genkitroutes -->|"dispatches"| node_genkitcontroller
node_genkitcontroller -->|"reserves usage"| node_usage
node_genkitcontroller -->|"POSTs flow request"| node_genkitserver
node_genkitserver -->|"handles flow"| node_genkitflow
node_genkitflow -->|"calls learning tools"| node_mcpserver
node_mcpserver -->|"reads and updates"| node_firestore
node_genkitflow -->|"generates with"| node_modelprovider
node_gemini -->|"calls"| node_modelprovider
node_authmiddleware -->|"verifies token"| node_firebaseauth

click node_frontend "https://github.com/shivamsingh5112004/studentskillhub/blob/main/frontend/app/page.tsx"
click node_authform "https://github.com/shivamsingh5112004/studentskillhub/blob/main/frontend/app/components/AuthForm.tsx"
click node_authlib "https://github.com/shivamsingh5112004/studentskillhub/blob/main/frontend/app/lib/auth.ts"
click node_firebaseclient "https://github.com/shivamsingh5112004/studentskillhub/blob/main/frontend/app/lib/firebase.ts"
click node_backend "https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/server.js"
click node_studentroutes "https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/routes/studentRoutes.js"
click node_studentcontroller "https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/controllers/studentController.js"
click node_authmiddleware "https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/middleware/authMiddleware.js"
click node_contextmiddleware "https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/middleware/studentContextMiddleware.js"
click node_studentmodel "https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/models/studentModel.js"
click node_firestore "https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/config/firebase.js"
click node_airoutes "https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/routes/aiRoutes.js"
click node_aicontroller "https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/controllers/aiController.js"
click node_gemini "https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/ai/gemini.js"
click node_usage "https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/utils/aiUsage.js"
click node_genkitroutes "https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/routes/genkitRoutes.js"
click node_genkitcontroller "https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/controllers/genkitController.js"
click node_genkitserver "https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/genkit-ai/server.ts"
click node_genkitflow "https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/genkit-ai/index.ts"
click node_mcpserver "https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/mcp/server.ts"

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_frontend,node_authform,node_authlib,node_firebaseclient toneBlue
class node_backend,node_studentroutes,node_studentcontroller,node_authmiddleware,node_contextmiddleware,node_airoutes,node_usage,node_genkitroutes toneAmber
class node_aicontroller,node_gemini,node_genkitcontroller,node_genkitserver,node_genkitflow,node_mcpserver toneMint
class node_studentmodel,node_firestore toneRose
class node_student,node_modelprovider,node_firebaseauth toneIndigo
```

## Components

### Student interface

- [Next.js app](https://github.com/shivamsingh5112004/studentskillhub/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Login and signup](https://github.com/shivamsingh5112004/studentskillhub/blob/main/frontend/app/components/AuthForm.tsx): `frontend/app/components/AuthForm.tsx`
- [Auth helpers](https://github.com/shivamsingh5112004/studentskillhub/blob/main/frontend/app/lib/auth.ts): `frontend/app/lib/auth.ts`
- [Firebase client](https://github.com/shivamsingh5112004/studentskillhub/blob/main/frontend/app/lib/firebase.ts): `frontend/app/lib/firebase.ts`

### Core API

- [Express API](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/server.js): `backend/server.js`
- [Student routes](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/routes/studentRoutes.js): `backend/routes/studentRoutes.js`
- [Student controller](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/controllers/studentController.js): `backend/controllers/studentController.js`
- [Token verification](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`
- [Student context](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/middleware/studentContextMiddleware.js): `backend/middleware/studentContextMiddleware.js`
- [Mentor routes](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/routes/aiRoutes.js): `backend/routes/aiRoutes.js`
- [AI usage limits](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/utils/aiUsage.js): `backend/utils/aiUsage.js`
- [Agent routes](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/routes/genkitRoutes.js): `backend/routes/genkitRoutes.js`

### AI services

- [AI mentor](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/controllers/aiController.js): `backend/controllers/aiController.js`
- [Gemini client](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/ai/gemini.js): `backend/ai/gemini.js`
- [Agent gateway](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/controllers/genkitController.js): `backend/controllers/genkitController.js`
- [Genkit HTTP service](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/genkit-ai/server.ts): `backend/genkit-ai/server.ts`
- [Mentor flow](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/genkit-ai/index.ts): `backend/genkit-ai/index.ts`
- [Learning tools](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/mcp/server.ts): `backend/mcp/server.ts`

### Learning data

- [Student model](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/models/studentModel.js): `backend/models/studentModel.js`
- [Firestore](https://github.com/shivamsingh5112004/studentskillhub/blob/main/backend/config/firebase.js): `backend/config/firebase.js`

### Other components

- **Student**
- **AI model providers**
- **Firebase Authentication**

## Connections

- Student → Next.js app: uses
- Login and signup → Auth helpers: calls
- Auth helpers → Firebase client
- Next.js app → Express API: API requests
- Express API → Student routes: mounts
- Express API → Mentor routes: mounts
- Express API → Agent routes: mounts
- Student routes → Token verification: verifies token
- Student routes → Student controller: dispatches
- Student controller → Student model: calls
- Student model → Firestore: reads and writes
- Mentor routes → Token verification: verifies token
- Mentor routes → Student context: loads context
- Mentor routes → AI mentor: dispatches
- AI mentor → Gemini client: generates response
- AI mentor → AI usage limits: reserves usage
- Agent routes → Token verification: verifies token
- Agent routes → Agent gateway: dispatches
- Agent gateway → AI usage limits: reserves usage
- Agent gateway → Genkit HTTP service: POSTs flow request
- Genkit HTTP service → Mentor flow: handles flow
- Mentor flow → Learning tools: calls learning tools
- Learning tools → Firestore: reads and updates
- Mentor flow → AI model providers: generates with
- Gemini client → AI model providers: calls
- Token verification → Firebase Authentication: verifies token
