# agastyasharma20/sih26087 architecture

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

- Interactive diagram: https://gitdiagram.com/agastyasharma20/sih26087
- Repository: https://github.com/agastyasharma20/sih26087

## Overview

SARTHI is a federated training ERP and learning platform. Its principal lifecycle runs from programme administration and trainee onboarding through learning and assessment to attendance, certificates, and employer recruitment; role-specific portals also support institute/national governance, hostels, devices, and public verification. The graph combines documented capabilities with source-visible wiring. Several feature branches are represented at their exact source directories because their individual implementations were not sampled; those links are omitted where no caller relationship is evidenced.

Main entry points: [`backend/src/index.ts`](https://github.com/agastyasharma20/sih26087/blob/main/backend/src/index.ts) (Express API), [`src/App.tsx`](https://github.com/agastyasharma20/sih26087/blob/main/src/App.tsx) (Role Router), [`backend/src/config/prisma.ts`](https://github.com/agastyasharma20/sih26087/blob/main/backend/src/config/prisma.ts) (Prisma Client), [`backend/src/services/attendanceService.ts`](https://github.com/agastyasharma20/sih26087/blob/main/backend/src/services/attendanceService.ts) (Attendance Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Role Portals"]
  node_trainee["Trainee Portal"]
  node_admin["Admin Portals"]
  node_faculty["Faculty Portal"]
  node_employer["Employer Portal"]
  node_deviceop["Device Console"]
  node_public["Public Verification"]
  node_app["Role Router<br/>[App.tsx]"]
  node_context["App State<br/>[AppContext.tsx]"]
  node_api_client["API Client<br/>[api.ts]"]
end

subgraph group_api["Application API"]
  node_api_server["Express API<br/>[index.ts]"]
  node_auth["Authentication<br/>[authService.ts]"]
  node_attendance["Attendance Service"]
  node_prisma["Prisma Client<br/>[prisma.ts]"]
end

subgraph group_learning["Learning And Careers"]
  node_learning["Courses And Assessments"]
  node_certificate["Certificates And Vault"]
  node_jobs["Jobs And Matching<br/>[matchingEngine.ts]"]
  node_chat["Career Assistant<br/>[chatController.ts]"]
  node_rag["Knowledge Retrieval<br/>[retrieve.ts]"]
end

subgraph group_operations["Institute Operations"]
  node_programme["Programme And Institute"]
  node_hostel["Hostel Operations<br/>[hostelService.ts]"]
end

subgraph group_edge["Attendance Edge"]
  node_device["Device Services<br/>[deviceService.ts]"]
  node_hardware["Attendance Kiosk"]
  node_face["Face Recognition<br/>[service.py]"]
end

node_database[("PostgreSQL")]
node_actor(("Portal Users"))

node_actor -->|"uses portals"| node_app
node_app -->|"uses state"| node_context
node_context -->|"calls API"| node_api_client
node_api_client -->|"REST requests"| node_api_server
node_api_server -->|"mounts auth routes"| node_auth
node_api_server -->|"health check calls"| node_attendance
node_api_server -->|"uses Prisma"| node_prisma
node_prisma -->|"connects via Prisma"| node_database
node_api_server -->|"mounts learning routes"| node_learning
node_api_server -->|"mounts programme routes"| node_programme
node_api_server -->|"mounts hostel routes"| node_hostel
node_api_server -->|"mounts device routes"| node_device
node_api_server -->|"mounts certificate routes"| node_certificate
node_api_server -->|"mounts job routes"| node_jobs
node_api_server -->|"mounts chat routes"| node_chat
node_attendance -->|"calls device service"| node_device
node_attendance -->|"queries database"| node_prisma
node_chat -->|"retrieves snippets"| node_rag
node_rag -.->|"loads knowledge"| node_prisma
node_hardware -.->|"sends attendance"| node_api_server
node_api_server -.->|"recognition requests"| node_face
node_trainee -->|"routed by"| node_app
node_admin -->|"routed by"| node_app
node_faculty -->|"routed by"| node_app
node_employer -.->|"routed by"| node_app
node_deviceop -->|"routed by"| node_app
node_public -->|"routed by"| node_app

click node_trainee "https://github.com/agastyasharma20/sih26087/tree/main/src/views/Trainee"
click node_admin "https://github.com/agastyasharma20/sih26087/tree/main/src/views/InstituteAdmin"
click node_faculty "https://github.com/agastyasharma20/sih26087/tree/main/src/views/Faculty"
click node_employer "https://github.com/agastyasharma20/sih26087/tree/main/src/views/Employer"
click node_deviceop "https://github.com/agastyasharma20/sih26087/blob/main/src/views/DeviceOperator/DeviceOperatorDashboard.tsx"
click node_public "https://github.com/agastyasharma20/sih26087/tree/main/src/views/Public"
click node_app "https://github.com/agastyasharma20/sih26087/blob/main/src/App.tsx"
click node_context "https://github.com/agastyasharma20/sih26087/blob/main/src/context/AppContext.tsx"
click node_api_client "https://github.com/agastyasharma20/sih26087/blob/main/src/lib/api.ts"
click node_api_server "https://github.com/agastyasharma20/sih26087/blob/main/backend/src/index.ts"
click node_auth "https://github.com/agastyasharma20/sih26087/blob/main/backend/src/services/authService.ts"
click node_attendance "https://github.com/agastyasharma20/sih26087/blob/main/backend/src/services/attendanceService.ts"
click node_programme "https://github.com/agastyasharma20/sih26087/tree/main/backend/src/services"
click node_hostel "https://github.com/agastyasharma20/sih26087/blob/main/backend/src/services/hostelService.ts"
click node_device "https://github.com/agastyasharma20/sih26087/blob/main/backend/src/services/deviceService.ts"
click node_hardware "https://github.com/agastyasharma20/sih26087/blob/main/hardware/attendance_device.py"
click node_face "https://github.com/agastyasharma20/sih26087/blob/main/FACE/service.py"
click node_learning "https://github.com/agastyasharma20/sih26087/tree/main/backend/src/services"
click node_certificate "https://github.com/agastyasharma20/sih26087/tree/main/backend/src/services"
click node_jobs "https://github.com/agastyasharma20/sih26087/blob/main/backend/src/services/matchingEngine.ts"
click node_chat "https://github.com/agastyasharma20/sih26087/blob/main/backend/src/controllers/chatController.ts"
click node_rag "https://github.com/agastyasharma20/sih26087/blob/main/backend/src/rag/retrieve.ts"
click node_prisma "https://github.com/agastyasharma20/sih26087/blob/main/backend/src/config/prisma.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_trainee,node_admin,node_faculty,node_employer,node_deviceop,node_public,node_app,node_context,node_api_client,node_actor toneBlue
class node_api_server,node_auth,node_attendance,node_prisma,node_database toneAmber
class node_learning,node_certificate,node_jobs,node_chat,node_rag toneMint
class node_programme,node_hostel toneRose
class node_device,node_hardware,node_face toneIndigo
```

## Components

### Role Portals

- [Trainee Portal](https://github.com/agastyasharma20/sih26087/tree/main/src/views/Trainee): `src/views/Trainee`
- [Admin Portals](https://github.com/agastyasharma20/sih26087/tree/main/src/views/InstituteAdmin): `src/views/InstituteAdmin`
- [Faculty Portal](https://github.com/agastyasharma20/sih26087/tree/main/src/views/Faculty): `src/views/Faculty`
- [Employer Portal](https://github.com/agastyasharma20/sih26087/tree/main/src/views/Employer): `src/views/Employer`
- [Device Console](https://github.com/agastyasharma20/sih26087/blob/main/src/views/DeviceOperator/DeviceOperatorDashboard.tsx): `src/views/DeviceOperator/DeviceOperatorDashboard.tsx`
- [Public Verification](https://github.com/agastyasharma20/sih26087/tree/main/src/views/Public): `src/views/Public`
- [Role Router](https://github.com/agastyasharma20/sih26087/blob/main/src/App.tsx): `src/App.tsx`
- [App State](https://github.com/agastyasharma20/sih26087/blob/main/src/context/AppContext.tsx): `src/context/AppContext.tsx`
- [API Client](https://github.com/agastyasharma20/sih26087/blob/main/src/lib/api.ts): `src/lib/api.ts`

### Application API

- [Express API](https://github.com/agastyasharma20/sih26087/blob/main/backend/src/index.ts): `backend/src/index.ts`
- [Authentication](https://github.com/agastyasharma20/sih26087/blob/main/backend/src/services/authService.ts): `backend/src/services/authService.ts`
- [Attendance Service](https://github.com/agastyasharma20/sih26087/blob/main/backend/src/services/attendanceService.ts): `backend/src/services/attendanceService.ts`
- [Prisma Client](https://github.com/agastyasharma20/sih26087/blob/main/backend/src/config/prisma.ts): `backend/src/config/prisma.ts`

### Learning And Careers

- [Courses And Assessments](https://github.com/agastyasharma20/sih26087/tree/main/backend/src/services): `backend/src/services`
- [Certificates And Vault](https://github.com/agastyasharma20/sih26087/tree/main/backend/src/services): `backend/src/services`
- [Jobs And Matching](https://github.com/agastyasharma20/sih26087/blob/main/backend/src/services/matchingEngine.ts): `backend/src/services/matchingEngine.ts`
- [Career Assistant](https://github.com/agastyasharma20/sih26087/blob/main/backend/src/controllers/chatController.ts): `backend/src/controllers/chatController.ts`
- [Knowledge Retrieval](https://github.com/agastyasharma20/sih26087/blob/main/backend/src/rag/retrieve.ts): `backend/src/rag/retrieve.ts`

### Institute Operations

- [Programme And Institute](https://github.com/agastyasharma20/sih26087/tree/main/backend/src/services): `backend/src/services`
- [Hostel Operations](https://github.com/agastyasharma20/sih26087/blob/main/backend/src/services/hostelService.ts): `backend/src/services/hostelService.ts`

### Attendance Edge

- [Device Services](https://github.com/agastyasharma20/sih26087/blob/main/backend/src/services/deviceService.ts): `backend/src/services/deviceService.ts`
- [Attendance Kiosk](https://github.com/agastyasharma20/sih26087/blob/main/hardware/attendance_device.py): `hardware/attendance_device.py`
- [Face Recognition](https://github.com/agastyasharma20/sih26087/blob/main/FACE/service.py): `FACE/service.py`

### Other components

- **PostgreSQL**
- **Portal Users**

## Connections

- Portal Users → Role Router: uses portals (evidence: `README.md`)
- Role Router → App State: uses state (evidence: `src/App.tsx`)
- App State → API Client: calls API (evidence: `src/context/AppContext.tsx`)
- API Client → Express API: REST requests (evidence: `README.md`)
- Express API → Authentication: mounts auth routes (evidence: `backend/src/index.ts`)
- Express API → Attendance Service: health check calls (evidence: `backend/src/index.ts`)
- Express API → Prisma Client: uses Prisma (evidence: `README.md`)
- Prisma Client → PostgreSQL: connects via Prisma (evidence: `README.md`)
- Express API → Courses And Assessments: mounts learning routes (evidence: `backend/src/index.ts`)
- Express API → Programme And Institute: mounts programme routes (evidence: `backend/src/index.ts`)
- Express API → Hostel Operations: mounts hostel routes (evidence: `backend/src/index.ts`)
- Express API → Device Services: mounts device routes (evidence: `backend/src/index.ts`)
- Express API → Certificates And Vault: mounts certificate routes (evidence: `backend/src/index.ts`)
- Express API → Jobs And Matching: mounts job routes (evidence: `backend/src/index.ts`)
- Express API → Career Assistant: mounts chat routes (evidence: `backend/src/index.ts`)
- Attendance Service → Device Services: calls device service (evidence: `backend/src/services/attendanceService.ts`)
- Attendance Service → Prisma Client: queries database (evidence: `backend/src/services/attendanceService.ts`)
- Career Assistant → Knowledge Retrieval: retrieves snippets (evidence: `backend/src/controllers/chatController.ts`)
- Knowledge Retrieval → Prisma Client: loads knowledge
- Attendance Kiosk → Express API: sends attendance
- Express API → Face Recognition: recognition requests
- Trainee Portal → Role Router: routed by (evidence: `src/App.tsx`)
- Admin Portals → Role Router: routed by (evidence: `src/App.tsx`)
- Faculty Portal → Role Router: routed by (evidence: `src/App.tsx`)
- Employer Portal → Role Router: routed by
- Device Console → Role Router: routed by (evidence: `src/App.tsx`)
- Public Verification → Role Router: routed by (evidence: `src/App.tsx`)
