# suvankar98/srs architecture

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

- Interactive diagram: https://gitdiagram.com/suvankar98/srs
- Repository: https://github.com/suvankar98/srs

## Overview

This is a Next.js service-call management application for administrators, managers, and employees. Its central operational flow is manager/admin allocation of service requests to employees, with assignment state persisted and optional WhatsApp notification; employees and managers then update and review call status. The repository also provides administration, call history and media, reporting/exports, and a technical-manual library. Edges reflect the supplied excerpts, SOURCE INDEX references, or README; unsampled UI wiring is not inferred.

Main entry points: [`src/lib/prisma.ts`](https://github.com/suvankar98/srs/blob/main/src/lib/prisma.ts) (Application database), [`src/app/actions.ts`](https://github.com/suvankar98/srs/blob/main/src/app/actions.ts) (Service actions), [`src/lib/auth.ts`](https://github.com/suvankar98/srs/blob/main/src/lib/auth.ts) (Session and roles), [`src/app/api/service-request/[id]/pdf/route.ts`](https://github.com/suvankar98/srs/blob/main/src/app/api/service-request/%5Bid%5D/pdf/route.ts) (Service report PDF)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operations["Call operations"]
  node_assign_api["Assignment endpoint<br/>[route.ts]"]
  node_dashboard_status["Status controls"]
  node_server_actions["Service actions<br/>[actions.ts]"]
  node_booking_api["Booking endpoint<br/>[route.ts]"]
  node_service_pdf["Service report PDF<br/>[route.ts]"]
end

subgraph group_admin["Administration"]
  node_admin_ui["Admin console<br/>[page.tsx]"]
  node_saved_customers["Saved customer details"]
end

subgraph group_insights["History and reporting"]
  node_call_history["Call history<br/>[page.tsx]"]
  node_export_api["Report export<br/>[route.ts]"]
  node_report_ui["Employee reporting<br/>[page.tsx]"]
  node_report_data["Employee report data"]
  node_report_rules["Performance rules<br/>[employee-report.ts]"]
end

subgraph group_resources["Media and manuals"]
  node_gallery_ui["Media gallery<br/>[gallery-client.tsx]"]
  node_gallery_data["Gallery and uploads<br/>[gallery.ts]"]
  node_tech_manual["Technical manuals"]
end

subgraph group_platform["Shared services"]
  node_auth["Session and roles<br/>[auth.ts]"]
  node_auth_constants["Role constants<br/>[auth-constants.ts]"]
  node_status_utils["Status normalization<br/>[status-utils.ts]"]
  node_docket["Docket formatting<br/>[docket.ts]"]
  node_database[("Application database<br/>[prisma.ts]")]
  node_whatsapp["WhatsApp notifications<br/>[whatsapp.ts]"]
end

node_manager(("Manager / admin"))
node_employee(("Employee"))
node_twilio["Twilio WhatsApp"]

node_manager -->|"allocates calls"| node_assign_api
node_assign_api -->|"checks access"| node_auth
node_assign_api -->|"normalizes status"| node_status_utils
node_assign_api -->|"reads and updates"| node_database
node_manager -.->|"reviews status"| node_dashboard_status
node_dashboard_status -->|"updates status"| node_server_actions
node_dashboard_status -->|"formats status"| node_status_utils
node_dashboard_status -.->|"adds review notes"| node_auth
node_server_actions -->|"checks session"| node_auth
node_server_actions -->|"persists changes"| node_database
node_server_actions -->|"sends allocation notice"| node_whatsapp
node_whatsapp -.->|"sends message"| node_twilio
node_booking_api -->|"saves booking"| node_database
node_service_pdf -->|"checks access"| node_auth
node_service_pdf -->|"loads request"| node_database
node_service_pdf -->|"formats status"| node_status_utils
node_service_pdf -->|"formats docket"| node_docket
node_admin_ui -->|"manages records"| node_server_actions
node_admin_ui -->|"checks roles"| node_auth
node_admin_ui -->|"loads administration data"| node_database
node_saved_customers -->|"uses customer actions"| node_server_actions
node_call_history -->|"loads call history"| node_database
node_call_history -->|"loads media"| node_gallery_data
node_call_history -->|"checks access"| node_auth
node_export_api -->|"checks export access"| node_auth
node_export_api -->|"loads export rows"| node_database
node_export_api -->|"normalizes status"| node_status_utils
node_report_ui -->|"loads report data"| node_report_data
node_report_ui -->|"loads reporting data"| node_database
node_report_data -->|"queries report inputs"| node_database
node_report_data -->|"uses calculations"| node_report_rules
node_report_rules -->|"formats docket"| node_docket
node_gallery_ui -->|"uses gallery actions"| node_server_actions
node_gallery_ui -->|"formats docket"| node_docket
node_gallery_data -->|"loads request metadata"| node_database
node_gallery_data -->|"formats docket"| node_docket
node_tech_manual -.->|"manages manuals"| node_server_actions
node_auth -->|"uses role definitions"| node_auth_constants

click node_assign_api "https://github.com/suvankar98/srs/blob/main/src/app/api/assign/route.ts"
click node_dashboard_status "https://github.com/suvankar98/srs/blob/main/src/app/dashboard/admin-manager-status-select.tsx"
click node_server_actions "https://github.com/suvankar98/srs/blob/main/src/app/actions.ts"
click node_booking_api "https://github.com/suvankar98/srs/blob/main/src/app/api/save-booking/route.ts"
click node_service_pdf "https://github.com/suvankar98/srs/blob/main/src/app/api/service-request/%5Bid%5D/pdf/route.ts"
click node_admin_ui "https://github.com/suvankar98/srs/blob/main/src/app/admin/page.tsx"
click node_saved_customers "https://github.com/suvankar98/srs/blob/main/src/app/admin/saved-customer-details-panel.tsx"
click node_call_history "https://github.com/suvankar98/srs/blob/main/src/app/call-history/page.tsx"
click node_export_api "https://github.com/suvankar98/srs/blob/main/src/app/api/report/export/route.ts"
click node_report_ui "https://github.com/suvankar98/srs/blob/main/src/app/report/page.tsx"
click node_report_data "https://github.com/suvankar98/srs/blob/main/src/lib/employee-report-data.ts"
click node_report_rules "https://github.com/suvankar98/srs/blob/main/src/lib/employee-report.ts"
click node_gallery_ui "https://github.com/suvankar98/srs/blob/main/src/app/gallery/gallery-client.tsx"
click node_gallery_data "https://github.com/suvankar98/srs/blob/main/src/lib/gallery.ts"
click node_tech_manual "https://github.com/suvankar98/srs/tree/main/src/app/tech-manual"
click node_auth "https://github.com/suvankar98/srs/blob/main/src/lib/auth.ts"
click node_auth_constants "https://github.com/suvankar98/srs/blob/main/src/lib/auth-constants.ts"
click node_status_utils "https://github.com/suvankar98/srs/blob/main/src/app/status-utils.ts"
click node_docket "https://github.com/suvankar98/srs/blob/main/src/lib/docket.ts"
click node_database "https://github.com/suvankar98/srs/blob/main/src/lib/prisma.ts"
click node_whatsapp "https://github.com/suvankar98/srs/blob/main/src/lib/whatsapp.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_assign_api,node_dashboard_status,node_server_actions,node_booking_api,node_service_pdf toneBlue
class node_admin_ui,node_saved_customers toneAmber
class node_call_history,node_export_api,node_report_ui,node_report_data,node_report_rules toneMint
class node_gallery_ui,node_gallery_data,node_tech_manual toneRose
class node_auth,node_auth_constants,node_status_utils,node_docket,node_database,node_whatsapp,node_manager,node_employee,node_twilio toneIndigo
```

## Components

### Call operations

- [Assignment endpoint](https://github.com/suvankar98/srs/blob/main/src/app/api/assign/route.ts): `src/app/api/assign/route.ts`
- [Status controls](https://github.com/suvankar98/srs/blob/main/src/app/dashboard/admin-manager-status-select.tsx): `src/app/dashboard/admin-manager-status-select.tsx`
- [Service actions](https://github.com/suvankar98/srs/blob/main/src/app/actions.ts): `src/app/actions.ts`
- [Booking endpoint](https://github.com/suvankar98/srs/blob/main/src/app/api/save-booking/route.ts): `src/app/api/save-booking/route.ts`
- [Service report PDF](https://github.com/suvankar98/srs/blob/main/src/app/api/service-request/%5Bid%5D/pdf/route.ts): `src/app/api/service-request/[id]/pdf/route.ts`

### Administration

- [Admin console](https://github.com/suvankar98/srs/blob/main/src/app/admin/page.tsx): `src/app/admin/page.tsx`
- [Saved customer details](https://github.com/suvankar98/srs/blob/main/src/app/admin/saved-customer-details-panel.tsx): `src/app/admin/saved-customer-details-panel.tsx`

### History and reporting

- [Call history](https://github.com/suvankar98/srs/blob/main/src/app/call-history/page.tsx): `src/app/call-history/page.tsx`
- [Report export](https://github.com/suvankar98/srs/blob/main/src/app/api/report/export/route.ts): `src/app/api/report/export/route.ts`
- [Employee reporting](https://github.com/suvankar98/srs/blob/main/src/app/report/page.tsx): `src/app/report/page.tsx`
- [Employee report data](https://github.com/suvankar98/srs/blob/main/src/lib/employee-report-data.ts): `src/lib/employee-report-data.ts`
- [Performance rules](https://github.com/suvankar98/srs/blob/main/src/lib/employee-report.ts): `src/lib/employee-report.ts`

### Media and manuals

- [Media gallery](https://github.com/suvankar98/srs/blob/main/src/app/gallery/gallery-client.tsx): `src/app/gallery/gallery-client.tsx`
- [Gallery and uploads](https://github.com/suvankar98/srs/blob/main/src/lib/gallery.ts): `src/lib/gallery.ts`
- [Technical manuals](https://github.com/suvankar98/srs/tree/main/src/app/tech-manual): `src/app/tech-manual`

### Shared services

- [Session and roles](https://github.com/suvankar98/srs/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Role constants](https://github.com/suvankar98/srs/blob/main/src/lib/auth-constants.ts): `src/lib/auth-constants.ts`
- [Status normalization](https://github.com/suvankar98/srs/blob/main/src/app/status-utils.ts): `src/app/status-utils.ts`
- [Docket formatting](https://github.com/suvankar98/srs/blob/main/src/lib/docket.ts): `src/lib/docket.ts`
- [Application database](https://github.com/suvankar98/srs/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`
- [WhatsApp notifications](https://github.com/suvankar98/srs/blob/main/src/lib/whatsapp.ts): `src/lib/whatsapp.ts`

### Other components

- **Manager / admin**
- **Employee**
- **Twilio WhatsApp**

## Connections

- Manager / admin → Assignment endpoint: allocates calls (evidence: `README.md`)
- Assignment endpoint → Session and roles: checks access (evidence: `src/app/api/assign/route.ts`)
- Assignment endpoint → Status normalization: normalizes status (evidence: `src/app/api/assign/route.ts`)
- Assignment endpoint → Application database: reads and updates (evidence: `src/app/api/assign/route.ts`)
- Manager / admin → Status controls: reviews status
- Status controls → Service actions: updates status (evidence: `src/app/dashboard/admin-manager-status-select.tsx`)
- Status controls → Status normalization: formats status (evidence: `src/app/dashboard/admin-manager-status-select.tsx`)
- Status controls → Session and roles: adds review notes
- Service actions → Session and roles: checks session (evidence: `src/app/actions.ts`)
- Service actions → Application database: persists changes (evidence: `src/app/actions.ts`)
- Service actions → WhatsApp notifications: sends allocation notice (evidence: `src/app/actions.ts`)
- WhatsApp notifications → Twilio WhatsApp: sends message (evidence: `README.md`)
- Booking endpoint → Application database: saves booking (evidence: `src/app/api/save-booking/route.ts`)
- Service report PDF → Session and roles: checks access (evidence: `src/app/api/service-request/[id]/pdf/route.ts`)
- Service report PDF → Application database: loads request (evidence: `src/app/api/service-request/[id]/pdf/route.ts`)
- Service report PDF → Status normalization: formats status (evidence: `src/app/api/service-request/[id]/pdf/route.ts`)
- Service report PDF → Docket formatting: formats docket (evidence: `src/app/api/service-request/[id]/pdf/route.ts`)
- Admin console → Service actions: manages records (evidence: `src/app/admin/page.tsx`)
- Admin console → Session and roles: checks roles (evidence: `src/app/admin/page.tsx`)
- Admin console → Application database: loads administration data (evidence: `src/app/admin/page.tsx`)
- Saved customer details → Service actions: uses customer actions (evidence: `src/app/admin/saved-customer-details-panel.tsx`)
- Call history → Application database: loads call history (evidence: `src/app/call-history/page.tsx`)
- Call history → Gallery and uploads: loads media (evidence: `src/app/call-history/page.tsx`)
- Call history → Session and roles: checks access (evidence: `src/app/call-history/page.tsx`)
- Report export → Session and roles: checks export access (evidence: `src/app/api/report/export/route.ts`)
- Report export → Application database: loads export rows (evidence: `src/app/api/report/export/route.ts`)
- Report export → Status normalization: normalizes status (evidence: `src/app/api/report/export/route.ts`)
- Employee reporting → Employee report data: loads report data (evidence: `src/app/report/page.tsx`)
- Employee reporting → Application database: loads reporting data (evidence: `src/app/report/page.tsx`)
- Employee report data → Application database: queries report inputs (evidence: `src/lib/employee-report-data.ts`)
- Employee report data → Performance rules: uses calculations (evidence: `src/lib/employee-report-data.ts`)
- Performance rules → Docket formatting: formats docket (evidence: `src/lib/employee-report.ts`)
- Media gallery → Service actions: uses gallery actions (evidence: `src/app/gallery/gallery-client.tsx`)
- Media gallery → Docket formatting: formats docket (evidence: `src/app/gallery/gallery-client.tsx`)
- Gallery and uploads → Application database: loads request metadata (evidence: `src/lib/gallery.ts`)
- Gallery and uploads → Docket formatting: formats docket (evidence: `src/lib/gallery.ts`)
- Technical manuals → Service actions: manages manuals
- Session and roles → Role constants: uses role definitions (evidence: `src/lib/auth.ts`)
