# sushant22067/tej-institute architecture

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

- Interactive diagram: https://gitdiagram.com/sushant22067/tej-institute
- Repository: https://github.com/sushant22067/tej-institute

## Overview

TEJ Institute is an educational institute website and portal, with public information and enquiry features alongside staff, student, and exam-management workflows. A typical authenticated workflow is a staff member or student using a portal screen, which requests a role-specific API action; the API checks the session, reads or updates institutional records, and returns data for the screen. The tree also shows public registration, resource delivery, TSTS exams, and AI paper generation. The README is empty, so capability scope comes from the file tree; unsampled screen-to-route links are left unverified.

Main entry points: [`frontend/lib/prisma.ts`](https://github.com/sushant22067/tej-institute/blob/main/frontend/lib/prisma.ts) (Institutional database), [`frontend/app/api/auth/request-otp/route.ts`](https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/auth/request-otp/route.ts) (Login and OTP), [`frontend/app/staff/layout.tsx`](https://github.com/sushant22067/tej-institute/blob/main/frontend/app/staff/layout.tsx) (Staff portal), [`frontend/lib/auth.ts`](https://github.com/sushant22067/tej-institute/blob/main/frontend/lib/auth.ts) (Session service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public website"]
  node_public_pages["Public pages<br/>[page.tsx]"]
  node_public_sections["Institute content<br/>[Centres.tsx]"]
  node_enquiries["Enquiry capture<br/>[EnquiryModal.tsx]"]
  node_enquiry_api["Enquiry endpoint<br/>[route.ts]"]
end

subgraph group_identity["Identity and access"]
  node_auth_api["Login and OTP<br/>[route.ts]"]
  node_auth_service["Session service<br/>[auth.ts]"]
  node_otp_service["OTP utilities<br/>[otp.ts]"]
  node_rate_limit["Rate limiting<br/>[auth-security.ts]"]
end

subgraph group_learning["Academic operations"]
  node_student_portal["Student portal<br/>[StudentShell.tsx]"]
  node_student_api["Student endpoints<br/>[_lib.ts]"]
  node_staff_portal["Staff portal<br/>[layout.tsx]"]
  node_staff_students["Student management<br/>[route.ts]"]
  node_staff_fees["Fee management<br/>[route.ts]"]
  node_staff_results["Assessment results<br/>[route.ts]"]
end

subgraph group_exams["Exams and resources"]
  node_paper_generation["Paper generation<br/>[route.ts]"]
  node_question_bank["Question content<br/>[casgt-questions.ts]"]
  node_tsts["TSTS exams<br/>[route.ts]"]
  node_resource_api["Resource management<br/>[route.ts]"]
  node_resource_viewer["Resource viewer<br/>[ResourceViewer.tsx]"]
end

subgraph group_platform["Data and integrations"]
  node_database[("Institutional database<br/>[prisma.ts]")]
  node_google_drive["Google Drive"]
  node_gemini["Gemini API"]
  node_email["Email delivery"]
end

node_visitor(("Visitor"))

node_visitor -.->|"browses"| node_public_pages
node_public_pages -.->|"renders"| node_public_sections
node_visitor -.->|"submits enquiry"| node_enquiries
node_enquiries -.->|"sends enquiry"| node_enquiry_api
node_enquiry_api -.->|"records enquiry"| node_database
node_visitor -.->|"requests access"| node_auth_api
node_auth_api -->|"generates code"| node_otp_service
node_auth_api -->|"checks limits"| node_rate_limit
node_auth_api -->|"stores challenge"| node_database
node_auth_api -->|"sends code"| node_email
node_auth_service -->|"reads sessions"| node_database
node_visitor -.->|"uses portal"| node_student_portal
node_student_portal -.->|"requests data"| node_student_api
node_student_api -.->|"reads records"| node_database
node_visitor -.->|"uses portal"| node_staff_portal
node_staff_portal -.->|"manages students"| node_staff_students
node_staff_portal -.->|"manages fees"| node_staff_fees
node_staff_portal -.->|"manages results"| node_staff_results
node_staff_students -->|"checks session"| node_auth_service
node_staff_students -->|"reads and writes"| node_database
node_staff_fees -->|"checks session"| node_auth_service
node_staff_fees -->|"reads and writes"| node_database
node_staff_results -->|"checks session"| node_auth_service
node_staff_results -->|"reads and writes"| node_database
node_visitor -.->|"requests paper"| node_paper_generation
node_paper_generation -->|"generates content"| node_gemini
node_visitor -.->|"uses exam service"| node_tsts
node_tsts -->|"publishes results"| node_database
node_staff_portal -.->|"manages resources"| node_resource_api
node_resource_api -->|"checks session"| node_auth_service
node_resource_api -.->|"stores metadata"| node_database
node_resource_api -->|"uploads files"| node_google_drive
node_student_portal -.->|"views resources"| node_resource_viewer
node_resource_viewer -.->|"loads resource"| node_database

click node_public_pages "https://github.com/sushant22067/tej-institute/blob/main/frontend/app/page.tsx"
click node_public_sections "https://github.com/sushant22067/tej-institute/blob/main/frontend/components/Centres.tsx"
click node_enquiries "https://github.com/sushant22067/tej-institute/blob/main/frontend/components/EnquiryModal.tsx"
click node_enquiry_api "https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/enquiries/route.ts"
click node_auth_api "https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/auth/request-otp/route.ts"
click node_auth_service "https://github.com/sushant22067/tej-institute/blob/main/frontend/lib/auth.ts"
click node_otp_service "https://github.com/sushant22067/tej-institute/blob/main/frontend/lib/otp.ts"
click node_rate_limit "https://github.com/sushant22067/tej-institute/blob/main/frontend/lib/auth-security.ts"
click node_student_portal "https://github.com/sushant22067/tej-institute/blob/main/frontend/components/student/StudentShell.tsx"
click node_student_api "https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/student/_lib.ts"
click node_staff_portal "https://github.com/sushant22067/tej-institute/blob/main/frontend/app/staff/layout.tsx"
click node_staff_students "https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/staff/students/route.ts"
click node_staff_fees "https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/staff/fees/route.ts"
click node_staff_results "https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/staff/results/route.ts"
click node_paper_generation "https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/generate-paper/route.ts"
click node_question_bank "https://github.com/sushant22067/tej-institute/blob/main/frontend/lib/casgt-questions.ts"
click node_tsts "https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/staff/tsts/results/route.ts"
click node_resource_api "https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/staff/resources/route.ts"
click node_resource_viewer "https://github.com/sushant22067/tej-institute/blob/main/frontend/components/ResourceViewer.tsx"
click node_database "https://github.com/sushant22067/tej-institute/blob/main/frontend/lib/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_public_pages,node_public_sections,node_enquiries,node_enquiry_api toneBlue
class node_auth_api,node_auth_service,node_otp_service,node_rate_limit toneAmber
class node_student_portal,node_student_api,node_staff_portal,node_staff_students,node_staff_fees,node_staff_results toneMint
class node_paper_generation,node_question_bank,node_tsts,node_resource_api,node_resource_viewer toneRose
class node_database,node_google_drive,node_gemini,node_email,node_visitor toneIndigo
```

## Components

### Public website

- [Public pages](https://github.com/sushant22067/tej-institute/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Institute content](https://github.com/sushant22067/tej-institute/blob/main/frontend/components/Centres.tsx): `frontend/components/Centres.tsx`
- [Enquiry capture](https://github.com/sushant22067/tej-institute/blob/main/frontend/components/EnquiryModal.tsx): `frontend/components/EnquiryModal.tsx`
- [Enquiry endpoint](https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/enquiries/route.ts): `frontend/app/api/enquiries/route.ts`

### Identity and access

- [Login and OTP](https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/auth/request-otp/route.ts): `frontend/app/api/auth/request-otp/route.ts`
- [Session service](https://github.com/sushant22067/tej-institute/blob/main/frontend/lib/auth.ts): `frontend/lib/auth.ts`
- [OTP utilities](https://github.com/sushant22067/tej-institute/blob/main/frontend/lib/otp.ts): `frontend/lib/otp.ts`
- [Rate limiting](https://github.com/sushant22067/tej-institute/blob/main/frontend/lib/auth-security.ts): `frontend/lib/auth-security.ts`

### Academic operations

- [Student portal](https://github.com/sushant22067/tej-institute/blob/main/frontend/components/student/StudentShell.tsx): `frontend/components/student/StudentShell.tsx`
- [Student endpoints](https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/student/_lib.ts): `frontend/app/api/student/_lib.ts`
- [Staff portal](https://github.com/sushant22067/tej-institute/blob/main/frontend/app/staff/layout.tsx): `frontend/app/staff/layout.tsx`
- [Student management](https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/staff/students/route.ts): `frontend/app/api/staff/students/route.ts`
- [Fee management](https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/staff/fees/route.ts): `frontend/app/api/staff/fees/route.ts`
- [Assessment results](https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/staff/results/route.ts): `frontend/app/api/staff/results/route.ts`

### Exams and resources

- [Paper generation](https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/generate-paper/route.ts): `frontend/app/api/generate-paper/route.ts`
- [Question content](https://github.com/sushant22067/tej-institute/blob/main/frontend/lib/casgt-questions.ts): `frontend/lib/casgt-questions.ts`
- [TSTS exams](https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/staff/tsts/results/route.ts): `frontend/app/api/staff/tsts/results/route.ts`
- [Resource management](https://github.com/sushant22067/tej-institute/blob/main/frontend/app/api/staff/resources/route.ts): `frontend/app/api/staff/resources/route.ts`
- [Resource viewer](https://github.com/sushant22067/tej-institute/blob/main/frontend/components/ResourceViewer.tsx): `frontend/components/ResourceViewer.tsx`

### Data and integrations

- [Institutional database](https://github.com/sushant22067/tej-institute/blob/main/frontend/lib/prisma.ts): `frontend/lib/prisma.ts`
- **Google Drive**
- **Gemini API**
- **Email delivery**

### Other components

- **Visitor**

## Connections

- Visitor → Public pages: browses
- Public pages → Institute content: renders
- Visitor → Enquiry capture: submits enquiry
- Enquiry capture → Enquiry endpoint: sends enquiry
- Enquiry endpoint → Institutional database: records enquiry
- Visitor → Login and OTP: requests access
- Login and OTP → OTP utilities: generates code (evidence: `frontend/app/api/auth/request-otp/route.ts`)
- Login and OTP → Rate limiting: checks limits (evidence: `frontend/app/api/auth/request-otp/route.ts`)
- Login and OTP → Institutional database: stores challenge (evidence: `frontend/app/api/auth/request-otp/route.ts`)
- Login and OTP → Email delivery: sends code (evidence: `frontend/app/api/auth/request-otp/route.ts`)
- Session service → Institutional database: reads sessions (evidence: `frontend/lib/auth.ts`)
- Visitor → Student portal: uses portal
- Student portal → Student endpoints: requests data
- Student endpoints → Institutional database: reads records
- Visitor → Staff portal: uses portal
- Staff portal → Student management: manages students
- Staff portal → Fee management: manages fees
- Staff portal → Assessment results: manages results
- Student management → Session service: checks session (evidence: `frontend/app/api/staff/students/route.ts`)
- Student management → Institutional database: reads and writes (evidence: `frontend/app/api/staff/students/route.ts`)
- Fee management → Session service: checks session (evidence: `frontend/app/api/staff/fees/route.ts`)
- Fee management → Institutional database: reads and writes (evidence: `frontend/app/api/staff/fees/route.ts`)
- Assessment results → Session service: checks session (evidence: `frontend/app/api/staff/results/route.ts`)
- Assessment results → Institutional database: reads and writes (evidence: `frontend/app/api/staff/results/route.ts`)
- Visitor → Paper generation: requests paper
- Paper generation → Gemini API: generates content (evidence: `frontend/app/api/generate-paper/route.ts`)
- Visitor → TSTS exams: uses exam service
- TSTS exams → Institutional database: publishes results (evidence: `frontend/app/api/staff/tsts/results/route.ts`)
- Staff portal → Resource management: manages resources
- Resource management → Session service: checks session (evidence: `frontend/app/api/staff/resources/route.ts`)
- Resource management → Institutional database: stores metadata
- Resource management → Google Drive: uploads files (evidence: `frontend/app/api/staff/resources/route.ts`)
- Student portal → Resource viewer: views resources
- Resource viewer → Institutional database: loads resource
