# deejsxyz/cup-portal architecture

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

- Interactive diagram: https://gitdiagram.com/deejsxyz/cup-portal
- Repository: https://github.com/deejsxyz/cup-portal

## Overview

CUP Central Portal serves role-specific university portals and handles their application, account, registrar, faculty, and NSTP workflows. Users enter through the portal pages; the Node server serves those pages and provides API routes, with PostgreSQL as the documented shared database. The registrar and faculty excerpts show enrollment/advising and grade-management stages. Shared browser scripts support navigation, sessions, search, and printed grade documents. The server is very large and only excerpts were provided, so unshown route-to-page links and domain-specific API details are omitted rather than inferred.

Main entry points: [`server.js`](https://github.com/deejsxyz/cup-portal/blob/main/server.js) (HTTP and API server), [`CUP-PORTAL`](https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL) (Role portals), [`CUP-PORTAL/registrar`](https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/registrar) (Registrar portals), [`CUP-PORTAL/portal-session.js`](https://github.com/deejsxyz/cup-portal/blob/main/CUP-PORTAL/portal-session.js) (Session controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portal["Portal experience"]
  node_portal_pages["Role portals"]
  node_student_pages["Student portal"]
  node_faculty_pages["Faculty portal"]
  node_registrar_pages["Registrar portals"]
  node_college_registrar_pages["College registrar"]
  node_csc_pages["CSC portal"]
  node_department_pages["Department head"]
  node_graduate_pages["Graduate studies"]
  node_nstp_pages["NSTP portal"]
  node_staff_pages["Staff portal"]
end

subgraph group_server["Application services"]
  node_server["HTTP and API server<br/>[server.js]"]
  node_redirect["Case redirects<br/>[case-redirect.js]"]
end

subgraph group_records["Academic records"]
  node_database[("Shared PostgreSQL<br/>[schema.sql]")]
  node_r2[("Photo object storage<br/>[r2.js]")]
end

subgraph group_shared["Shared browser features"]
  node_session["Session controls<br/>[portal-session.js]"]
  node_menu["Responsive navigation<br/>[portal-menu.js]"]
  node_search["Search input behavior<br/>[portal-search.js]"]
  node_grade_doc["Grade document builder<br/>[copy-doc.js]"]
end

node_users(("Portal users"))

node_users -->|"use portals"| node_portal_pages
node_portal_pages -.->|"request pages"| node_server
node_student_pages -.->|"request services"| node_server
node_faculty_pages -.->|"request services"| node_server
node_registrar_pages -.->|"request services"| node_server
node_college_registrar_pages -.->|"request services"| node_server
node_csc_pages -.->|"request services"| node_server
node_department_pages -.->|"request services"| node_server
node_graduate_pages -.->|"request services"| node_server
node_nstp_pages -.->|"request services"| node_server
node_staff_pages -.->|"request services"| node_server
node_server -->|"serves static files"| node_portal_pages
node_server -->|"queries records"| node_database
node_server -->|"registers middleware"| node_redirect
node_server -.->|"uses storage"| node_r2
node_faculty_pages -.->|"uses session helper"| node_session
node_registrar_pages -.->|"uses session helper"| node_session
node_nstp_pages -.->|"uses session helper"| node_session
node_portal_pages -.->|"uses navigation helper"| node_menu
node_portal_pages -.->|"uses search helper"| node_search
node_student_pages -.->|"builds grade copy"| node_grade_doc
node_registrar_pages -.->|"builds grade document"| node_grade_doc

click node_portal_pages "https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL"
click node_student_pages "https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/student"
click node_faculty_pages "https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/faculty"
click node_registrar_pages "https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/registrar"
click node_college_registrar_pages "https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/college-registrar"
click node_csc_pages "https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/csc"
click node_department_pages "https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/department-head"
click node_graduate_pages "https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/graduate-studies"
click node_nstp_pages "https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/nstp"
click node_staff_pages "https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/staff"
click node_server "https://github.com/deejsxyz/cup-portal/blob/main/server.js"
click node_redirect "https://github.com/deejsxyz/cup-portal/blob/main/case-redirect.js"
click node_database "https://github.com/deejsxyz/cup-portal/blob/main/schema.sql"
click node_r2 "https://github.com/deejsxyz/cup-portal/blob/main/r2.js"
click node_session "https://github.com/deejsxyz/cup-portal/blob/main/CUP-PORTAL/portal-session.js"
click node_menu "https://github.com/deejsxyz/cup-portal/blob/main/CUP-PORTAL/portal-menu.js"
click node_search "https://github.com/deejsxyz/cup-portal/blob/main/CUP-PORTAL/portal-search.js"
click node_grade_doc "https://github.com/deejsxyz/cup-portal/blob/main/CUP-PORTAL/shared/copy-doc.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_portal_pages,node_student_pages,node_faculty_pages,node_registrar_pages,node_college_registrar_pages,node_csc_pages,node_department_pages,node_graduate_pages,node_nstp_pages,node_staff_pages,node_users toneBlue
class node_server,node_redirect toneAmber
class node_database,node_r2 toneMint
class node_session,node_menu,node_search,node_grade_doc toneRose
```

## Components

### Portal experience

- [Role portals](https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL): `CUP-PORTAL`
- [Student portal](https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/student): `CUP-PORTAL/student`
- [Faculty portal](https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/faculty): `CUP-PORTAL/faculty`
- [Registrar portals](https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/registrar): `CUP-PORTAL/registrar`
- [College registrar](https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/college-registrar): `CUP-PORTAL/college-registrar`
- [CSC portal](https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/csc): `CUP-PORTAL/csc`
- [Department head](https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/department-head): `CUP-PORTAL/department-head`
- [Graduate studies](https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/graduate-studies): `CUP-PORTAL/graduate-studies`
- [NSTP portal](https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/nstp): `CUP-PORTAL/nstp`
- [Staff portal](https://github.com/deejsxyz/cup-portal/tree/main/CUP-PORTAL/staff): `CUP-PORTAL/staff`

### Application services

- [HTTP and API server](https://github.com/deejsxyz/cup-portal/blob/main/server.js): `server.js`
- [Case redirects](https://github.com/deejsxyz/cup-portal/blob/main/case-redirect.js): `case-redirect.js`

### Academic records

- [Shared PostgreSQL](https://github.com/deejsxyz/cup-portal/blob/main/schema.sql): `schema.sql`
- [Photo object storage](https://github.com/deejsxyz/cup-portal/blob/main/r2.js): `r2.js`

### Shared browser features

- [Session controls](https://github.com/deejsxyz/cup-portal/blob/main/CUP-PORTAL/portal-session.js): `CUP-PORTAL/portal-session.js`
- [Responsive navigation](https://github.com/deejsxyz/cup-portal/blob/main/CUP-PORTAL/portal-menu.js): `CUP-PORTAL/portal-menu.js`
- [Search input behavior](https://github.com/deejsxyz/cup-portal/blob/main/CUP-PORTAL/portal-search.js): `CUP-PORTAL/portal-search.js`
- [Grade document builder](https://github.com/deejsxyz/cup-portal/blob/main/CUP-PORTAL/shared/copy-doc.js): `CUP-PORTAL/shared/copy-doc.js`

### Other components

- **Portal users**

## Connections

- Portal users → Role portals: use portals (evidence: `README.md`)
- Role portals → HTTP and API server: request pages
- Student portal → HTTP and API server: request services
- Faculty portal → HTTP and API server: request services
- Registrar portals → HTTP and API server: request services
- College registrar → HTTP and API server: request services
- CSC portal → HTTP and API server: request services
- Department head → HTTP and API server: request services
- Graduate studies → HTTP and API server: request services
- NSTP portal → HTTP and API server: request services
- Staff portal → HTTP and API server: request services
- HTTP and API server → Role portals: serves static files (evidence: `server.js`)
- HTTP and API server → Shared PostgreSQL: queries records (evidence: `server.js`)
- HTTP and API server → Case redirects: registers middleware (evidence: `server.js`)
- HTTP and API server → Photo object storage: uses storage (evidence: `server.js`)
- Faculty portal → Session controls: uses session helper
- Registrar portals → Session controls: uses session helper
- NSTP portal → Session controls: uses session helper
- Role portals → Responsive navigation: uses navigation helper
- Role portals → Search input behavior: uses search helper
- Student portal → Grade document builder: builds grade copy
- Registrar portals → Grade document builder: builds grade document
