# starlightent/sfggc-nextjs architecture

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

- Interactive diagram: https://gitdiagram.com/starlightent/sfggc-nextjs
- Repository: https://github.com/starlightent/sfggc-nextjs

## Overview

Golden Gate Classic is a tournament website with public event and destination information plus a database-backed portal for administrators and participants. The public journey is browsing the tournament site; the portal journey is signing in, accessing role-appropriate participant or admin functions, and viewing or managing tournament information. The tree and excerpts support the main page composition and several portal calls, but not every API implementation; unverified links are omitted. MariaDB backing and the unified Next.js application are documented in the README.

Main entry points: [`src/pages/portal`](https://github.com/starlightent/sfggc-nextjs/tree/main/src/pages/portal) (Portal pages), [`src/pages/index.js`](https://github.com/starlightent/sfggc-nextjs/blob/main/src/pages/index.js) (Tournament home), [`src/pages/api/portal/admin`](https://github.com/starlightent/sfggc-nextjs/tree/main/src/pages/api/portal/admin) (Admin API routes), [`src/utils/portal/session.js`](https://github.com/starlightent/sfggc-nextjs/blob/main/src/utils/portal/session.js) (Session security)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public website"]
  node_home["Tournament home<br/>[index.js]"]
  node_site_layout["Site layout<br/>[layout.js]"]
  node_event_info["Event information<br/>[Schedule.js]"]
  node_venue_info["Venue and location<br/>[Location.js]"]
  node_destination["San Francisco guide<br/>[SanFrancisco.js]"]
end

subgraph group_portal_ui["Portal experience"]
  node_portal_pages["Portal pages"]
  node_admin_menu["Admin controls<br/>[AdminMenu.js]"]
  node_admin_session_hook["Admin session hook<br/>[useAdminSession.js]"]
  node_visibility_hook["Visibility controls"]
  node_participant_pages["Participant access"]
end

subgraph group_portal_services["Portal services"]
  node_admin_api["Admin API routes"]
  node_participant_api["Participant API routes"]
  node_score_api["Scores and teams API"]
  node_session_service["Session security<br/>[session.js]"]
  node_ssr_guards["SSR access guards<br/>[ssr-helpers.js]"]
  node_fetch_client["Portal fetch client<br/>[portal-fetch.js]"]
end

subgraph group_state["Data and session"]
  node_settings["Portal settings"]
  node_database[("MariaDB")]
end

node_visitor(("Site visitor"))
node_portal_user(("Portal user"))

node_visitor -->|"opens"| node_home
node_home -->|"uses layout"| node_site_layout
node_home -->|"renders"| node_event_info
node_home -->|"renders"| node_venue_info
node_home -->|"renders"| node_destination
node_portal_user -.->|"opens"| node_portal_pages
node_portal_pages -->|"renders"| node_admin_menu
node_portal_pages -.->|"routes"| node_participant_pages
node_portal_pages -->|"checks session"| node_admin_session_hook
node_portal_pages -->|"toggles visibility"| node_visibility_hook
node_admin_menu -->|"uploads XML"| node_admin_api
node_admin_menu -->|"uses"| node_fetch_client
node_admin_session_hook -->|"checks session"| node_admin_api
node_visibility_hook -->|"updates through"| node_fetch_client
node_participant_pages -.->|"requests"| node_participant_api
node_portal_pages -.->|"loads standings"| node_score_api
node_admin_api -.->|"authenticates"| node_session_service
node_participant_api -->|"authenticates"| node_session_service
node_admin_api -->|"checks session"| node_session_service
node_ssr_guards -->|"verifies tokens"| node_session_service
node_portal_pages -.->|"guards SSR"| node_ssr_guards
node_settings -.->|"reads settings"| node_database
node_admin_api -.->|"reads and writes"| node_database

click node_home "https://github.com/starlightent/sfggc-nextjs/blob/main/src/pages/index.js"
click node_site_layout "https://github.com/starlightent/sfggc-nextjs/blob/main/src/components/layout/layout.js"
click node_event_info "https://github.com/starlightent/sfggc-nextjs/blob/main/src/components/Schedule/Schedule.js"
click node_venue_info "https://github.com/starlightent/sfggc-nextjs/blob/main/src/components/Location/Location.js"
click node_destination "https://github.com/starlightent/sfggc-nextjs/blob/main/src/components/SanFrancisco/SanFrancisco.js"
click node_portal_pages "https://github.com/starlightent/sfggc-nextjs/tree/main/src/pages/portal"
click node_admin_menu "https://github.com/starlightent/sfggc-nextjs/blob/main/src/components/Portal/AdminMenu/AdminMenu.js"
click node_admin_session_hook "https://github.com/starlightent/sfggc-nextjs/blob/main/src/hooks/portal/useAdminSession.js"
click node_visibility_hook "https://github.com/starlightent/sfggc-nextjs/blob/main/src/hooks/portal/useVisibilityToggle.js"
click node_participant_pages "https://github.com/starlightent/sfggc-nextjs/tree/main/src/pages/portal/participant"
click node_admin_api "https://github.com/starlightent/sfggc-nextjs/tree/main/src/pages/api/portal/admin"
click node_participant_api "https://github.com/starlightent/sfggc-nextjs/tree/main/src/pages/api/portal/participant"
click node_score_api "https://github.com/starlightent/sfggc-nextjs/tree/main/src/pages/api/portal"
click node_session_service "https://github.com/starlightent/sfggc-nextjs/blob/main/src/utils/portal/session.js"
click node_ssr_guards "https://github.com/starlightent/sfggc-nextjs/blob/main/src/utils/portal/ssr-helpers.js"
click node_fetch_client "https://github.com/starlightent/sfggc-nextjs/blob/main/src/utils/portal/portal-fetch.js"
click node_settings "https://github.com/starlightent/sfggc-nextjs/blob/main/src/utils/portal/portal-settings-db.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_home,node_site_layout,node_event_info,node_venue_info,node_destination,node_portal_user toneBlue
class node_portal_pages,node_admin_menu,node_admin_session_hook,node_visibility_hook,node_participant_pages toneAmber
class node_admin_api,node_participant_api,node_score_api,node_session_service,node_ssr_guards,node_fetch_client toneMint
class node_settings,node_database toneRose
class node_visitor toneIndigo
```

## Components

### Public website

- [Tournament home](https://github.com/starlightent/sfggc-nextjs/blob/main/src/pages/index.js): `src/pages/index.js`
- [Site layout](https://github.com/starlightent/sfggc-nextjs/blob/main/src/components/layout/layout.js): `src/components/layout/layout.js`
- [Event information](https://github.com/starlightent/sfggc-nextjs/blob/main/src/components/Schedule/Schedule.js): `src/components/Schedule/Schedule.js`
- [Venue and location](https://github.com/starlightent/sfggc-nextjs/blob/main/src/components/Location/Location.js): `src/components/Location/Location.js`
- [San Francisco guide](https://github.com/starlightent/sfggc-nextjs/blob/main/src/components/SanFrancisco/SanFrancisco.js): `src/components/SanFrancisco/SanFrancisco.js`

### Portal experience

- [Portal pages](https://github.com/starlightent/sfggc-nextjs/tree/main/src/pages/portal): `src/pages/portal`
- [Admin controls](https://github.com/starlightent/sfggc-nextjs/blob/main/src/components/Portal/AdminMenu/AdminMenu.js): `src/components/Portal/AdminMenu/AdminMenu.js`
- [Admin session hook](https://github.com/starlightent/sfggc-nextjs/blob/main/src/hooks/portal/useAdminSession.js): `src/hooks/portal/useAdminSession.js`
- [Visibility controls](https://github.com/starlightent/sfggc-nextjs/blob/main/src/hooks/portal/useVisibilityToggle.js): `src/hooks/portal/useVisibilityToggle.js`
- [Participant access](https://github.com/starlightent/sfggc-nextjs/tree/main/src/pages/portal/participant): `src/pages/portal/participant`

### Portal services

- [Admin API routes](https://github.com/starlightent/sfggc-nextjs/tree/main/src/pages/api/portal/admin): `src/pages/api/portal/admin`
- [Participant API routes](https://github.com/starlightent/sfggc-nextjs/tree/main/src/pages/api/portal/participant): `src/pages/api/portal/participant`
- [Scores and teams API](https://github.com/starlightent/sfggc-nextjs/tree/main/src/pages/api/portal): `src/pages/api/portal`
- [Session security](https://github.com/starlightent/sfggc-nextjs/blob/main/src/utils/portal/session.js): `src/utils/portal/session.js`
- [SSR access guards](https://github.com/starlightent/sfggc-nextjs/blob/main/src/utils/portal/ssr-helpers.js): `src/utils/portal/ssr-helpers.js`
- [Portal fetch client](https://github.com/starlightent/sfggc-nextjs/blob/main/src/utils/portal/portal-fetch.js): `src/utils/portal/portal-fetch.js`

### Data and session

- [Portal settings](https://github.com/starlightent/sfggc-nextjs/blob/main/src/utils/portal/portal-settings-db.js): `src/utils/portal/portal-settings-db.js`
- **MariaDB**

### Other components

- **Site visitor**
- **Portal user**

## Connections

- Site visitor → Tournament home: opens (evidence: `src/pages/index.js`)
- Tournament home → Site layout: uses layout (evidence: `src/pages/index.js`)
- Tournament home → Event information: renders (evidence: `src/pages/index.js`)
- Tournament home → Venue and location: renders (evidence: `src/pages/index.js`)
- Tournament home → San Francisco guide: renders (evidence: `src/pages/index.js`)
- Portal user → Portal pages: opens
- Portal pages → Admin controls: renders (evidence: `src/pages/portal/admin/admins/index.js`)
- Portal pages → Participant access: routes
- Portal pages → Admin session hook: checks session (evidence: `src/pages/portal/admin/optional-events.js`)
- Portal pages → Visibility controls: toggles visibility (evidence: `src/pages/portal/admin/optional-events.js`)
- Admin controls → Admin API routes: uploads XML (evidence: `src/components/Portal/AdminMenu/AdminMenu.js`)
- Admin controls → Portal fetch client: uses (evidence: `src/components/Portal/AdminMenu/AdminMenu.js`)
- Admin session hook → Admin API routes: checks session (evidence: `src/hooks/portal/useAdminSession.js`)
- Visibility controls → Portal fetch client: updates through (evidence: `src/hooks/portal/useVisibilityToggle.js`)
- Participant access → Participant API routes: requests
- Portal pages → Scores and teams API: loads standings
- Admin API routes → Session security: authenticates (evidence: `src/pages/api/portal/admin/session.js`)
- Participant API routes → Session security: authenticates (evidence: `src/pages/api/portal/participant/session.js`)
- Admin API routes → Session security: checks session (evidence: `src/pages/api/portal/admin/session.js`)
- SSR access guards → Session security: verifies tokens (evidence: `src/utils/portal/ssr-helpers.js`)
- Portal pages → SSR access guards: guards SSR (evidence: `src/pages/portal/admin/admins/index.js`)
- Portal settings → MariaDB: reads settings
- Admin API routes → MariaDB: reads and writes
