# anish1302d/sp-college-approval-hub architecture

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

- Interactive diagram: https://gitdiagram.com/anish1302d/sp-college-approval-hub
- Repository: https://github.com/anish1302d/sp-college-approval-hub

## Overview

S.P. College Approval and Workflow Management System supports faculty procurement requests through committee completeness review, Principal review, and amount-based financial approval; it also manages faculty issues and college operational data. The React interface calls an Express API backed by PostgreSQL, with supporting file storage, notifications, and reporting. The README documents approval rules and retained request history. Several subsystem links below are based on the README or SOURCE INDEX references; unsampled implementations are not inferred beyond those links.

Main entry points: [`server/src/db.js`](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/db.js) (Database access and RLS), [`server/src/app.js`](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/app.js) (API route registration), [`src/App.jsx`](https://github.com/anish1302d/sp-college-approval-hub/blob/main/src/App.jsx) (Portal and page routing), [`server/src/routes/requests.js`](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/requests.js) (Request workflow API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["React interface"]
  node_app["Portal and page routing<br/>[App.jsx]"]
  node_request_ui["Request screens"]
  node_approval_ui["Review queue<br/>[ReviewQueue.jsx]"]
  node_api_client["API client<br/>[client.js]"]
  node_app_context["Session and app state<br/>[AppContext.jsx]"]
  node_api_hook["Data and action hooks<br/>[useApi.js]"]
end

subgraph group_workflow["Approval workflow"]
  node_request_api["Request workflow API<br/>[requests.js]"]
end

subgraph group_operations["College operations"]
  node_operations_api["Operational APIs"]
  node_issues["Faculty issue management<br/>[issues.js]"]
  node_inventory["Inventory management<br/>[inventory.js]"]
  node_budget["Budget provisions<br/>[budget.js]"]
  node_master["Master data management<br/>[master.js]"]
  node_admin["User administration<br/>[admin.js]"]
end

subgraph group_platform["API platform"]
  node_auth_api["Authentication API<br/>[auth.js]"]
  node_api_app["API route registration<br/>[app.js]"]
  node_auth["Token and role checks<br/>[auth.js]"]
  node_db["Database access and RLS<br/>[db.js]"]
  node_postgres[("PostgreSQL")]
end

subgraph group_support["Supporting services"]
  node_reports_api["Reports API<br/>[reports.js]"]
  node_storage["Attachment storage<br/>[storage.js]"]
  node_mailer["Email notifications<br/>[mailer.js]"]
  node_reporting["Report generation<br/>[reporting.js]"]
  node_pdf_report["PDF report rendering<br/>[pdfReport.js]"]
end

node_faculty(("Faculty and approvers"))

node_faculty -->|"uses portal"| node_app
node_app -->|"uses state"| node_app_context
node_app -.->|"routes requests"| node_request_ui
node_app -->|"routes reviews"| node_approval_ui
node_request_ui -->|"submits requests"| node_api_client
node_approval_ui -->|"loads queue"| node_api_hook
node_api_hook -->|"calls API"| node_api_client
node_app_context -->|"restores session"| node_api_client
node_api_client -->|"sends API requests"| node_api_app
node_api_app -->|"registers routes"| node_auth_api
node_api_app -->|"registers routes"| node_request_api
node_api_app -->|"registers routes"| node_reports_api
node_api_app -->|"registers routes"| node_operations_api
node_auth_api -->|"issues tokens"| node_auth
node_auth_api -->|"queries accounts"| node_db
node_request_api -->|"reads and writes workflow"| node_db
node_request_api -->|"sends notifications"| node_mailer
node_request_api -->|"handles attachments"| node_storage
node_operations_api -.->|"uses database"| node_db
node_reports_api -->|"queries report data"| node_db
node_reports_api -->|"builds reports"| node_reporting
node_reports_api -->|"renders PDFs"| node_pdf_report
node_issues -.->|"uses database"| node_db
node_inventory -.->|"uses database"| node_db
node_budget -->|"queries budget"| node_db
node_master -.->|"uses database"| node_db
node_admin -->|"queries accounts"| node_db
node_db -->|"queries"| node_postgres
node_storage -.->|"stores attachment metadata"| node_postgres

click node_app "https://github.com/anish1302d/sp-college-approval-hub/blob/main/src/App.jsx"
click node_request_ui "https://github.com/anish1302d/sp-college-approval-hub/blob/main/src/components/modals/NewRequestModal.jsx"
click node_approval_ui "https://github.com/anish1302d/sp-college-approval-hub/blob/main/src/pages/ReviewQueue.jsx"
click node_api_client "https://github.com/anish1302d/sp-college-approval-hub/blob/main/src/api/client.js"
click node_app_context "https://github.com/anish1302d/sp-college-approval-hub/blob/main/src/context/AppContext.jsx"
click node_api_hook "https://github.com/anish1302d/sp-college-approval-hub/blob/main/src/hooks/useApi.js"
click node_request_api "https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/requests.js"
click node_auth_api "https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/auth.js"
click node_reports_api "https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/reports.js"
click node_operations_api "https://github.com/anish1302d/sp-college-approval-hub/tree/main/server/src/routes"
click node_api_app "https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/app.js"
click node_auth "https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/auth.js"
click node_db "https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/db.js"
click node_storage "https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/storage.js"
click node_mailer "https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/mailer.js"
click node_reporting "https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/reporting.js"
click node_pdf_report "https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/pdfReport.js"
click node_issues "https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/issues.js"
click node_inventory "https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/inventory.js"
click node_budget "https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/budget.js"
click node_master "https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/master.js"
click node_admin "https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/admin.js"

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_app,node_request_ui,node_approval_ui,node_api_client,node_app_context,node_api_hook toneBlue
class node_request_api toneAmber
class node_operations_api,node_issues,node_inventory,node_budget,node_master,node_admin toneMint
class node_auth_api,node_api_app,node_auth,node_db,node_postgres toneRose
class node_reports_api,node_storage,node_mailer,node_reporting,node_pdf_report,node_faculty toneIndigo
```

## Components

### React interface

- [Portal and page routing](https://github.com/anish1302d/sp-college-approval-hub/blob/main/src/App.jsx): `src/App.jsx`
- [Request screens](https://github.com/anish1302d/sp-college-approval-hub/blob/main/src/components/modals/NewRequestModal.jsx): `src/components/modals/NewRequestModal.jsx`
- [Review queue](https://github.com/anish1302d/sp-college-approval-hub/blob/main/src/pages/ReviewQueue.jsx): `src/pages/ReviewQueue.jsx`
- [API client](https://github.com/anish1302d/sp-college-approval-hub/blob/main/src/api/client.js): `src/api/client.js`
- [Session and app state](https://github.com/anish1302d/sp-college-approval-hub/blob/main/src/context/AppContext.jsx): `src/context/AppContext.jsx`
- [Data and action hooks](https://github.com/anish1302d/sp-college-approval-hub/blob/main/src/hooks/useApi.js): `src/hooks/useApi.js`

### Approval workflow

- [Request workflow API](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/requests.js): `server/src/routes/requests.js`

### College operations

- [Operational APIs](https://github.com/anish1302d/sp-college-approval-hub/tree/main/server/src/routes): `server/src/routes`
- [Faculty issue management](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/issues.js): `server/src/routes/issues.js`
- [Inventory management](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/inventory.js): `server/src/routes/inventory.js`
- [Budget provisions](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/budget.js): `server/src/routes/budget.js`
- [Master data management](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/master.js): `server/src/routes/master.js`
- [User administration](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/admin.js): `server/src/routes/admin.js`

### API platform

- [Authentication API](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/auth.js): `server/src/routes/auth.js`
- [API route registration](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/app.js): `server/src/app.js`
- [Token and role checks](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/auth.js): `server/src/auth.js`
- [Database access and RLS](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/db.js): `server/src/db.js`
- **PostgreSQL**

### Supporting services

- [Reports API](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/routes/reports.js): `server/src/routes/reports.js`
- [Attachment storage](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/storage.js): `server/src/storage.js`
- [Email notifications](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/mailer.js): `server/src/mailer.js`
- [Report generation](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/reporting.js): `server/src/reporting.js`
- [PDF report rendering](https://github.com/anish1302d/sp-college-approval-hub/blob/main/server/src/pdfReport.js): `server/src/pdfReport.js`

### Other components

- **Faculty and approvers**

## Connections

- Faculty and approvers → Portal and page routing: uses portal
- Portal and page routing → Session and app state: uses state (evidence: `src/App.jsx`)
- Portal and page routing → Request screens: routes requests
- Portal and page routing → Review queue: routes reviews (evidence: `src/App.jsx`)
- Request screens → API client: submits requests (evidence: `src/components/modals/NewRequestModal.jsx`)
- Review queue → Data and action hooks: loads queue (evidence: `src/pages/ReviewQueue.jsx`)
- Data and action hooks → API client: calls API (evidence: `src/hooks/useApi.js`)
- Session and app state → API client: restores session (evidence: `src/context/AppContext.jsx`)
- API client → API route registration: sends API requests
- API route registration → Authentication API: registers routes (evidence: `server/src/app.js`)
- API route registration → Request workflow API: registers routes (evidence: `server/src/app.js`)
- API route registration → Reports API: registers routes (evidence: `server/src/app.js`)
- API route registration → Operational APIs: registers routes (evidence: `server/src/app.js`)
- Authentication API → Token and role checks: issues tokens (evidence: `server/src/routes/auth.js`)
- Authentication API → Database access and RLS: queries accounts (evidence: `server/src/routes/auth.js`)
- Request workflow API → Database access and RLS: reads and writes workflow (evidence: `server/src/routes/requests.js`)
- Request workflow API → Email notifications: sends notifications (evidence: `server/src/routes/requests.js`)
- Request workflow API → Attachment storage: handles attachments (evidence: `server/src/routes/requests.js`)
- Operational APIs → Database access and RLS: uses database (evidence: `server/src/routes/auth.js`)
- Reports API → Database access and RLS: queries report data (evidence: `server/src/routes/reports.js`)
- Reports API → Report generation: builds reports (evidence: `server/src/routes/reports.js`)
- Reports API → PDF report rendering: renders PDFs (evidence: `server/src/routes/reports.js`)
- Faculty issue management → Database access and RLS: uses database
- Inventory management → Database access and RLS: uses database
- Budget provisions → Database access and RLS: queries budget (evidence: `server/src/routes/budget.js`)
- Master data management → Database access and RLS: uses database
- User administration → Database access and RLS: queries accounts (evidence: `server/src/routes/admin.js`)
- Database access and RLS → PostgreSQL: queries (evidence: `server/src/db.js`)
- Attachment storage → PostgreSQL: stores attachment metadata
