# eshanpt/unihub architecture

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

- Interactive diagram: https://gitdiagram.com/eshanpt/unihub
- Repository: https://github.com/eshanpt/unihub

## Overview

UniHub is a public, read-only class information portal with an allowlisted Google-authenticated admin panel. Students browse a dashboard and dedicated deadline, timetable, reminder, and announcement views; administrators manage those shared collections and can import legacy data. Shared class data is loaded and refreshed through Supabase, while database Row Level Security enforces access. The graph follows documented capabilities and visible routing, provider, and data-layer references; several page and integration details are unsampled, so their individual call paths are not asserted.

Main entry points: [`src/store/ClassDataContext.jsx`](https://github.com/eshanpt/unihub/blob/main/src/store/ClassDataContext.jsx) (Collection data and mutations), [`src/App.jsx`](https://github.com/eshanpt/unihub/blob/main/src/App.jsx) (Routes and shell), [`src/components/auth/AdminGuard.jsx`](https://github.com/eshanpt/unihub/blob/main/src/components/auth/AdminGuard.jsx) (Admin access guard), [`src/lib/selectors.js`](https://github.com/eshanpt/unihub/blob/main/src/lib/selectors.js) (Domain selectors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portal["Student portal"]
  node_dashboard["Class dashboard<br/>[Dashboard.jsx]"]
  node_deadlines["Deadline views<br/>[Deadlines.jsx]"]
  node_timetable["Weekly timetable<br/>[Timetable.jsx]"]
  node_reminders["Class reminders<br/>[Reminders.jsx]"]
  node_announcements["Published notices<br/>[Announcements.jsx]"]
  node_settings["Preferences<br/>[Settings.jsx]"]
end

subgraph group_admin["Administration"]
  node_admin_login["Google sign-in<br/>[AdminLogin.jsx]"]
  node_admin_guard["Admin access guard<br/>[AdminGuard.jsx]"]
  node_admin_overview["Admin overview<br/>[AdminOverview.jsx]"]
  node_admin_deadlines["Manage deadlines<br/>[AdminDeadlines.jsx]"]
  node_admin_timetable["Manage timetable<br/>[AdminTimetable.jsx]"]
  node_admin_reminders["Manage reminders<br/>[AdminReminders.jsx]"]
  node_admin_announcements["Manage notices"]
  node_admin_data["Legacy data import<br/>[AdminData.jsx]"]
end

subgraph group_data["Shared data"]
  node_class_data["Collection data and mutations"]
  node_mappers["Record mapping<br/>[mappers.js]"]
  node_selectors["Domain selectors<br/>[selectors.js]"]
  node_supabase_client["Supabase client<br/>[supabase.js]"]
end

subgraph group_platform["App services"]
  node_app["Routes and shell<br/>[App.jsx]"]
  node_auth["Auth state<br/>[AuthContext.jsx]"]
  node_notifications["Browser notifications"]
  node_pwa["PWA state<br/>[PwaContext.jsx]"]
  node_theme["Theme preferences<br/>[ThemeContext.jsx]"]
end

node_students(("Students"))
node_admin_actor(("Administrator"))
node_supabase_db[("Supabase database")]
node_legacy_storage[("Legacy browser data")]

node_students -->|"browse"| node_app
node_admin_actor -->|"open admin"| node_app
node_app -->|"routes"| node_dashboard
node_app -->|"routes"| node_deadlines
node_app -->|"routes"| node_timetable
node_app -->|"routes"| node_reminders
node_app -->|"routes"| node_announcements
node_app -->|"routes"| node_settings
node_app -->|"routes"| node_admin_login
node_app -->|"guards route"| node_admin_guard
node_admin_guard -->|"protects"| node_admin_overview
node_admin_guard -->|"protects"| node_admin_deadlines
node_admin_guard -->|"protects"| node_admin_timetable
node_admin_guard -->|"protects"| node_admin_reminders
node_admin_guard -->|"protects"| node_admin_announcements
node_admin_guard -->|"protects"| node_admin_data
node_admin_login -.->|"signs in"| node_auth
node_admin_guard -.->|"checks access"| node_auth
node_auth -->|"uses"| node_supabase_client
node_class_data -->|"reads session"| node_auth
node_class_data -->|"queries and mutates"| node_supabase_client
node_supabase_client -.->|"connects"| node_supabase_db
node_class_data -->|"maps records"| node_mappers
node_class_data -->|"loads and refreshes"| node_supabase_db
node_class_data -->|"writes collections"| node_supabase_db
node_dashboard -->|"reads shared data"| node_class_data
node_timetable -->|"reads classes"| node_class_data
node_admin_deadlines -->|"manages records"| node_class_data
node_admin_timetable -->|"manages classes"| node_class_data
node_deadlines -.->|"reads deadlines"| node_class_data
node_reminders -.->|"reads reminders"| node_class_data
node_announcements -.->|"reads notices"| node_class_data
node_admin_reminders -.->|"manages reminders"| node_class_data
node_admin_announcements -.->|"manages notices"| node_class_data
node_admin_overview -.->|"summarizes data"| node_class_data
node_deadlines -.->|"sorts dates"| node_selectors
node_dashboard -->|"selects highlights"| node_selectors
node_timetable -->|"groups days"| node_selectors
node_admin_deadlines -->|"splits dates"| node_selectors
node_admin_timetable -->|"groups days"| node_selectors
node_app -->|"checks reminders"| node_notifications
node_notifications -.->|"uses shared reminders"| node_supabase_db
node_settings -->|"offers install"| node_pwa
node_settings -->|"changes preference"| node_theme
node_app -->|"provides app state"| node_pwa
node_admin_data -->|"imports prototype data"| node_legacy_storage
node_admin_data -->|"imports validated records"| node_supabase_db

click node_app "https://github.com/eshanpt/unihub/blob/main/src/App.jsx"
click node_dashboard "https://github.com/eshanpt/unihub/blob/main/src/pages/Dashboard.jsx"
click node_deadlines "https://github.com/eshanpt/unihub/blob/main/src/pages/Deadlines.jsx"
click node_timetable "https://github.com/eshanpt/unihub/blob/main/src/pages/Timetable.jsx"
click node_reminders "https://github.com/eshanpt/unihub/blob/main/src/pages/Reminders.jsx"
click node_announcements "https://github.com/eshanpt/unihub/blob/main/src/pages/Announcements.jsx"
click node_settings "https://github.com/eshanpt/unihub/blob/main/src/pages/Settings.jsx"
click node_admin_login "https://github.com/eshanpt/unihub/blob/main/src/pages/admin/AdminLogin.jsx"
click node_admin_guard "https://github.com/eshanpt/unihub/blob/main/src/components/auth/AdminGuard.jsx"
click node_admin_overview "https://github.com/eshanpt/unihub/blob/main/src/pages/admin/AdminOverview.jsx"
click node_admin_deadlines "https://github.com/eshanpt/unihub/blob/main/src/pages/admin/AdminDeadlines.jsx"
click node_admin_timetable "https://github.com/eshanpt/unihub/blob/main/src/pages/admin/AdminTimetable.jsx"
click node_admin_reminders "https://github.com/eshanpt/unihub/blob/main/src/pages/admin/AdminReminders.jsx"
click node_admin_announcements "https://github.com/eshanpt/unihub/blob/main/src/pages/admin/AdminAnnouncements.jsx"
click node_admin_data "https://github.com/eshanpt/unihub/blob/main/src/pages/admin/AdminData.jsx"
click node_auth "https://github.com/eshanpt/unihub/blob/main/src/store/AuthContext.jsx"
click node_class_data "https://github.com/eshanpt/unihub/blob/main/src/store/ClassDataContext.jsx"
click node_mappers "https://github.com/eshanpt/unihub/blob/main/src/lib/mappers.js"
click node_selectors "https://github.com/eshanpt/unihub/blob/main/src/lib/selectors.js"
click node_supabase_client "https://github.com/eshanpt/unihub/blob/main/src/lib/supabase.js"
click node_notifications "https://github.com/eshanpt/unihub/blob/main/src/hooks/useNotifications.js"
click node_pwa "https://github.com/eshanpt/unihub/blob/main/src/store/PwaContext.jsx"
click node_theme "https://github.com/eshanpt/unihub/blob/main/src/store/ThemeContext.jsx"

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_dashboard,node_deadlines,node_timetable,node_reminders,node_announcements,node_settings toneBlue
class node_admin_login,node_admin_guard,node_admin_overview,node_admin_deadlines,node_admin_timetable,node_admin_reminders,node_admin_announcements,node_admin_data,node_supabase_db,node_legacy_storage toneAmber
class node_class_data,node_mappers,node_selectors,node_supabase_client toneMint
class node_app,node_auth,node_notifications,node_pwa,node_theme toneRose
class node_students,node_admin_actor toneIndigo
```

## Components

### Student portal

- [Class dashboard](https://github.com/eshanpt/unihub/blob/main/src/pages/Dashboard.jsx): `src/pages/Dashboard.jsx`
- [Deadline views](https://github.com/eshanpt/unihub/blob/main/src/pages/Deadlines.jsx): `src/pages/Deadlines.jsx`
- [Weekly timetable](https://github.com/eshanpt/unihub/blob/main/src/pages/Timetable.jsx): `src/pages/Timetable.jsx`
- [Class reminders](https://github.com/eshanpt/unihub/blob/main/src/pages/Reminders.jsx): `src/pages/Reminders.jsx`
- [Published notices](https://github.com/eshanpt/unihub/blob/main/src/pages/Announcements.jsx): `src/pages/Announcements.jsx`
- [Preferences](https://github.com/eshanpt/unihub/blob/main/src/pages/Settings.jsx): `src/pages/Settings.jsx`

### Administration

- [Google sign-in](https://github.com/eshanpt/unihub/blob/main/src/pages/admin/AdminLogin.jsx): `src/pages/admin/AdminLogin.jsx`
- [Admin access guard](https://github.com/eshanpt/unihub/blob/main/src/components/auth/AdminGuard.jsx): `src/components/auth/AdminGuard.jsx`
- [Admin overview](https://github.com/eshanpt/unihub/blob/main/src/pages/admin/AdminOverview.jsx): `src/pages/admin/AdminOverview.jsx`
- [Manage deadlines](https://github.com/eshanpt/unihub/blob/main/src/pages/admin/AdminDeadlines.jsx): `src/pages/admin/AdminDeadlines.jsx`
- [Manage timetable](https://github.com/eshanpt/unihub/blob/main/src/pages/admin/AdminTimetable.jsx): `src/pages/admin/AdminTimetable.jsx`
- [Manage reminders](https://github.com/eshanpt/unihub/blob/main/src/pages/admin/AdminReminders.jsx): `src/pages/admin/AdminReminders.jsx`
- [Manage notices](https://github.com/eshanpt/unihub/blob/main/src/pages/admin/AdminAnnouncements.jsx): `src/pages/admin/AdminAnnouncements.jsx`
- [Legacy data import](https://github.com/eshanpt/unihub/blob/main/src/pages/admin/AdminData.jsx): `src/pages/admin/AdminData.jsx`

### Shared data

- [Collection data and mutations](https://github.com/eshanpt/unihub/blob/main/src/store/ClassDataContext.jsx): `src/store/ClassDataContext.jsx`
- [Record mapping](https://github.com/eshanpt/unihub/blob/main/src/lib/mappers.js): `src/lib/mappers.js`
- [Domain selectors](https://github.com/eshanpt/unihub/blob/main/src/lib/selectors.js): `src/lib/selectors.js`
- [Supabase client](https://github.com/eshanpt/unihub/blob/main/src/lib/supabase.js): `src/lib/supabase.js`

### App services

- [Routes and shell](https://github.com/eshanpt/unihub/blob/main/src/App.jsx): `src/App.jsx`
- [Auth state](https://github.com/eshanpt/unihub/blob/main/src/store/AuthContext.jsx): `src/store/AuthContext.jsx`
- [Browser notifications](https://github.com/eshanpt/unihub/blob/main/src/hooks/useNotifications.js): `src/hooks/useNotifications.js`
- [PWA state](https://github.com/eshanpt/unihub/blob/main/src/store/PwaContext.jsx): `src/store/PwaContext.jsx`
- [Theme preferences](https://github.com/eshanpt/unihub/blob/main/src/store/ThemeContext.jsx): `src/store/ThemeContext.jsx`

### Other components

- **Students**
- **Administrator**
- **Supabase database**
- **Legacy browser data**

## Connections

- Students → Routes and shell: browse (evidence: `src/App.jsx`)
- Administrator → Routes and shell: open admin (evidence: `src/App.jsx`)
- Routes and shell → Class dashboard: routes (evidence: `src/App.jsx`)
- Routes and shell → Deadline views: routes (evidence: `src/App.jsx`)
- Routes and shell → Weekly timetable: routes (evidence: `src/App.jsx`)
- Routes and shell → Class reminders: routes (evidence: `src/App.jsx`)
- Routes and shell → Published notices: routes (evidence: `src/App.jsx`)
- Routes and shell → Preferences: routes (evidence: `src/App.jsx`)
- Routes and shell → Google sign-in: routes (evidence: `src/App.jsx`)
- Routes and shell → Admin access guard: guards route (evidence: `src/App.jsx`)
- Admin access guard → Admin overview: protects (evidence: `src/App.jsx`)
- Admin access guard → Manage deadlines: protects (evidence: `src/App.jsx`)
- Admin access guard → Manage timetable: protects (evidence: `src/App.jsx`)
- Admin access guard → Manage reminders: protects (evidence: `src/App.jsx`)
- Admin access guard → Manage notices: protects (evidence: `src/App.jsx`)
- Admin access guard → Legacy data import: protects (evidence: `src/App.jsx`)
- Google sign-in → Auth state: signs in
- Admin access guard → Auth state: checks access
- Auth state → Supabase client: uses (evidence: `src/store/AuthContext.jsx`)
- Collection data and mutations → Auth state: reads session (evidence: `src/store/ClassDataContext.jsx`)
- Collection data and mutations → Supabase client: queries and mutates (evidence: `src/store/ClassDataContext.jsx`)
- Supabase client → Supabase database: connects
- Collection data and mutations → Record mapping: maps records (evidence: `src/store/ClassDataContext.jsx`)
- Collection data and mutations → Supabase database: loads and refreshes (evidence: `README.md`)
- Collection data and mutations → Supabase database: writes collections (evidence: `README.md`)
- Class dashboard → Collection data and mutations: reads shared data (evidence: `src/pages/Dashboard.jsx`)
- Weekly timetable → Collection data and mutations: reads classes (evidence: `src/pages/Timetable.jsx`)
- Manage deadlines → Collection data and mutations: manages records (evidence: `src/pages/admin/AdminDeadlines.jsx`)
- Manage timetable → Collection data and mutations: manages classes (evidence: `src/pages/admin/AdminTimetable.jsx`)
- Deadline views → Collection data and mutations: reads deadlines
- Class reminders → Collection data and mutations: reads reminders
- Published notices → Collection data and mutations: reads notices
- Manage reminders → Collection data and mutations: manages reminders
- Manage notices → Collection data and mutations: manages notices
- Admin overview → Collection data and mutations: summarizes data
- Deadline views → Domain selectors: sorts dates
- Class dashboard → Domain selectors: selects highlights (evidence: `src/pages/Dashboard.jsx`)
- Weekly timetable → Domain selectors: groups days (evidence: `src/pages/Timetable.jsx`)
- Manage deadlines → Domain selectors: splits dates (evidence: `src/pages/admin/AdminDeadlines.jsx`)
- Manage timetable → Domain selectors: groups days (evidence: `src/pages/admin/AdminTimetable.jsx`)
- Routes and shell → Browser notifications: checks reminders (evidence: `src/App.jsx`)
- Browser notifications → Supabase database: uses shared reminders
- Preferences → PWA state: offers install (evidence: `src/pages/Settings.jsx`)
- Preferences → Theme preferences: changes preference (evidence: `src/pages/Settings.jsx`)
- Routes and shell → PWA state: provides app state (evidence: `src/main.jsx`)
- Legacy data import → Legacy browser data: imports prototype data (evidence: `README.md`)
- Legacy data import → Supabase database: imports validated records (evidence: `README.md`)
