# arunachalamj2025csecs-cyber/ars-2008 architecture

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

- Interactive diagram: https://gitdiagram.com/arunachalamj2025csecs-cyber/ars-2008
- Repository: https://github.com/arunachalamj2025csecs-cyber/ars-2008

## Overview

#### Purpose and deployment

REC CampusConnect is a Google Apps Script web portal for students and administrators. It manages user profiles, complaints, complaint status/history, and campus events using Google Sheets as persistence. The deployable app consists primarily of the Apps Script backend in `Code.gs`, SPA frontend in `index.html`, and Apps Script web-app manifest in `appsscript.json`.

#### Entry points and runtime boundary

Apps Script serves the portal and exposes backend functions from `Code.gs`; `index.html` invokes them through `google.script.run` when Apps Script-hosted, or through the configured deployed web-app URL when externally hosted. `appsscript.json` defines the Apps Script runtime/deployment configuration. `setupPortal()` is the provisioning entry point that creates/upgrades required spreadsheet structure.

#### Backend API, sessions, and authorization

`Code.gs` is the system’s central application layer: it handles registration/login, session lifecycle, role-dependent student/admin operations, profile updates, Google-token verification, and validation. Authorization is enforced server-side around protected user, complaint, and event operations; the UI in `index.html` is a consumer, not the security boundary.

#### Spreadsheet-backed domain persistence

The backend persists the core model in a connected Google Sheet with `Users`, `Complaints`, and `Events` tabs. User settings and complaint timelines are JSON-bearing columns rather than separate tables. This allows complaint view records, status changes, administrator contact metadata, Google identity metadata, and activity history to remain attached to their parent records. Schema setup and backward-compatible profile-photo column additions are handled in `Code.gs`.

#### Complaint workflow and administrator visibility

Students use the dashboard, complaint list, sidebar, and profile history in `index.html` to create and inspect complaints. Administrators review, view, and update complaints through backend calls in `Code.gs`. Opening a complaint records an administrator view in its history; status updates identify the responsible administrator. Student complaint detail prefers the administrator who changed status, then exposes available email and phone contact actions.

#### Events and dashboard projections

Events are stored and managed through `Code.gs`, with administrators able to see drafts and published items. Student-facing dashboard/event views in `index.html` receive published events only. Backend ordering places recent past events before chronologically ordered upcoming events; dashboard upcoming counts account for events scheduled on the current local date.

#### Identity and external services

Password-based login supports existing users and administrators. Optional student Google sign-in uses Google Identity Services in `index.html`; `Code.gs` verifies credentials against Google’s `tokeninfo` endpoint, validates client audience and verified email, and stores identity metadata such as Google subject in user settings. OAuth client configuration is split between the frontend and the `GOOGLE_CLIENT_ID` Apps Script project property.

Profile-photo upload crosses into Google Drive: `Code.gs` stores images in the `REC CampusConnect Profile Photos` folder and saves the resulting URL in the user record. This requires Apps Script permissions for Sheets, Drive, external HTTP verification, and web-app execution.

#### Frontend portal

`index.html` is a single-page role-aware interface containing loading, login, student dashboard, complaints, event views, profiles, and administrator workflows. It owns interaction state and presentation, including read-only/editable profile transitions, while delegating persistence and privileged actions to `Code.gs`. `REC-CampusConnect-Responsive.zip` appears to be a bundled project artifact rather than a runtime component.

Main entry points: [`Code.gs`](https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/Code.gs) (Application backend), [`index.html`](https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/index.html) (SPA frontend), [`appsscript.json`](https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/appsscript.json) (Web-app manifest)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Apps Script portal"]
  node_frontend["SPA frontend<br/>HTML SPA<br/>[index.html]"]
  node_backend["Application backend<br/>Apps Script<br/>[Code.gs]"]
  node_provisioning["Schema provisioning<br/>setupPortal&#40;&#41;<br/>[Code.gs]"]
  node_manifest["Web-app manifest<br/>Apps Script config<br/>[appsscript.json]"]
  node_auth["Sessions &amp; authorization<br/>backend layer<br/>[Code.gs]"]
  node_complaints["Complaint workflow<br/>backend domain<br/>[Code.gs]"]
  node_events["Event management<br/>backend domain<br/>[Code.gs]"]
  node_profiles["Profiles &amp; photo upload<br/>backend domain<br/>[Code.gs]"]
  node_project_properties["Apps Script project properties<br/>secret configuration"]
end

subgraph group_data["Persistence"]
  node_sheet[("Connected Google Sheet<br/>spreadsheet datastore")]
  node_users_tab["Users tab<br/>sheet table"]
  node_complaints_tab["Complaints tab<br/>sheet table"]
  node_events_tab["Events tab<br/>sheet table"]
end

subgraph group_external["Google services"]
  node_google_identity{{"Google Identity &amp; tokeninfo<br/>external identity service"}}
  node_drive[("Google Drive photos folder<br/>file storage")]
end

node_manifest -->|"configures deployment"| node_backend
node_frontend -->|"invokes API"| node_backend
node_provisioning -->|"creates/upgrades schema"| node_sheet
node_backend -->|"applies"| node_auth
node_backend -->|"implements"| node_complaints
node_backend -->|"implements"| node_events
node_backend -->|"implements"| node_profiles
node_auth -->|"reads users and sessions"| node_users_tab
node_complaints -->|"persists complaints/history"| node_complaints_tab
node_events -->|"persists events"| node_events_tab
node_profiles -->|"updates profiles/settings"| node_users_tab
node_users_tab -->|"tab in"| node_sheet
node_complaints_tab -->|"tab in"| node_sheet
node_events_tab -->|"tab in"| node_sheet
node_frontend -->|"optional Google sign-in"| node_google_identity
node_backend -->|"verifies token"| node_google_identity
node_backend -->|"reads client ID"| node_project_properties
node_profiles -->|"stores profile photos"| node_drive

click node_frontend "https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/index.html"
click node_backend "https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/Code.gs"
click node_provisioning "https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/Code.gs"
click node_manifest "https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/appsscript.json"
click node_auth "https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/Code.gs"
click node_complaints "https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/Code.gs"
click node_events "https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/Code.gs"
click node_profiles "https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/Code.gs"

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_frontend,node_backend,node_provisioning,node_manifest,node_auth,node_complaints,node_events,node_profiles,node_project_properties toneBlue
class node_sheet,node_users_tab,node_complaints_tab,node_events_tab toneAmber
class node_google_identity,node_drive toneMint
```

## Components

### Apps Script portal

- [SPA frontend](https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/index.html): HTML SPA · Role-aware student and administrator portal. · `index.html`
- [Application backend](https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/Code.gs): Apps Script · Central API, authorization, validation, and domain logic. · `Code.gs`
- [Schema provisioning](https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/Code.gs): setupPortal() · Creates and upgrades spreadsheet structure. · `Code.gs`
- [Web-app manifest](https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/appsscript.json): Apps Script config · Defines runtime and deployment configuration. · `appsscript.json`
- [Sessions & authorization](https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/Code.gs): backend layer · Enforces protected operations server-side. · `Code.gs`
- [Complaint workflow](https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/Code.gs): backend domain · Creates, views, assigns status, and records administrator history. · `Code.gs`
- [Event management](https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/Code.gs): backend domain · Filters published student events and orders dashboard projections. · `Code.gs`
- [Profiles & photo upload](https://github.com/arunachalamj2025csecs-cyber/ars-2008/blob/main/Code.gs): backend domain · Updates profiles and stores profile images. · `Code.gs`
- **Apps Script project properties**: secret configuration · Stores GOOGLE_CLIENT_ID for token validation.

### Persistence

- **Connected Google Sheet**: spreadsheet datastore · Core persistence for users, complaints, and events.
- **Users tab**: sheet table · Contains profiles, settings JSON, and identity metadata.
- **Complaints tab**: sheet table · Contains complaints and JSON-backed timelines.
- **Events tab**: sheet table · Contains draft and published events.

### Google services

- **Google Identity & tokeninfo**: external identity service · Frontend obtains credentials; backend validates audience and verified email.
- **Google Drive photos folder**: file storage · REC CampusConnect Profile Photos folder.

## Connections

- Web-app manifest → Application backend: configures deployment
- SPA frontend → Application backend: invokes API · Uses google.script.run or deployed web-app URL.
- Schema provisioning → Connected Google Sheet: creates/upgrades schema
- Application backend → Sessions & authorization: applies
- Application backend → Complaint workflow: implements
- Application backend → Event management: implements
- Application backend → Profiles & photo upload: implements
- Sessions & authorization → Users tab: reads users and sessions
- Complaint workflow → Complaints tab: persists complaints/history
- Event management → Events tab: persists events
- Profiles & photo upload → Users tab: updates profiles/settings
- Users tab → Connected Google Sheet: tab in
- Complaints tab → Connected Google Sheet: tab in
- Events tab → Connected Google Sheet: tab in
- SPA frontend → Google Identity & tokeninfo: optional Google sign-in
- Application backend → Google Identity & tokeninfo: verifies token
- Application backend → Apps Script project properties: reads client ID
- Profiles & photo upload → Google Drive photos folder: stores profile photos
