# aswinramaraj/eosbackend1 architecture

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

- Interactive diagram: https://gitdiagram.com/aswinramaraj/eosbackend1
- Repository: https://github.com/aswinramaraj/eosbackend1

## Overview

#### Purpose and Runtime
This is a TypeScript NestJS backend for a broad institutional/campus management platform. It exposes role-scoped HTTP APIs for students, faculty, administrators, HODs, principals, finance, hostel, examinations, library, placement, IQAC, transport, sports, medical, and procurement operations. Application bootstrap and root dependency composition are in `src/main.ts`, `src/app.module.ts`, and `src/app.controller.ts`.

#### Request, Identity, and Cross-Cutting Boundary
Requests enter Nest controllers, are validated through DTOs/pipes, authenticated with JWT, and authorized by role guards before reaching domain services. Common response transformation, logging, exception handling, and transient database retry form the API boundary. Relevant paths: `src/auth/auth.module.ts`, `src/auth/guards/jwt-auth.guard.ts`, `src/common/filters/http-exception.filter.ts`. Audit logging is a shared concern through `src/common/audit-log/audit-log.service.ts`; configuration is centralized at `src/config/configuration.ts`.

#### Persistence and File Infrastructure
Prisma is the primary persistence boundary: schema, migrations, and seed assets define and initialize the relational data model, while a Nest Prisma provider is injected into services. Paths: `prisma/schema.prisma`, `prisma/migrations`, `src/prisma/prisma.service.ts`. Storage is abstracted behind a provider/service layer with explicit Cloudinary and Supabase implementations, allowing document/media features to avoid direct vendor coupling: `src/modules/storage/storage.service.ts`, `src/modules/storage/providers/cloudinary-storage.provider.ts`, `src/modules/storage/providers/supabase-storage.provider.ts`.

#### Core Academic Identity and Learning Operations
Academic structure supplies foundational departments, courses, subjects, classes, batches, and calendars consumed by downstream workflows. Admissions owns student records and student self-service views, including requests, attendance, results, fees, and profile operations. Faculty modules own teaching assignments, timetables, attendance, learning materials, and mark entry. Paths: `src/modules/academic-structure/academic-calendar/academic-calendar.service.ts`, `src/modules/admissions/students/students.service.ts`, `src/modules/faculty/timetable/timetable.service.ts`.

#### Examination Lifecycle
The exams domain is a dense operational pipeline: configure regulations/types/exams and subject mappings; manage registrations, fee status, schedules, halls, seating, invigilation, and tickets; then capture marks, apply rules/locks, produce results/marksheets, and process revaluation or certificate workflows. Confidential actions and script handling are separately represented. Paths: `src/modules/exams/exams/exams.service.ts`, `src/modules/exams/seating-plans/seating-plans.service.ts`, `src/modules/exams/marks-roster/marks-roster.service.ts`.

#### Institutional Workflows and Approvals
Several domains implement stateful request-to-review flows across roles: student/faculty leave and OD requests, procurement requests/proposals/orders/GRNs, finance approvals/tracking, venue booking, hostel outings, and hall-ticket clearance. HOD, principal, academic coordinator, secretary, and finance modules provide role-specific aggregation, approval, and reporting views over shared operational records. Paths: `src/modules/procurement/purchase-order-proposals/purchase-order-proposals.service.ts`, `src/modules/finance/approvals/approvals.service.ts`, `src/modules/principal/approvals/approvals.service.ts`.

#### Administrative Service Domains and Communication
Independent bounded modules cover fees and payment verification, wallet/top-ups, hostel residency and gate operations, transport fleet/routes, library circulation, placement drives/interviews, medical-centre operations, sports administration, entrepreneurship, IQAC/accreditation, and alumni. Notifications are an internal delivery layer with device token registration and push-notification service; SMS is exposed as shared infrastructure. Paths: `src/modules/notifications/notifications/notifications.service.ts`, `src/common/sms/sms.service.ts`, `src/modules/fees-billing/fee-payments/fee-payment.service.ts`.

#### Flow Characteristics
Most domain slices follow a controller → DTO validation/authorization → service → Prisma/storage pattern, packaged in feature modules. “Me” controllers/services provide subject-scoped student, faculty, alumni, or sports views, while administrative controllers operate across records. Reporting/export utilities appear at domain boundaries, turning persisted operational data into downloadable or dashboard-oriented outputs rather than creating a separate analytics runtime.

Main entry points: [`src/app.controller.ts`](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/app.controller.ts) (Feature controllers), [`src/modules/exams/exams/exams.service.ts`](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/exams/exams/exams.service.ts) (Examination lifecycle), [`src/prisma/prisma.service.ts`](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/prisma/prisma.service.ts) (Prisma persistence), [`src/modules/academic-structure/academic-calendar/academic-calendar.service.ts`](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/academic-structure/academic-calendar/academic-calendar.service.ts) (Academic structure)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API boundary"]
  node_bootstrap{{"Nest application<br/>bootstrap<br/>[main.ts]"}}
  node_controllers["Feature controllers<br/>HTTP controllers<br/>[app.controller.ts]"]
  node_auth["JWT authentication<br/>auth module<br/>[auth.module.ts]"]
  node_jwt_guard["Role authorization<br/>JWT guard<br/>[jwt-auth.guard.ts]"]
  node_exception_boundary["API error handling<br/>exception filter"]
end

subgraph group_core["Core platform"]
  node_audit["Audit logging<br/>shared service"]
  node_prisma[("Prisma persistence<br/>database provider<br/>[prisma.service.ts]")]
  node_schema[("Relational schema and migrations<br/>Prisma data model<br/>[schema.prisma]")]
  node_storage["Storage abstraction<br/>file storage service<br/>[storage.service.ts]"]
  node_cloudinary["Cloudinary provider<br/>storage provider"]
  node_supabase["Supabase provider<br/>storage provider"]
end

subgraph group_academic["Academic operations"]
  node_academic_structure["Academic structure<br/>feature service"]
  node_admissions["Students and admissions<br/>feature service"]
  node_faculty["Faculty teaching operations<br/>feature service"]
  node_exams["Examination lifecycle<br/>operational pipeline<br/>[exams.service.ts]"]
  node_seating["Exam seating and invigilation<br/>exam operations"]
  node_marks["Marks and results processing<br/>exam operations"]
end

subgraph group_workflows["Institutional workflows"]
  node_approvals["Approval workflows<br/>cross-role workflow"]
  node_admin_approvals["Principal approval views<br/>role workspace"]
end

subgraph group_services["Service domains"]
  node_service_domains["Administrative services<br/>feature modules"]
  node_notifications["Notifications<br/>delivery service"]
  node_sms["SMS<br/>shared messaging<br/>[sms.service.ts]"]
end

node_bootstrap -->|"hosts"| node_controllers
node_controllers -->|"authenticates"| node_auth
node_auth -->|"installs"| node_jwt_guard
node_jwt_guard -->|"guards requests"| node_exception_boundary
node_controllers -->|"routes to"| node_academic_structure
node_controllers -->|"routes to"| node_admissions
node_controllers -->|"routes to"| node_faculty
node_controllers -->|"routes to"| node_exams
node_controllers -->|"routes to"| node_approvals
node_controllers -->|"routes to"| node_service_domains
node_academic_structure -->|"supplies academic context"| node_admissions
node_academic_structure -->|"supplies courses and calendars"| node_faculty
node_academic_structure -->|"supplies subjects and regulations context"| node_exams
node_admissions -->|"provides student records"| node_exams
node_faculty -->|"submits marks"| node_marks
node_exams -->|"creates schedules and halls"| node_seating
node_seating -->|"supports exam execution"| node_marks
node_exams -->|"governs result processing"| node_marks
node_approvals -->|"feeds decisions and reporting"| node_admin_approvals
node_approvals -->|"persists workflow state"| node_prisma
node_service_domains -->|"persists operations"| node_prisma
node_academic_structure -->|"persists records"| node_prisma
node_admissions -->|"persists records"| node_prisma
node_faculty -->|"persists records"| node_prisma
node_exams -->|"persists records"| node_prisma
node_prisma -->|"uses"| node_schema
node_storage -.->|"delegates to"| node_cloudinary
node_storage -.->|"delegates to"| node_supabase
node_exams -.->|"stores documents"| node_storage
node_service_domains -.->|"triggers"| node_notifications
node_notifications -.->|"uses shared messaging"| node_sms
node_controllers -.->|"audits operations"| node_audit

click node_bootstrap "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/main.ts"
click node_controllers "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/app.controller.ts"
click node_auth "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/auth/auth.module.ts"
click node_jwt_guard "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/auth/guards/jwt-auth.guard.ts"
click node_exception_boundary "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/common/filters/http-exception.filter.ts"
click node_audit "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/common/audit-log/audit-log.service.ts"
click node_prisma "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/prisma/prisma.service.ts"
click node_schema "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/prisma/schema.prisma"
click node_storage "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/storage/storage.service.ts"
click node_cloudinary "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/storage/providers/cloudinary-storage.provider.ts"
click node_supabase "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/storage/providers/supabase-storage.provider.ts"
click node_academic_structure "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/academic-structure/academic-calendar/academic-calendar.service.ts"
click node_admissions "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/admissions/students/students.service.ts"
click node_faculty "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/faculty/timetable/timetable.service.ts"
click node_exams "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/exams/exams/exams.service.ts"
click node_seating "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/exams/seating-plans/seating-plans.service.ts"
click node_marks "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/exams/marks-roster/marks-roster.service.ts"
click node_approvals "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/finance/approvals/approvals.service.ts"
click node_admin_approvals "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/principal/approvals/approvals.service.ts"
click node_service_domains "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/fees-billing/fee-payments/fee-payment.service.ts"
click node_notifications "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/notifications/notifications/notifications.service.ts"
click node_sms "https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/common/sms/sms.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_bootstrap,node_controllers,node_auth,node_jwt_guard,node_exception_boundary toneBlue
class node_audit,node_prisma,node_schema,node_storage,node_cloudinary,node_supabase toneAmber
class node_academic_structure,node_admissions,node_faculty,node_exams,node_seating,node_marks toneMint
class node_approvals,node_admin_approvals toneRose
class node_service_domains,node_notifications,node_sms toneIndigo
```

## Components

### API boundary

- [Nest application](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/main.ts): bootstrap · Composes the root application and HTTP API. · `src/main.ts`
- [Feature controllers](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/app.controller.ts): HTTP controllers · Role-scoped endpoints across institutional domains. · `src/app.controller.ts`
- [JWT authentication](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/auth/auth.module.ts): auth module · `src/auth/auth.module.ts`
- [Role authorization](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/auth/guards/jwt-auth.guard.ts): JWT guard · `src/auth/guards/jwt-auth.guard.ts`
- [API error handling](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/common/filters/http-exception.filter.ts): exception filter · Complements validation, response transformation, logging, and retry concerns. · `src/common/filters/http-exception.filter.ts`

### Core platform

- [Audit logging](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/common/audit-log/audit-log.service.ts): shared service · `src/common/audit-log/audit-log.service.ts`
- [Prisma persistence](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/prisma/prisma.service.ts): database provider · Injected relational persistence boundary for feature services. · `src/prisma/prisma.service.ts`
- [Relational schema and migrations](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/prisma/schema.prisma): Prisma data model · Defines, migrates, and seeds institutional records. · `prisma/schema.prisma`
- [Storage abstraction](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/storage/storage.service.ts): file storage service · Keeps document and media features vendor-independent. · `src/modules/storage/storage.service.ts`
- [Cloudinary provider](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/storage/providers/cloudinary-storage.provider.ts): storage provider · `src/modules/storage/providers/cloudinary-storage.provider.ts`
- [Supabase provider](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/storage/providers/supabase-storage.provider.ts): storage provider · `src/modules/storage/providers/supabase-storage.provider.ts`

### Academic operations

- [Academic structure](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/academic-structure/academic-calendar/academic-calendar.service.ts): feature service · Departments, courses, subjects, classes, batches, and calendars. · `src/modules/academic-structure/academic-calendar/academic-calendar.service.ts`
- [Students and admissions](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/admissions/students/students.service.ts): feature service · Student records and student self-service operations. · `src/modules/admissions/students/students.service.ts`
- [Faculty teaching operations](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/faculty/timetable/timetable.service.ts): feature service · Teaching assignments, timetables, attendance, materials, and marks. · `src/modules/faculty/timetable/timetable.service.ts`
- [Examination lifecycle](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/exams/exams/exams.service.ts): operational pipeline · Setup through registration, scheduling, marks, results, and revaluation. · `src/modules/exams/exams/exams.service.ts`
- [Exam seating and invigilation](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/exams/seating-plans/seating-plans.service.ts): exam operations · `src/modules/exams/seating-plans/seating-plans.service.ts`
- [Marks and results processing](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/exams/marks-roster/marks-roster.service.ts): exam operations · Applies marks rules and locks before results and marksheets. · `src/modules/exams/marks-roster/marks-roster.service.ts`

### Institutional workflows

- [Approval workflows](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/finance/approvals/approvals.service.ts): cross-role workflow · Leave, OD, procurement, finance, clearance, booking, and hostel requests. · `src/modules/finance/approvals/approvals.service.ts`
- [Principal approval views](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/principal/approvals/approvals.service.ts): role workspace · Cross-record approval and reporting views for leadership roles. · `src/modules/principal/approvals/approvals.service.ts`

### Service domains

- [Administrative services](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/fees-billing/fee-payments/fee-payment.service.ts): feature modules · Fees, hostel, transport, library, placement, medical, sports, IQAC, and alumni. · `src/modules/fees-billing/fee-payments/fee-payment.service.ts`
- [Notifications](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/modules/notifications/notifications/notifications.service.ts): delivery service · Device token registration and push delivery. · `src/modules/notifications/notifications/notifications.service.ts`
- [SMS](https://github.com/aswinramaraj/eosbackend1/blob/security/phase3-mechanical-fixes/src/common/sms/sms.service.ts): shared messaging · `src/common/sms/sms.service.ts`

## Connections

- Nest application → Feature controllers: hosts
- Feature controllers → JWT authentication: authenticates
- JWT authentication → Role authorization: installs
- Role authorization → API error handling: guards requests
- Feature controllers → Academic structure: routes to
- Feature controllers → Students and admissions: routes to
- Feature controllers → Faculty teaching operations: routes to
- Feature controllers → Examination lifecycle: routes to
- Feature controllers → Approval workflows: routes to
- Feature controllers → Administrative services: routes to
- Academic structure → Students and admissions: supplies academic context
- Academic structure → Faculty teaching operations: supplies courses and calendars
- Academic structure → Examination lifecycle: supplies subjects and regulations context
- Students and admissions → Examination lifecycle: provides student records
- Faculty teaching operations → Marks and results processing: submits marks
- Examination lifecycle → Exam seating and invigilation: creates schedules and halls
- Exam seating and invigilation → Marks and results processing: supports exam execution
- Examination lifecycle → Marks and results processing: governs result processing
- Approval workflows → Principal approval views: feeds decisions and reporting
- Approval workflows → Prisma persistence: persists workflow state
- Administrative services → Prisma persistence: persists operations
- Academic structure → Prisma persistence: persists records
- Students and admissions → Prisma persistence: persists records
- Faculty teaching operations → Prisma persistence: persists records
- Examination lifecycle → Prisma persistence: persists records
- Prisma persistence → Relational schema and migrations: uses
- Storage abstraction → Cloudinary provider: delegates to
- Storage abstraction → Supabase provider: delegates to
- Examination lifecycle → Storage abstraction: stores documents
- Administrative services → Notifications: triggers
- Notifications → SMS: uses shared messaging
- Feature controllers → Audit logging: audits operations
