# sushant22067/tej-test-series architecture

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

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

## Overview

This repository implements a web-based exam portal: students discover test series, register or sign in, obtain access, take tests, and review results; staff and administrators have separate oversight workflows. The graph preserves the free-mock, CBT, payment, result-analysis, and exam-authoring areas visible in the tree. Several routes and payment flows were not sampled, so their internal connections are omitted rather than inferred; edges shown are supported by excerpts or the source index.

Main entry points: [`lib/prisma.ts`](https://github.com/sushant22067/tej-test-series/blob/main/lib/prisma.ts) (Prisma client), [`components/student/ResultClient.tsx`](https://github.com/sushant22067/tej-test-series/blob/main/components/student/ResultClient.tsx) (Result review), [`components/cbt/ExamPage.tsx`](https://github.com/sushant22067/tej-test-series/blob/main/components/cbt/ExamPage.tsx) (Exam runner), [`app/api/student/dashboard/route.ts`](https://github.com/sushant22067/tej-test-series/blob/main/app/api/student/dashboard/route.ts) (Dashboard data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_student["Student experience"]
  node_student_entry["Student portal<br/>[page.tsx]"]
  node_series_page["Test series<br/>[page.tsx]"]
  node_student_login["Student login"]
  node_student_dashboard["Student dashboard<br/>[page.tsx]"]
  node_student_dashboard_api["Dashboard data<br/>[route.ts]"]
  node_checkout["Checkout<br/>[page.tsx]"]
  node_payment_api["Payment routes"]
end

subgraph group_assessment["Assessment and results"]
  node_free_mock["Free mock tests<br/>[route.ts]"]
  node_cbt["Exam runner<br/>[ExamPage.tsx]"]
  node_exam_header["Exam header<br/>[ExamHeader.tsx]"]
  node_question_panel["Question panel<br/>[QuestionPanel.tsx]"]
  node_exam_footer["Exam footer<br/>[ExamFooter.tsx]"]
  node_question_palette["Question palette"]
  node_attempt_api["Attempt and submission"]
  node_answer_api["Answer operations<br/>[route.ts]"]
  node_result_api["Result data<br/>[route.ts]"]
  node_result_page["Result page<br/>[page.tsx]"]
  node_result_client["Result review<br/>[ResultClient.tsx]"]
  node_performance["Performance review"]
  node_math_text["Math rendering<br/>[MathText.tsx]"]
end

subgraph group_operations["Admin and staff"]
  node_admin_portal["Admin portal<br/>[page.tsx]"]
  node_admin_results["Admin results<br/>[page.tsx]"]
  node_admin_payments_api["Payment oversight<br/>[route.ts]"]
  node_admin_other_api["Admin operations"]
  node_question_builder["Question authoring"]
  node_staff_dashboard["Staff dashboard<br/>[page.tsx]"]
  node_staff_overview["Staff overview data<br/>[route.ts]"]
end

subgraph group_identity["Identity and access"]
  node_admin_auth["Admin sessions<br/>[auth.ts]"]
  node_student_auth["Student sessions<br/>[student-auth.ts]"]
  node_staff_auth["Staff sessions<br/>[staff-auth.ts]"]
end

subgraph group_data["Data layer"]
  node_database_client["Prisma client<br/>[prisma.ts]"]
  node_postgres[("PostgreSQL")]
end

node_student(("Student"))

node_series_page -->|"reads series"| node_database_client
node_student_dashboard -.->|"loads dashboard"| node_student_dashboard_api
node_student_dashboard_api -->|"authenticates"| node_student_auth
node_student_dashboard_api -->|"queries tests"| node_database_client
node_checkout -.->|"payment requests"| node_payment_api
node_free_mock -->|"reads tests"| node_database_client
node_cbt -->|"renders"| node_exam_header
node_cbt -->|"renders"| node_question_panel
node_cbt -->|"renders"| node_exam_footer
node_attempt_api -->|"authenticates"| node_student_auth
node_attempt_api -->|"reads and submits"| node_database_client
node_result_page -->|"renders"| node_result_client
node_result_page -->|"reads result"| node_database_client
node_result_client -.->|"loads result"| node_result_api
node_result_client -->|"renders"| node_performance
node_result_client -->|"renders text"| node_math_text
node_admin_payments_api -->|"authorizes"| node_admin_auth
node_admin_payments_api -->|"queries payments"| node_database_client
node_admin_other_api -.->|"admin data access"| node_database_client
node_question_builder -.->|"question persistence"| node_database_client
node_staff_overview -->|"authenticates"| node_staff_auth
node_staff_overview -->|"queries overview"| node_database_client
node_admin_auth -->|"checks admin"| node_database_client
node_student_auth -->|"loads student"| node_database_client
node_staff_auth -->|"loads staff"| node_database_client
node_database_client -->|"database connection"| node_postgres

click node_student_entry "https://github.com/sushant22067/tej-test-series/blob/main/app/student/page.tsx"
click node_series_page "https://github.com/sushant22067/tej-test-series/blob/main/app/test-series/%5Bslug%5D/page.tsx"
click node_student_login "https://github.com/sushant22067/tej-test-series/blob/main/app/student/login/StudentLoginForm.tsx"
click node_student_dashboard "https://github.com/sushant22067/tej-test-series/blob/main/app/student/dashboard/page.tsx"
click node_student_dashboard_api "https://github.com/sushant22067/tej-test-series/blob/main/app/api/student/dashboard/route.ts"
click node_checkout "https://github.com/sushant22067/tej-test-series/blob/main/app/student/checkout/page.tsx"
click node_payment_api "https://github.com/sushant22067/tej-test-series/tree/main/app/api/student/payment"
click node_free_mock "https://github.com/sushant22067/tej-test-series/blob/main/app/api/free-mock-test/route.ts"
click node_cbt "https://github.com/sushant22067/tej-test-series/blob/main/components/cbt/ExamPage.tsx"
click node_exam_header "https://github.com/sushant22067/tej-test-series/blob/main/components/cbt/ExamHeader.tsx"
click node_question_panel "https://github.com/sushant22067/tej-test-series/blob/main/components/cbt/QuestionPanel.tsx"
click node_exam_footer "https://github.com/sushant22067/tej-test-series/blob/main/components/cbt/ExamFooter.tsx"
click node_question_palette "https://github.com/sushant22067/tej-test-series/blob/main/components/cbt/QuestionPalette.tsx"
click node_attempt_api "https://github.com/sushant22067/tej-test-series/tree/main/app/api/student/attempts/%5BattemptId%5D"
click node_answer_api "https://github.com/sushant22067/tej-test-series/blob/main/app/api/student/attempts/%5BattemptId%5D/answers/route.ts"
click node_result_api "https://github.com/sushant22067/tej-test-series/blob/main/app/api/student/results/%5BattemptId%5D/route.ts"
click node_result_page "https://github.com/sushant22067/tej-test-series/blob/main/app/results/%5BattemptId%5D/page.tsx"
click node_result_client "https://github.com/sushant22067/tej-test-series/blob/main/components/student/ResultClient.tsx"
click node_performance "https://github.com/sushant22067/tej-test-series/blob/main/components/student/PerformanceReview.tsx"
click node_math_text "https://github.com/sushant22067/tej-test-series/blob/main/components/student/MathText.tsx"
click node_admin_portal "https://github.com/sushant22067/tej-test-series/blob/main/app/admin/page.tsx"
click node_admin_results "https://github.com/sushant22067/tej-test-series/blob/main/app/admin/results/%5BresultId%5D/page.tsx"
click node_admin_payments_api "https://github.com/sushant22067/tej-test-series/blob/main/app/api/admin/payments/route.ts"
click node_admin_other_api "https://github.com/sushant22067/tej-test-series/tree/main/app/api/admin"
click node_question_builder "https://github.com/sushant22067/tej-test-series/blob/main/components/admin/PdfQuestionBuilder.tsx"
click node_staff_dashboard "https://github.com/sushant22067/tej-test-series/blob/main/app/staff/dashboard/page.tsx"
click node_staff_overview "https://github.com/sushant22067/tej-test-series/blob/main/app/api/staff/overview/route.ts"
click node_admin_auth "https://github.com/sushant22067/tej-test-series/blob/main/lib/auth.ts"
click node_student_auth "https://github.com/sushant22067/tej-test-series/blob/main/lib/student-auth.ts"
click node_staff_auth "https://github.com/sushant22067/tej-test-series/blob/main/lib/staff-auth.ts"
click node_database_client "https://github.com/sushant22067/tej-test-series/blob/main/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_student_entry,node_series_page,node_student_login,node_student_dashboard,node_student_dashboard_api,node_checkout,node_payment_api toneBlue
class node_free_mock,node_cbt,node_exam_header,node_question_panel,node_exam_footer,node_question_palette,node_attempt_api,node_answer_api,node_result_api,node_result_page,node_result_client,node_performance,node_math_text toneAmber
class node_admin_portal,node_admin_results,node_admin_payments_api,node_admin_other_api,node_question_builder,node_staff_dashboard,node_staff_overview toneMint
class node_admin_auth,node_student_auth,node_staff_auth toneRose
class node_database_client,node_postgres,node_student toneIndigo
```

## Components

### Student experience

- [Student portal](https://github.com/sushant22067/tej-test-series/blob/main/app/student/page.tsx): `app/student/page.tsx`
- [Test series](https://github.com/sushant22067/tej-test-series/blob/main/app/test-series/%5Bslug%5D/page.tsx): `app/test-series/[slug]/page.tsx`
- [Student login](https://github.com/sushant22067/tej-test-series/blob/main/app/student/login/StudentLoginForm.tsx): `app/student/login/StudentLoginForm.tsx`
- [Student dashboard](https://github.com/sushant22067/tej-test-series/blob/main/app/student/dashboard/page.tsx): `app/student/dashboard/page.tsx`
- [Dashboard data](https://github.com/sushant22067/tej-test-series/blob/main/app/api/student/dashboard/route.ts): `app/api/student/dashboard/route.ts`
- [Checkout](https://github.com/sushant22067/tej-test-series/blob/main/app/student/checkout/page.tsx): `app/student/checkout/page.tsx`
- [Payment routes](https://github.com/sushant22067/tej-test-series/tree/main/app/api/student/payment): `app/api/student/payment`

### Assessment and results

- [Free mock tests](https://github.com/sushant22067/tej-test-series/blob/main/app/api/free-mock-test/route.ts): `app/api/free-mock-test/route.ts`
- [Exam runner](https://github.com/sushant22067/tej-test-series/blob/main/components/cbt/ExamPage.tsx): `components/cbt/ExamPage.tsx`
- [Exam header](https://github.com/sushant22067/tej-test-series/blob/main/components/cbt/ExamHeader.tsx): `components/cbt/ExamHeader.tsx`
- [Question panel](https://github.com/sushant22067/tej-test-series/blob/main/components/cbt/QuestionPanel.tsx): `components/cbt/QuestionPanel.tsx`
- [Exam footer](https://github.com/sushant22067/tej-test-series/blob/main/components/cbt/ExamFooter.tsx): `components/cbt/ExamFooter.tsx`
- [Question palette](https://github.com/sushant22067/tej-test-series/blob/main/components/cbt/QuestionPalette.tsx): `components/cbt/QuestionPalette.tsx`
- [Attempt and submission](https://github.com/sushant22067/tej-test-series/tree/main/app/api/student/attempts/%5BattemptId%5D): `app/api/student/attempts/[attemptId]`
- [Answer operations](https://github.com/sushant22067/tej-test-series/blob/main/app/api/student/attempts/%5BattemptId%5D/answers/route.ts): `app/api/student/attempts/[attemptId]/answers/route.ts`
- [Result data](https://github.com/sushant22067/tej-test-series/blob/main/app/api/student/results/%5BattemptId%5D/route.ts): `app/api/student/results/[attemptId]/route.ts`
- [Result page](https://github.com/sushant22067/tej-test-series/blob/main/app/results/%5BattemptId%5D/page.tsx): `app/results/[attemptId]/page.tsx`
- [Result review](https://github.com/sushant22067/tej-test-series/blob/main/components/student/ResultClient.tsx): `components/student/ResultClient.tsx`
- [Performance review](https://github.com/sushant22067/tej-test-series/blob/main/components/student/PerformanceReview.tsx): `components/student/PerformanceReview.tsx`
- [Math rendering](https://github.com/sushant22067/tej-test-series/blob/main/components/student/MathText.tsx): `components/student/MathText.tsx`

### Admin and staff

- [Admin portal](https://github.com/sushant22067/tej-test-series/blob/main/app/admin/page.tsx): `app/admin/page.tsx`
- [Admin results](https://github.com/sushant22067/tej-test-series/blob/main/app/admin/results/%5BresultId%5D/page.tsx): `app/admin/results/[resultId]/page.tsx`
- [Payment oversight](https://github.com/sushant22067/tej-test-series/blob/main/app/api/admin/payments/route.ts): `app/api/admin/payments/route.ts`
- [Admin operations](https://github.com/sushant22067/tej-test-series/tree/main/app/api/admin): `app/api/admin`
- [Question authoring](https://github.com/sushant22067/tej-test-series/blob/main/components/admin/PdfQuestionBuilder.tsx): `components/admin/PdfQuestionBuilder.tsx`
- [Staff dashboard](https://github.com/sushant22067/tej-test-series/blob/main/app/staff/dashboard/page.tsx): `app/staff/dashboard/page.tsx`
- [Staff overview data](https://github.com/sushant22067/tej-test-series/blob/main/app/api/staff/overview/route.ts): `app/api/staff/overview/route.ts`

### Identity and access

- [Admin sessions](https://github.com/sushant22067/tej-test-series/blob/main/lib/auth.ts): `lib/auth.ts`
- [Student sessions](https://github.com/sushant22067/tej-test-series/blob/main/lib/student-auth.ts): `lib/student-auth.ts`
- [Staff sessions](https://github.com/sushant22067/tej-test-series/blob/main/lib/staff-auth.ts): `lib/staff-auth.ts`

### Data layer

- [Prisma client](https://github.com/sushant22067/tej-test-series/blob/main/lib/prisma.ts): `lib/prisma.ts`
- **PostgreSQL**

### Other components

- **Student**

## Connections

- Test series → Prisma client: reads series (evidence: `app/test-series/[slug]/page.tsx`)
- Student dashboard → Dashboard data: loads dashboard
- Dashboard data → Student sessions: authenticates (evidence: `app/api/student/dashboard/route.ts`)
- Dashboard data → Prisma client: queries tests (evidence: `app/api/student/dashboard/route.ts`)
- Checkout → Payment routes: payment requests
- Free mock tests → Prisma client: reads tests (evidence: `app/api/free-mock-test/route.ts`)
- Exam runner → Exam header: renders (evidence: `components/cbt/ExamPage.tsx`)
- Exam runner → Question panel: renders (evidence: `components/cbt/ExamPage.tsx`)
- Exam runner → Exam footer: renders (evidence: `components/cbt/ExamPage.tsx`)
- Attempt and submission → Student sessions: authenticates (evidence: `app/api/student/attempts/[attemptId]/route.ts`)
- Attempt and submission → Prisma client: reads and submits (evidence: `app/api/student/attempts/[attemptId]/route.ts`)
- Result page → Result review: renders (evidence: `app/results/[attemptId]/page.tsx`)
- Result page → Prisma client: reads result (evidence: `app/results/[attemptId]/page.tsx`)
- Result review → Result data: loads result
- Result review → Performance review: renders (evidence: `components/student/ResultClient.tsx`)
- Result review → Math rendering: renders text (evidence: `components/student/ResultClient.tsx`)
- Payment oversight → Admin sessions: authorizes (evidence: `app/api/admin/payments/route.ts`)
- Payment oversight → Prisma client: queries payments (evidence: `app/api/admin/payments/route.ts`)
- Admin operations → Prisma client: admin data access (evidence: `app/api/admin/payments/route.ts`)
- Question authoring → Prisma client: question persistence
- Staff overview data → Staff sessions: authenticates (evidence: `app/api/staff/overview/route.ts`)
- Staff overview data → Prisma client: queries overview (evidence: `app/api/staff/overview/route.ts`)
- Admin sessions → Prisma client: checks admin (evidence: `lib/auth.ts`)
- Student sessions → Prisma client: loads student (evidence: `lib/student-auth.ts`)
- Staff sessions → Prisma client: loads staff (evidence: `lib/staff-auth.ts`)
- Prisma client → PostgreSQL: database connection (evidence: `lib/prisma.ts`)
