# gagandk5/rrce-erp architecture

> Architecture diagram of the GitHub repository gagandk5/rrce-erp, 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/gagandk5/rrce-erp
- Repository: https://github.com/gagandk5/rrce-erp

## Overview

RRCE ERP is a college administration system with role-based portals for admissions, executive and department oversight, faculty, and students. Its main workflows cover enrollment and USN assignment, timetable scheduling and clash checks, attendance with a 24-hour lockout, and student-facing academic and fee services. Route handlers and server actions implement backend operations over Prisma; shared modules provide authentication and domain rules. The README documents several capabilities whose individual wiring is not shown in the sampled source, so those links are documented at the capability level rather than presented as inspected calls.

Main entry points: [`lib/prisma.ts`](https://github.com/gagandk5/rrce-erp/blob/main/lib/prisma.ts) (Prisma data access), [`lib/auth.ts`](https://github.com/gagandk5/rrce-erp/blob/main/lib/auth.ts) (Session authentication), [`app/principal/page.tsx`](https://github.com/gagandk5/rrce-erp/blob/main/app/principal/page.tsx) (Principal portal), [`app/api/timetable/route.ts`](https://github.com/gagandk5/rrce-erp/blob/main/app/api/timetable/route.ts) (Timetable API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portals["Role Portals"]
  node_login["Login<br/>[page.tsx]"]
  node_admissions["Admissions portal<br/>[page.tsx]"]
  node_principal["Principal portal<br/>[page.tsx]"]
  node_hod["HOD portal<br/>[page.tsx]"]
  node_faculty["Faculty portal<br/>[page.tsx]"]
  node_student["Student portal<br/>[page.tsx]"]
end

subgraph group_academic["Academic Operations"]
  node_attendance["Attendance sessions<br/>[route.ts]"]
  node_attendance_override["Lockout override<br/>[route.ts]"]
  node_faculty_attendance["Faculty roll call<br/>[actions.ts]"]
  node_timetable_api["Timetable API<br/>[route.ts]"]
  node_clash["Clash validation<br/>[clash-engine.ts]"]
  node_assignments["Assignment submissions<br/>[route.ts]"]
  node_assignment_files["Assignment file access<br/>[route.ts]"]
end

subgraph group_admin["Enrollment and Oversight"]
  node_enrollment["Student enrollment<br/>[route.ts]"]
  node_reallocation["Branch reallocation<br/>[reallocation.ts]"]
  node_invoices["Fee invoices<br/>[route.ts]"]
  node_audit["Audit logs<br/>[route.ts]"]
end

subgraph group_core["Shared Services"]
  node_auth["Session authentication<br/>[auth.ts]"]
  node_utils["USN and lockout rules<br/>[utils.ts]"]
  node_prisma[("Prisma data access<br/>[prisma.ts]")]
  node_seed["Database seeding<br/>[seed-service.ts]"]
end

node_actors(("College users"))

node_actors -->|"sign in"| node_login
node_actors -->|"manage intake"| node_admissions
node_actors -->|"oversee institution"| node_principal
node_actors -->|"manage department"| node_hod
node_actors -->|"manage classes"| node_faculty
node_actors -->|"view records"| node_student
node_admissions -.->|"enroll students"| node_enrollment
node_admissions -->|"reallocate branch"| node_reallocation
node_principal -.->|"review fees"| node_invoices
node_principal -.->|"review audit"| node_audit
node_hod -->|"override lockout"| node_attendance_override
node_principal -->|"override lockout"| node_attendance_override
node_faculty -->|"record roll call"| node_faculty_attendance
node_faculty -.->|"manage schedule"| node_timetable_api
node_student -.->|"submit work"| node_assignments
node_student -.->|"view and pay"| node_invoices
node_timetable_api -->|"validate clashes"| node_clash
node_attendance -->|"check lockout"| node_utils
node_enrollment -->|"check session"| node_auth
node_enrollment -->|"generate USN"| node_utils
node_enrollment -->|"read and write"| node_prisma
node_attendance -->|"check session"| node_auth
node_attendance -->|"read and write"| node_prisma
node_attendance_override -->|"check session"| node_auth
node_attendance_override -->|"update sessions"| node_prisma
node_timetable_api -->|"check session"| node_auth
node_timetable_api -->|"read and write"| node_prisma
node_clash -->|"read schedule"| node_prisma
node_assignments -->|"check session"| node_auth
node_assignments -->|"store submissions"| node_prisma
node_assignments -->|"serve file URL"| node_assignment_files
node_invoices -->|"check session"| node_auth
node_invoices -->|"read and update"| node_prisma
node_reallocation -.->|"reallocate transaction"| node_prisma
node_seed -->|"populate records"| node_prisma
node_seed -->|"hash passwords"| node_auth
node_seed -->|"generate identifiers"| node_utils

click node_login "https://github.com/gagandk5/rrce-erp/blob/main/app/login/page.tsx"
click node_admissions "https://github.com/gagandk5/rrce-erp/blob/main/app/admissions/page.tsx"
click node_principal "https://github.com/gagandk5/rrce-erp/blob/main/app/principal/page.tsx"
click node_hod "https://github.com/gagandk5/rrce-erp/blob/main/app/hod/page.tsx"
click node_faculty "https://github.com/gagandk5/rrce-erp/blob/main/app/faculty/page.tsx"
click node_student "https://github.com/gagandk5/rrce-erp/blob/main/app/student/page.tsx"
click node_attendance "https://github.com/gagandk5/rrce-erp/blob/main/app/api/attendance/session/route.ts"
click node_attendance_override "https://github.com/gagandk5/rrce-erp/blob/main/app/api/attendance/unlock/route.ts"
click node_faculty_attendance "https://github.com/gagandk5/rrce-erp/blob/main/app/faculty/attendance/actions.ts"
click node_timetable_api "https://github.com/gagandk5/rrce-erp/blob/main/app/api/timetable/route.ts"
click node_clash "https://github.com/gagandk5/rrce-erp/blob/main/lib/clash-engine.ts"
click node_assignments "https://github.com/gagandk5/rrce-erp/blob/main/app/api/assignments/route.ts"
click node_assignment_files "https://github.com/gagandk5/rrce-erp/blob/main/app/api/assignments/files/%5BstorageKey%5D/route.ts"
click node_enrollment "https://github.com/gagandk5/rrce-erp/blob/main/app/api/students/route.ts"
click node_reallocation "https://github.com/gagandk5/rrce-erp/blob/main/lib/reallocation.ts"
click node_invoices "https://github.com/gagandk5/rrce-erp/blob/main/app/api/invoices/route.ts"
click node_audit "https://github.com/gagandk5/rrce-erp/blob/main/app/api/audit-logs/route.ts"
click node_auth "https://github.com/gagandk5/rrce-erp/blob/main/lib/auth.ts"
click node_utils "https://github.com/gagandk5/rrce-erp/blob/main/lib/utils.ts"
click node_prisma "https://github.com/gagandk5/rrce-erp/blob/main/lib/prisma.ts"
click node_seed "https://github.com/gagandk5/rrce-erp/blob/main/lib/seed-service.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_login,node_admissions,node_principal,node_hod,node_faculty,node_student,node_actors toneBlue
class node_attendance,node_attendance_override,node_faculty_attendance,node_timetable_api,node_clash,node_assignments,node_assignment_files toneAmber
class node_enrollment,node_reallocation,node_invoices,node_audit toneMint
class node_auth,node_utils,node_prisma,node_seed toneRose
```

## Components

### Role Portals

- [Login](https://github.com/gagandk5/rrce-erp/blob/main/app/login/page.tsx): `app/login/page.tsx`
- [Admissions portal](https://github.com/gagandk5/rrce-erp/blob/main/app/admissions/page.tsx): `app/admissions/page.tsx`
- [Principal portal](https://github.com/gagandk5/rrce-erp/blob/main/app/principal/page.tsx): `app/principal/page.tsx`
- [HOD portal](https://github.com/gagandk5/rrce-erp/blob/main/app/hod/page.tsx): `app/hod/page.tsx`
- [Faculty portal](https://github.com/gagandk5/rrce-erp/blob/main/app/faculty/page.tsx): `app/faculty/page.tsx`
- [Student portal](https://github.com/gagandk5/rrce-erp/blob/main/app/student/page.tsx): `app/student/page.tsx`

### Academic Operations

- [Attendance sessions](https://github.com/gagandk5/rrce-erp/blob/main/app/api/attendance/session/route.ts): `app/api/attendance/session/route.ts`
- [Lockout override](https://github.com/gagandk5/rrce-erp/blob/main/app/api/attendance/unlock/route.ts): `app/api/attendance/unlock/route.ts`
- [Faculty roll call](https://github.com/gagandk5/rrce-erp/blob/main/app/faculty/attendance/actions.ts): `app/faculty/attendance/actions.ts`
- [Timetable API](https://github.com/gagandk5/rrce-erp/blob/main/app/api/timetable/route.ts): `app/api/timetable/route.ts`
- [Clash validation](https://github.com/gagandk5/rrce-erp/blob/main/lib/clash-engine.ts): `lib/clash-engine.ts`
- [Assignment submissions](https://github.com/gagandk5/rrce-erp/blob/main/app/api/assignments/route.ts): `app/api/assignments/route.ts`
- [Assignment file access](https://github.com/gagandk5/rrce-erp/blob/main/app/api/assignments/files/%5BstorageKey%5D/route.ts): `app/api/assignments/files/[storageKey]/route.ts`

### Enrollment and Oversight

- [Student enrollment](https://github.com/gagandk5/rrce-erp/blob/main/app/api/students/route.ts): `app/api/students/route.ts`
- [Branch reallocation](https://github.com/gagandk5/rrce-erp/blob/main/lib/reallocation.ts): `lib/reallocation.ts`
- [Fee invoices](https://github.com/gagandk5/rrce-erp/blob/main/app/api/invoices/route.ts): `app/api/invoices/route.ts`
- [Audit logs](https://github.com/gagandk5/rrce-erp/blob/main/app/api/audit-logs/route.ts): `app/api/audit-logs/route.ts`

### Shared Services

- [Session authentication](https://github.com/gagandk5/rrce-erp/blob/main/lib/auth.ts): `lib/auth.ts`
- [USN and lockout rules](https://github.com/gagandk5/rrce-erp/blob/main/lib/utils.ts): `lib/utils.ts`
- [Prisma data access](https://github.com/gagandk5/rrce-erp/blob/main/lib/prisma.ts): `lib/prisma.ts`
- [Database seeding](https://github.com/gagandk5/rrce-erp/blob/main/lib/seed-service.ts): `lib/seed-service.ts`

### Other components

- **College users**

## Connections

- College users → Login: sign in
- College users → Admissions portal: manage intake
- College users → Principal portal: oversee institution
- College users → HOD portal: manage department
- College users → Faculty portal: manage classes
- College users → Student portal: view records
- Admissions portal → Student enrollment: enroll students
- Admissions portal → Branch reallocation: reallocate branch
- Principal portal → Fee invoices: review fees
- Principal portal → Audit logs: review audit
- HOD portal → Lockout override: override lockout
- Principal portal → Lockout override: override lockout
- Faculty portal → Faculty roll call: record roll call
- Faculty portal → Timetable API: manage schedule
- Student portal → Assignment submissions: submit work
- Student portal → Fee invoices: view and pay
- Timetable API → Clash validation: validate clashes (evidence: `app/api/timetable/route.ts`)
- Attendance sessions → USN and lockout rules: check lockout (evidence: `app/api/attendance/session/route.ts`)
- Student enrollment → Session authentication: check session (evidence: `app/api/students/route.ts`)
- Student enrollment → USN and lockout rules: generate USN (evidence: `app/api/students/route.ts`)
- Student enrollment → Prisma data access: read and write (evidence: `app/api/students/route.ts`)
- Attendance sessions → Session authentication: check session (evidence: `app/api/attendance/session/route.ts`)
- Attendance sessions → Prisma data access: read and write (evidence: `app/api/attendance/session/route.ts`)
- Lockout override → Session authentication: check session (evidence: `app/api/attendance/unlock/route.ts`)
- Lockout override → Prisma data access: update sessions (evidence: `app/api/attendance/unlock/route.ts`)
- Timetable API → Session authentication: check session (evidence: `app/api/timetable/route.ts`)
- Timetable API → Prisma data access: read and write (evidence: `app/api/timetable/route.ts`)
- Clash validation → Prisma data access: read schedule (evidence: `lib/clash-engine.ts`)
- Assignment submissions → Session authentication: check session (evidence: `app/api/assignments/route.ts`)
- Assignment submissions → Prisma data access: store submissions (evidence: `app/api/assignments/route.ts`)
- Assignment submissions → Assignment file access: serve file URL (evidence: `app/api/assignments/route.ts`)
- Fee invoices → Session authentication: check session (evidence: `app/api/invoices/route.ts`)
- Fee invoices → Prisma data access: read and update (evidence: `app/api/invoices/route.ts`)
- Branch reallocation → Prisma data access: reallocate transaction
- Database seeding → Prisma data access: populate records (evidence: `lib/seed-service.ts`)
- Database seeding → Session authentication: hash passwords (evidence: `lib/seed-service.ts`)
- Database seeding → USN and lockout rules: generate identifiers (evidence: `lib/seed-service.ts`)
