# shreesaransairam19-lab/tsr-cms architecture

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

- Interactive diagram: https://gitdiagram.com/shreesaransairam19-lab/tsr-cms
- Repository: https://github.com/shreesaransairam19-lab/tsr-cms

## Overview

TSR CMS is a college-management web app for students, faculty, and administrators. Its main workflow is role-based sign-in, campus work through a shared dashboard, and domain-specific record management and reporting backed by Supabase. The graph keeps academic, finance, campus services, and shared platform concerns distinct. The README documents several capabilities whose implementation excerpts were not supplied; those are represented at their listed route or API paths, while uncertain UI-to-API wiring is omitted.

Main entry points: [`src/lib/auth-helpers.ts`](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/lib/auth-helpers.ts) (API authorization), [`src/app/api/exams/results/route.ts`](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/exams/results/route.ts) (Exams and results), [`src/app/api/students/route.ts`](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/students/route.ts) (Students and faculty), [`src/app/api/attendance/route.ts`](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/attendance/route.ts) (Attendance)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_academic["Academic records"]
  node_people["Students and faculty<br/>[route.ts]"]
  node_attendance["Attendance<br/>[route.ts]"]
  node_exams["Exams and results<br/>[route.ts]"]
  node_timetable["Subjects and timetable<br/>[route.ts]"]
  node_documents["Student documents<br/>[route.ts]"]
  node_gradecalc["Grade calculator"]
end

subgraph group_operations["Campus operations"]
  node_fees["Fees and receipts<br/>[route.ts]"]
  node_payroll["Payroll<br/>[route.ts]"]
  node_library["Library<br/>[route.ts]"]
  node_hostel["Hostel<br/>[route.ts]"]
  node_transport["Transport<br/>[route.ts]"]
  node_notifications["Notifications<br/>[route.ts]"]
end

subgraph group_platform["Access and platform"]
  node_apiaccess["API authorization<br/>[auth-helpers.ts]"]
  node_serverclient["Server Supabase client<br/>[server.ts]"]
  node_middleware["Session middleware<br/>[middleware.ts]"]
  node_db[("Supabase database")]
  node_supaauth["Supabase Auth"]
end

subgraph group_experience["Dashboard experience"]
  node_authui["Login and registration<br/>[page.tsx]"]
  node_dashboard["Shared dashboard<br/>[page.tsx]"]
  node_domainpages["Domain screens"]
end

subgraph group_integrations["Reports and integrations"]
  node_reports["Reports and export<br/>[route.ts]"]
  node_sheets["Google Sheets transfer<br/>[google-sheets.ts]"]
  node_email["Email service<br/>[email.ts]"]
end

node_campususers(("Students, staff, admins"))

node_campususers -->|"sign in"| node_authui
node_campususers -->|"use dashboard"| node_dashboard
node_authui -.->|"authenticates"| node_supaauth
node_dashboard -->|"offers modules"| node_domainpages
node_people -->|"checks access"| node_apiaccess
node_attendance -->|"checks access"| node_apiaccess
node_exams -->|"checks access"| node_apiaccess
node_fees -->|"checks access"| node_apiaccess
node_apiaccess -->|"creates client"| node_serverclient
node_serverclient -->|"queries data"| node_db
node_middleware -->|"manages session"| node_supaauth
node_attendance -->|"reads and writes"| node_db
node_fees -->|"reads and writes"| node_db
node_people -->|"reads and writes"| node_db
node_exams -->|"calculates grades"| node_gradecalc
node_exams -->|"loads exam data"| node_db
node_hostel -->|"manages allocations"| node_db
node_transport -->|"manages routes"| node_db
node_library -.->|"manages catalogue"| node_db
node_payroll -.->|"processes salaries"| node_db
node_documents -.->|"manages records"| node_db
node_notifications -.->|"sends email"| node_email
node_reports -.->|"exports data"| node_sheets
node_sheets -->|"imports and exports"| node_campususers

click node_people "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/students/route.ts"
click node_attendance "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/attendance/route.ts"
click node_exams "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/exams/results/route.ts"
click node_timetable "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/timetable/route.ts"
click node_documents "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/documents/route.ts"
click node_fees "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/fees/route.ts"
click node_payroll "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/payroll/route.ts"
click node_library "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/library/books/route.ts"
click node_hostel "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/hostel/route.ts"
click node_transport "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/transport/route.ts"
click node_notifications "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/notifications/route.ts"
click node_authui "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/(auth)/login/page.tsx"
click node_dashboard "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/(dashboard)/page.tsx"
click node_domainpages "https://github.com/shreesaransairam19-lab/tsr-cms/tree/main/src/app/(dashboard)"
click node_apiaccess "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/lib/auth-helpers.ts"
click node_serverclient "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/lib/supabase/server.ts"
click node_middleware "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/lib/supabase/middleware.ts"
click node_gradecalc "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/lib/utils/grade-calculator.ts"
click node_reports "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/reports/route.ts"
click node_sheets "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/lib/services/google-sheets.ts"
click node_email "https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/lib/services/email.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_people,node_attendance,node_exams,node_timetable,node_documents,node_gradecalc toneBlue
class node_fees,node_payroll,node_library,node_hostel,node_transport,node_notifications toneAmber
class node_apiaccess,node_serverclient,node_middleware,node_db,node_supaauth toneMint
class node_authui,node_dashboard,node_domainpages toneRose
class node_reports,node_sheets,node_email,node_campususers toneIndigo
```

## Components

### Academic records

- [Students and faculty](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/students/route.ts): `src/app/api/students/route.ts`
- [Attendance](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/attendance/route.ts): `src/app/api/attendance/route.ts`
- [Exams and results](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/exams/results/route.ts): `src/app/api/exams/results/route.ts`
- [Subjects and timetable](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/timetable/route.ts): `src/app/api/timetable/route.ts`
- [Student documents](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/documents/route.ts): `src/app/api/documents/route.ts`
- [Grade calculator](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/lib/utils/grade-calculator.ts): `src/lib/utils/grade-calculator.ts`

### Campus operations

- [Fees and receipts](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/fees/route.ts): `src/app/api/fees/route.ts`
- [Payroll](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/payroll/route.ts): `src/app/api/payroll/route.ts`
- [Library](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/library/books/route.ts): `src/app/api/library/books/route.ts`
- [Hostel](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/hostel/route.ts): `src/app/api/hostel/route.ts`
- [Transport](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/transport/route.ts): `src/app/api/transport/route.ts`
- [Notifications](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/notifications/route.ts): `src/app/api/notifications/route.ts`

### Access and platform

- [API authorization](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/lib/auth-helpers.ts): `src/lib/auth-helpers.ts`
- [Server Supabase client](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/lib/supabase/server.ts): `src/lib/supabase/server.ts`
- [Session middleware](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/lib/supabase/middleware.ts): `src/lib/supabase/middleware.ts`
- **Supabase database**
- **Supabase Auth**

### Dashboard experience

- [Login and registration](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/(auth)/login/page.tsx): `src/app/(auth)/login/page.tsx`
- [Shared dashboard](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/(dashboard)/page.tsx): `src/app/(dashboard)/page.tsx`
- [Domain screens](https://github.com/shreesaransairam19-lab/tsr-cms/tree/main/src/app/(dashboard)): `src/app/(dashboard)`

### Reports and integrations

- [Reports and export](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/app/api/reports/route.ts): `src/app/api/reports/route.ts`
- [Google Sheets transfer](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/lib/services/google-sheets.ts): `src/lib/services/google-sheets.ts`
- [Email service](https://github.com/shreesaransairam19-lab/tsr-cms/blob/main/src/lib/services/email.ts): `src/lib/services/email.ts`

### Other components

- **Students, staff, admins**

## Connections

- Students, staff, admins → Login and registration: sign in (evidence: `README.md`)
- Students, staff, admins → Shared dashboard: use dashboard (evidence: `README.md`)
- Login and registration → Supabase Auth: authenticates
- Shared dashboard → Domain screens: offers modules (evidence: `README.md`)
- Students and faculty → API authorization: checks access (evidence: `src/app/api/students/route.ts`)
- Attendance → API authorization: checks access (evidence: `src/app/api/attendance/route.ts`)
- Exams and results → API authorization: checks access (evidence: `src/app/api/exams/results/route.ts`)
- Fees and receipts → API authorization: checks access (evidence: `src/app/api/fees/route.ts`)
- API authorization → Server Supabase client: creates client (evidence: `src/lib/auth-helpers.ts`)
- Server Supabase client → Supabase database: queries data (evidence: `src/lib/supabase/server.ts`)
- Session middleware → Supabase Auth: manages session (evidence: `src/lib/supabase/middleware.ts`)
- Attendance → Supabase database: reads and writes (evidence: `src/app/api/attendance/route.ts`)
- Fees and receipts → Supabase database: reads and writes (evidence: `src/app/api/fees/route.ts`)
- Students and faculty → Supabase database: reads and writes (evidence: `src/app/api/students/route.ts`)
- Exams and results → Grade calculator: calculates grades (evidence: `src/app/api/exams/results/route.ts`)
- Exams and results → Supabase database: loads exam data (evidence: `src/app/api/exams/results/route.ts`)
- Hostel → Supabase database: manages allocations (evidence: `src/app/api/hostel/route.ts`)
- Transport → Supabase database: manages routes (evidence: `src/app/api/transport/route.ts`)
- Library → Supabase database: manages catalogue
- Payroll → Supabase database: processes salaries
- Student documents → Supabase database: manages records
- Notifications → Email service: sends email
- Reports and export → Google Sheets transfer: exports data
- Google Sheets transfer → Students, staff, admins: imports and exports (evidence: `README.md`)
