# vintagixdev/deltarune-speedrunning-hub architecture

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

- Interactive diagram: https://gitdiagram.com/vintagixdev/deltarune-speedrunning-hub
- Repository: https://github.com/vintagixdev/deltarune-speedrunning-hub

## Overview

Deltarune Speedrunning Hub is a Next.js site for browsing speedrun guides and managing user-authored strategies. The apparent workflow is guide browsing and reading, with signed-in users creating, editing, or deleting guides; API routes enforce sessions and access rules before database operations. Discord OAuth provides sign-in. The graph uses sampled routes and source-index references; unsampled page-to-API wiring and several documented setup details are not inferred.

Main entry points: [`src/lib/db.js`](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/lib/db.js) (MySQL connector), [`src/lib/auth.js`](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/lib/auth.js) (Session helper), [`src/app/api/strats/delete/route.js`](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/strats/delete/route.js) (Guide deletion API), [`src/app/layout.tsx`](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/layout.tsx) (Site layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Site experience"]
  node_layout["Site layout<br/>[layout.tsx]"]
  node_header["Navigation<br/>[header.tsx]"]
  node_footer["Footer<br/>[footer.tsx]"]
  node_home["Home page<br/>[page.tsx]"]
end

subgraph group_guides["Guide management"]
  node_guides_list["Guide index<br/>[page.tsx]"]
  node_chapter_page["Chapter guides<br/>[page.tsx]"]
  node_guide_detail["Guide detail<br/>[page.tsx]"]
  node_guide_new["New guide<br/>[page.tsx]"]
  node_guide_edit["Edit guide<br/>[page.tsx]"]
  node_guide_delete["Delete page<br/>[page.tsx]"]
  node_markdown["Markdown editor<br/>[MarkdownEditor.tsx]"]
  node_actions["Guide actions"]
end

subgraph group_api["API and identity"]
  node_auth["Session helper<br/>[auth.js]"]
  node_me_api["Current user API<br/>[route.js]"]
  node_discord_callback["Discord callback<br/>[route.js]"]
  node_chapters_api["Chapters API<br/>[route.js]"]
  node_sections_api["Sections API<br/>[route.js]"]
  node_strats_get["Guide retrieval API<br/>[route.js]"]
  node_strats_new["Guide creation API<br/>[route.js]"]
  node_strats_edit["Guide editing API<br/>[route.js]"]
  node_strats_delete["Guide deletion API<br/>[route.js]"]
  node_users_api["User listing API<br/>[route.js]"]
  node_logout_api["Logout API<br/>[route.js]"]
end

subgraph group_data["Persistence"]
  node_db_helper["MySQL connector<br/>[db.js]"]
  node_mysql[("MySQL database")]
end

node_visitor(("Visitor"))
node_discord["Discord OAuth"]

node_visitor -.->|"visits"| node_home
node_layout -->|"renders"| node_header
node_layout -->|"renders"| node_footer
node_layout -->|"uses session"| node_auth
node_chapter_page -->|"renders"| node_actions
node_guide_detail -->|"renders"| node_actions
node_guide_new -->|"renders"| node_markdown
node_guide_edit -->|"renders"| node_markdown
node_actions -->|"requests deletion"| node_strats_delete
node_auth -->|"requests session"| node_me_api
node_me_api -->|"queries users"| node_db_helper
node_discord_callback -->|"exchanges OAuth"| node_discord
node_discord_callback -->|"stores account"| node_db_helper
node_chapters_api -->|"queries chapters"| node_db_helper
node_sections_api -->|"queries sections"| node_db_helper
node_strats_get -->|"queries guides"| node_db_helper
node_strats_new -->|"checks session"| node_auth
node_strats_new -->|"inserts guide"| node_db_helper
node_strats_edit -->|"checks session"| node_auth
node_strats_edit -->|"updates guide"| node_db_helper
node_strats_delete -->|"checks session"| node_auth
node_strats_delete -->|"fetches guide"| node_strats_get
node_strats_delete -->|"deletes guide"| node_db_helper
node_users_api -->|"queries users"| node_db_helper
node_db_helper -->|"opens connection"| node_mysql

click node_layout "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/layout.tsx"
click node_header "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/header.tsx"
click node_footer "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/footer.tsx"
click node_home "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/page.tsx"
click node_guides_list "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/guides/page.tsx"
click node_chapter_page "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/guides/%5BchapterLink%5D/page.tsx"
click node_guide_detail "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/guide/%5BstratID%5D/page.tsx"
click node_guide_new "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/guide/new/page.tsx"
click node_guide_edit "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/guide/edit/page.tsx"
click node_guide_delete "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/guide/delete/page.tsx"
click node_markdown "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/lib/component/MarkdownEditor.tsx"
click node_actions "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/lib/component/ActionButtonsClient.tsx"
click node_auth "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/lib/auth.js"
click node_me_api "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/me/route.js"
click node_discord_callback "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/discord/callback/route.js"
click node_chapters_api "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/chapters/get/route.js"
click node_sections_api "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/section/get/route.js"
click node_strats_get "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/strats/get/route.js"
click node_strats_new "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/strats/new/route.js"
click node_strats_edit "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/strats/edit/route.js"
click node_strats_delete "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/strats/delete/route.js"
click node_users_api "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/users/route.js"
click node_logout_api "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/user/logout/route.js"
click node_db_helper "https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/lib/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_layout,node_header,node_footer,node_home toneBlue
class node_guides_list,node_chapter_page,node_guide_detail,node_guide_new,node_guide_edit,node_guide_delete,node_markdown,node_actions toneAmber
class node_auth,node_me_api,node_discord_callback,node_chapters_api,node_sections_api,node_strats_get,node_strats_new,node_strats_edit,node_strats_delete,node_users_api,node_logout_api toneMint
class node_db_helper,node_mysql toneRose
class node_visitor,node_discord toneIndigo
```

## Components

### Site experience

- [Site layout](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/layout.tsx): `src/app/layout.tsx`
- [Navigation](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/header.tsx): `src/app/header.tsx`
- [Footer](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/footer.tsx): `src/app/footer.tsx`
- [Home page](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/page.tsx): `src/app/page.tsx`

### Guide management

- [Guide index](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/guides/page.tsx): `src/app/guides/page.tsx`
- [Chapter guides](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/guides/%5BchapterLink%5D/page.tsx): `src/app/guides/[chapterLink]/page.tsx`
- [Guide detail](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/guide/%5BstratID%5D/page.tsx): `src/app/guide/[stratID]/page.tsx`
- [New guide](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/guide/new/page.tsx): `src/app/guide/new/page.tsx`
- [Edit guide](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/guide/edit/page.tsx): `src/app/guide/edit/page.tsx`
- [Delete page](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/guide/delete/page.tsx): `src/app/guide/delete/page.tsx`
- [Markdown editor](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/lib/component/MarkdownEditor.tsx): `src/lib/component/MarkdownEditor.tsx`
- [Guide actions](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/lib/component/ActionButtonsClient.tsx): `src/lib/component/ActionButtonsClient.tsx`

### API and identity

- [Session helper](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/lib/auth.js): `src/lib/auth.js`
- [Current user API](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/me/route.js): `src/app/api/me/route.js`
- [Discord callback](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/discord/callback/route.js): `src/app/api/discord/callback/route.js`
- [Chapters API](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/chapters/get/route.js): `src/app/api/chapters/get/route.js`
- [Sections API](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/section/get/route.js): `src/app/api/section/get/route.js`
- [Guide retrieval API](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/strats/get/route.js): `src/app/api/strats/get/route.js`
- [Guide creation API](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/strats/new/route.js): `src/app/api/strats/new/route.js`
- [Guide editing API](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/strats/edit/route.js): `src/app/api/strats/edit/route.js`
- [Guide deletion API](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/strats/delete/route.js): `src/app/api/strats/delete/route.js`
- [User listing API](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/users/route.js): `src/app/api/users/route.js`
- [Logout API](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/app/api/user/logout/route.js): `src/app/api/user/logout/route.js`

### Persistence

- [MySQL connector](https://github.com/vintagixdev/deltarune-speedrunning-hub/blob/main/src/lib/db.js): `src/lib/db.js`
- **MySQL database**

### Other components

- **Visitor**
- **Discord OAuth**

## Connections

- Visitor → Home page: visits
- Site layout → Navigation: renders (evidence: `src/app/layout.tsx`)
- Site layout → Footer: renders (evidence: `src/app/layout.tsx`)
- Site layout → Session helper: uses session (evidence: `src/app/layout.tsx`)
- Chapter guides → Guide actions: renders (evidence: `src/app/guides/[chapterLink]/page.tsx`)
- Guide detail → Guide actions: renders (evidence: `src/app/guide/[stratID]/page.tsx`)
- New guide → Markdown editor: renders (evidence: `src/app/guide/new/page.tsx`)
- Edit guide → Markdown editor: renders (evidence: `src/app/guide/edit/page.tsx`)
- Guide actions → Guide deletion API: requests deletion (evidence: `src/lib/component/ActionButtonsClient.tsx`)
- Session helper → Current user API: requests session (evidence: `src/lib/auth.js`)
- Current user API → MySQL connector: queries users (evidence: `src/app/api/me/route.js`)
- Discord callback → Discord OAuth: exchanges OAuth (evidence: `src/app/api/discord/callback/route.js`)
- Discord callback → MySQL connector: stores account (evidence: `src/app/api/discord/callback/route.js`)
- Chapters API → MySQL connector: queries chapters (evidence: `src/app/api/chapters/get/route.js`)
- Sections API → MySQL connector: queries sections (evidence: `src/app/api/section/get/route.js`)
- Guide retrieval API → MySQL connector: queries guides (evidence: `src/app/api/strats/get/route.js`)
- Guide creation API → Session helper: checks session (evidence: `src/app/api/strats/new/route.js`)
- Guide creation API → MySQL connector: inserts guide (evidence: `src/app/api/strats/new/route.js`)
- Guide editing API → Session helper: checks session (evidence: `src/app/api/strats/edit/route.js`)
- Guide editing API → MySQL connector: updates guide (evidence: `src/app/api/strats/edit/route.js`)
- Guide deletion API → Session helper: checks session (evidence: `src/app/api/strats/delete/route.js`)
- Guide deletion API → Guide retrieval API: fetches guide (evidence: `src/app/api/strats/delete/route.js`)
- Guide deletion API → MySQL connector: deletes guide (evidence: `src/app/api/strats/delete/route.js`)
- User listing API → MySQL connector: queries users (evidence: `src/app/api/users/route.js`)
- MySQL connector → MySQL database: opens connection (evidence: `src/lib/db.js`)
