# danielkinny/mun-hub architecture

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

- Interactive diagram: https://gitdiagram.com/danielkinny/mun-hub
- Repository: https://github.com/danielkinny/mun-hub

## Overview

MUN Hub centralizes conference information and delegate work: users sign in, enter role-protected pages, and access committee information, speeches, resolutions, announcements, and updates. Chairs also manage delegate resolution permissions; delegates can create and organize speeches and work with resolutions in a rich-text editor. The API routes provide data access, with several explicitly using Supabase. The graph preserves README capabilities such as schedules, document access, and emergency information where the tree identifies no implementing page. Some links are omitted because their callers were not shown.

Main entry points: [`lib/supabase.ts`](https://github.com/danielkinny/mun-hub/blob/main/lib/supabase.ts) (Supabase client), [`app/resolutions/page.tsx`](https://github.com/danielkinny/mun-hub/blob/main/app/resolutions/page.tsx) (Resolutions), [`components/protectedroute.tsx`](https://github.com/danielkinny/mun-hub/blob/main/components/protectedroute.tsx) (Role guards), [`app/speechrepo/page.tsx`](https://github.com/danielkinny/mun-hub/blob/main/app/speechrepo/page.tsx) (Speech repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Identity and access"]
  node_login["Sign in<br/>[page.tsx]"]
  node_session["User session<br/>[sessionContext.tsx]"]
  node_routeguard["Role guards<br/>[protectedroute.tsx]"]
  node_admin["Admin tools<br/>[page.tsx]"]
  node_chair["Chair permissions<br/>[page.tsx]"]
end

subgraph group_conference["Conference information"]
  node_home["Conference home<br/>[page.tsx]"]
  node_committee["Committee overview<br/>[page.tsx]"]
  node_schedule["Conference schedule<br/>[page.tsx]"]
  node_announcements["Announcements<br/>[route.ts]"]
  node_updates["Live updates<br/>[page.tsx]"]
  node_updateapi["Updates endpoint<br/>[route.ts]"]
  node_glossary["MUN glossary<br/>[page.tsx]"]
  node_documents["Document repository"]
  node_emergency["Emergency information"]
  node_social["Social media"]
end

subgraph group_work["Delegate workspaces"]
  node_speechpage["Speech repository<br/>[page.tsx]"]
  node_speechhooks["Speech workflow hooks<br/>[use-speech-api.ts]"]
  node_speechchair["Chair speech API<br/>[route.ts]"]
  node_speechdelegate["Delegate speech API<br/>[route.ts]"]
  node_resolutionpage["Resolutions<br/>[page.tsx]"]
  node_editor["Rich text editor<br/>[simple-editor.tsx]"]
  node_resochair["Chair resolution API<br/>[route.ts]"]
  node_resodelegate["Delegate resolution API<br/>[route.ts]"]
  node_chairdelegates["Delegate management<br/>[page.tsx]"]
end

subgraph group_services["Data services"]
  node_delegateapi["Delegate API<br/>[route.ts]"]
  node_supabase["Supabase client<br/>[supabase.ts]"]
  node_adminsupabase["Admin Supabase client<br/>[supabaseAdmin.ts]"]
  node_upload["Image upload API<br/>[route.ts]"]
  node_articles["Articles API<br/>[route.ts]"]
  node_committeesapi["Committees API<br/>[route.ts]"]
  node_countriesapi["Countries API<br/>[route.ts]"]
  node_countries["Country lookup hook<br/>[use-countries.ts]"]
end

node_visitor(("Conference user"))
node_store[("Supabase data store")]

node_visitor -->|"signs in"| node_login
node_login -->|"sets session"| node_session
node_session -->|"provides identity"| node_routeguard
node_chairdelegates -->|"fetches and updates"| node_delegateapi
node_delegateapi -->|"queries"| node_supabase
node_resolutionpage -->|"uses participant guard"| node_routeguard
node_resolutionpage -->|"uses editor"| node_editor
node_resolutionpage -->|"fetches delegate data"| node_resodelegate
node_resolutionpage -->|"fetches chair data"| node_resochair
node_resodelegate -->|"queries"| node_supabase
node_speechpage -->|"uses workflow hook"| node_speechhooks
node_speechpage -->|"uses participant guard"| node_routeguard
node_speechchair -->|"queries"| node_supabase
node_speechdelegate -->|"queries"| node_supabase
node_announcements -->|"queries"| node_supabase
node_updateapi -->|"queries"| node_supabase
node_committeesapi -->|"queries"| node_supabase
node_countriesapi -->|"queries"| node_supabase
node_upload -->|"uses client"| node_adminsupabase
node_supabase -.->|"accesses"| node_store
node_adminsupabase -.->|"accesses"| node_store
node_visitor -->|"views conference"| node_home
node_visitor -->|"views committees"| node_committee
node_visitor -->|"views schedule"| node_schedule
node_visitor -->|"receives news"| node_announcements
node_visitor -.->|"views updates"| node_updates
node_visitor -.->|"looks up terms"| node_glossary
node_visitor -->|"accesses documents"| node_documents
node_visitor -->|"accesses guidance"| node_emergency
node_visitor -->|"shares updates"| node_social
node_countries -.->|"loads countries"| node_countriesapi
node_visitor -.->|"requests articles"| node_articles

click node_login "https://github.com/danielkinny/mun-hub/blob/main/app/login/page.tsx"
click node_session "https://github.com/danielkinny/mun-hub/blob/main/app/context/sessionContext.tsx"
click node_routeguard "https://github.com/danielkinny/mun-hub/blob/main/components/protectedroute.tsx"
click node_admin "https://github.com/danielkinny/mun-hub/blob/main/app/admin/page.tsx"
click node_chair "https://github.com/danielkinny/mun-hub/blob/main/app/chair/page.tsx"
click node_home "https://github.com/danielkinny/mun-hub/blob/main/app/home/page.tsx"
click node_committee "https://github.com/danielkinny/mun-hub/blob/main/app/committee-overview/page.tsx"
click node_schedule "https://github.com/danielkinny/mun-hub/blob/main/app/home/page.tsx"
click node_announcements "https://github.com/danielkinny/mun-hub/blob/main/app/api/announcements/route.ts"
click node_updates "https://github.com/danielkinny/mun-hub/blob/main/app/live-updates/page.tsx"
click node_updateapi "https://github.com/danielkinny/mun-hub/blob/main/app/api/updates/route.ts"
click node_glossary "https://github.com/danielkinny/mun-hub/blob/main/app/glossary/page.tsx"
click node_speechpage "https://github.com/danielkinny/mun-hub/blob/main/app/speechrepo/page.tsx"
click node_speechhooks "https://github.com/danielkinny/mun-hub/blob/main/hooks/use-speech-api.ts"
click node_speechchair "https://github.com/danielkinny/mun-hub/blob/main/app/api/speeches/chair/route.ts"
click node_speechdelegate "https://github.com/danielkinny/mun-hub/blob/main/app/api/speeches/delegate/route.ts"
click node_resolutionpage "https://github.com/danielkinny/mun-hub/blob/main/app/resolutions/page.tsx"
click node_editor "https://github.com/danielkinny/mun-hub/blob/main/components/tiptap-templates/simple/simple-editor.tsx"
click node_resochair "https://github.com/danielkinny/mun-hub/blob/main/app/api/resos/chair/route.ts"
click node_resodelegate "https://github.com/danielkinny/mun-hub/blob/main/app/api/resos/delegate/route.ts"
click node_chairdelegates "https://github.com/danielkinny/mun-hub/blob/main/app/chair/page.tsx"
click node_delegateapi "https://github.com/danielkinny/mun-hub/blob/main/app/api/delegates/route.ts"
click node_supabase "https://github.com/danielkinny/mun-hub/blob/main/lib/supabase.ts"
click node_adminsupabase "https://github.com/danielkinny/mun-hub/blob/main/lib/supabaseAdmin.ts"
click node_upload "https://github.com/danielkinny/mun-hub/blob/main/app/api/upload-image/route.ts"
click node_articles "https://github.com/danielkinny/mun-hub/blob/main/app/api/articles/route.ts"
click node_committeesapi "https://github.com/danielkinny/mun-hub/blob/main/app/api/committees/route.ts"
click node_countriesapi "https://github.com/danielkinny/mun-hub/blob/main/app/api/countries/route.ts"
click node_countries "https://github.com/danielkinny/mun-hub/blob/main/hooks/use-countries.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_login,node_session,node_routeguard,node_admin,node_chair,node_visitor toneBlue
class node_home,node_committee,node_schedule,node_announcements,node_updates,node_updateapi,node_glossary,node_documents,node_emergency,node_social,node_store toneAmber
class node_speechpage,node_speechhooks,node_speechchair,node_speechdelegate,node_resolutionpage,node_editor,node_resochair,node_resodelegate,node_chairdelegates toneMint
class node_delegateapi,node_supabase,node_adminsupabase,node_upload,node_articles,node_committeesapi,node_countriesapi,node_countries toneRose
```

## Components

### Identity and access

- [Sign in](https://github.com/danielkinny/mun-hub/blob/main/app/login/page.tsx): `app/login/page.tsx`
- [User session](https://github.com/danielkinny/mun-hub/blob/main/app/context/sessionContext.tsx): `app/context/sessionContext.tsx`
- [Role guards](https://github.com/danielkinny/mun-hub/blob/main/components/protectedroute.tsx): `components/protectedroute.tsx`
- [Admin tools](https://github.com/danielkinny/mun-hub/blob/main/app/admin/page.tsx): `app/admin/page.tsx`
- [Chair permissions](https://github.com/danielkinny/mun-hub/blob/main/app/chair/page.tsx): `app/chair/page.tsx`

### Conference information

- [Conference home](https://github.com/danielkinny/mun-hub/blob/main/app/home/page.tsx): `app/home/page.tsx`
- [Committee overview](https://github.com/danielkinny/mun-hub/blob/main/app/committee-overview/page.tsx): `app/committee-overview/page.tsx`
- [Conference schedule](https://github.com/danielkinny/mun-hub/blob/main/app/home/page.tsx): `app/home/page.tsx`
- [Announcements](https://github.com/danielkinny/mun-hub/blob/main/app/api/announcements/route.ts): `app/api/announcements/route.ts`
- [Live updates](https://github.com/danielkinny/mun-hub/blob/main/app/live-updates/page.tsx): `app/live-updates/page.tsx`
- [Updates endpoint](https://github.com/danielkinny/mun-hub/blob/main/app/api/updates/route.ts): `app/api/updates/route.ts`
- [MUN glossary](https://github.com/danielkinny/mun-hub/blob/main/app/glossary/page.tsx): `app/glossary/page.tsx`
- **Document repository**
- **Emergency information**
- **Social media**

### Delegate workspaces

- [Speech repository](https://github.com/danielkinny/mun-hub/blob/main/app/speechrepo/page.tsx): `app/speechrepo/page.tsx`
- [Speech workflow hooks](https://github.com/danielkinny/mun-hub/blob/main/hooks/use-speech-api.ts): `hooks/use-speech-api.ts`
- [Chair speech API](https://github.com/danielkinny/mun-hub/blob/main/app/api/speeches/chair/route.ts): `app/api/speeches/chair/route.ts`
- [Delegate speech API](https://github.com/danielkinny/mun-hub/blob/main/app/api/speeches/delegate/route.ts): `app/api/speeches/delegate/route.ts`
- [Resolutions](https://github.com/danielkinny/mun-hub/blob/main/app/resolutions/page.tsx): `app/resolutions/page.tsx`
- [Rich text editor](https://github.com/danielkinny/mun-hub/blob/main/components/tiptap-templates/simple/simple-editor.tsx): `components/tiptap-templates/simple/simple-editor.tsx`
- [Chair resolution API](https://github.com/danielkinny/mun-hub/blob/main/app/api/resos/chair/route.ts): `app/api/resos/chair/route.ts`
- [Delegate resolution API](https://github.com/danielkinny/mun-hub/blob/main/app/api/resos/delegate/route.ts): `app/api/resos/delegate/route.ts`
- [Delegate management](https://github.com/danielkinny/mun-hub/blob/main/app/chair/page.tsx): `app/chair/page.tsx`

### Data services

- [Delegate API](https://github.com/danielkinny/mun-hub/blob/main/app/api/delegates/route.ts): `app/api/delegates/route.ts`
- [Supabase client](https://github.com/danielkinny/mun-hub/blob/main/lib/supabase.ts): `lib/supabase.ts`
- [Admin Supabase client](https://github.com/danielkinny/mun-hub/blob/main/lib/supabaseAdmin.ts): `lib/supabaseAdmin.ts`
- [Image upload API](https://github.com/danielkinny/mun-hub/blob/main/app/api/upload-image/route.ts): `app/api/upload-image/route.ts`
- [Articles API](https://github.com/danielkinny/mun-hub/blob/main/app/api/articles/route.ts): `app/api/articles/route.ts`
- [Committees API](https://github.com/danielkinny/mun-hub/blob/main/app/api/committees/route.ts): `app/api/committees/route.ts`
- [Countries API](https://github.com/danielkinny/mun-hub/blob/main/app/api/countries/route.ts): `app/api/countries/route.ts`
- [Country lookup hook](https://github.com/danielkinny/mun-hub/blob/main/hooks/use-countries.ts): `hooks/use-countries.ts`

### Other components

- **Conference user**
- **Supabase data store**

## Connections

- Conference user → Sign in: signs in (evidence: `README.md`)
- Sign in → User session: sets session (evidence: `app/login/page.tsx`)
- User session → Role guards: provides identity (evidence: `components/protectedroute.tsx`)
- Delegate management → Delegate API: fetches and updates (evidence: `app/chair/page.tsx`)
- Delegate API → Supabase client: queries (evidence: `app/api/delegates/route.ts`)
- Resolutions → Role guards: uses participant guard (evidence: `app/resolutions/page.tsx`)
- Resolutions → Rich text editor: uses editor (evidence: `app/resolutions/page.tsx`)
- Resolutions → Delegate resolution API: fetches delegate data (evidence: `app/resolutions/page.tsx`)
- Resolutions → Chair resolution API: fetches chair data (evidence: `app/resolutions/page.tsx`)
- Delegate resolution API → Supabase client: queries (evidence: `app/api/resos/delegate/route.ts`)
- Speech repository → Speech workflow hooks: uses workflow hook (evidence: `app/speechrepo/page.tsx`)
- Speech repository → Role guards: uses participant guard (evidence: `app/speechrepo/page.tsx`)
- Chair speech API → Supabase client: queries (evidence: `app/api/speeches/chair/route.ts`)
- Delegate speech API → Supabase client: queries (evidence: `app/api/speeches/delegate/route.ts`)
- Announcements → Supabase client: queries (evidence: `app/api/announcements/route.ts`)
- Updates endpoint → Supabase client: queries (evidence: `app/api/updates/route.ts`)
- Committees API → Supabase client: queries (evidence: `app/api/committees/route.ts`)
- Countries API → Supabase client: queries (evidence: `app/api/countries/route.ts`)
- Image upload API → Admin Supabase client: uses client (evidence: `app/api/upload-image/route.ts`)
- Supabase client → Supabase data store: accesses
- Admin Supabase client → Supabase data store: accesses
- Conference user → Conference home: views conference (evidence: `README.md`)
- Conference user → Committee overview: views committees (evidence: `README.md`)
- Conference user → Conference schedule: views schedule (evidence: `README.md`)
- Conference user → Announcements: receives news (evidence: `README.md`)
- Conference user → Live updates: views updates
- Conference user → MUN glossary: looks up terms
- Conference user → Document repository: accesses documents (evidence: `README.md`)
- Conference user → Emergency information: accesses guidance (evidence: `README.md`)
- Conference user → Social media: shares updates (evidence: `README.md`)
- Country lookup hook → Countries API: loads countries
- Conference user → Articles API: requests articles
