# krijn1992/discord-soundboard-bot-po-humo architecture

> Architecture diagram of the GitHub repository krijn1992/discord-soundboard-bot-po-humo, 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/krijn1992/discord-soundboard-bot-po-humo
- Repository: https://github.com/krijn1992/discord-soundboard-bot-po-humo

## Overview

This is a Discord soundboard with an authenticated web interface and Discord slash-command/voice-event controls. The main workflow is: a server member signs in, browses or searches sounds, selects a voice channel, and requests playback; the bot validates and plays the sound, then records the event. Ratings form a parallel web workflow with persistent per-user votes and sorting. The graph follows the sampled calls and README capabilities; unsampled route wiring is not inferred beyond documented behavior.

Main entry points: [`src/index.js`](https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/index.js) (Web UI and routes), [`src/services/sounds.js`](https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/services/sounds.js) (Sound catalog and search), [`src/services/playback.js`](https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/services/playback.js) (Voice playback), [`src/services/discordBot.js`](https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/services/discordBot.js) (Bot commands and events)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_webapp["Web UI and routes<br/>[index.js]"]
  node_auth["OAuth and sessions<br/>[auth.js]"]
end

subgraph group_discord["Discord runtime"]
  node_bot["Bot commands and events<br/>[discordBot.js]"]
end

subgraph group_domain["Soundboard services"]
  node_playback["Voice playback<br/>[playback.js]"]
  node_sounds["Sound catalog and search<br/>[sounds.js]"]
  node_ratings["Votes and sorting<br/>[ratings.js]"]
  node_logger["Playback event logger<br/>[logger.js]"]
end

subgraph group_support["Configuration and helpers"]
  node_config["Runtime configuration<br/>[config.js]"]
  node_paths["Path safety<br/>[paths.js]"]
  node_html["HTML helpers<br/>[html.js]"]
end

node_member(("Server member"))
node_browser(("Web browser"))
node_discord["Discord platform"]
node_soundfiles[("Sound directory")]
node_ratingstore[("Ratings file")]
node_sessionstore[("Session file store")]

node_member -->|"uses"| node_browser
node_browser -->|"signs in"| node_auth
node_auth -->|"OAuth login"| node_discord
node_auth -->|"persists sessions"| node_sessionstore
node_browser -->|"browses and votes"| node_webapp
node_webapp -->|"lists and searches"| node_sounds
node_webapp -->|"loads and records votes"| node_ratings
node_webapp -->|"fetches voice channels"| node_bot
node_webapp -->|"requests playback"| node_playback
node_bot -->|"handles commands and events"| node_discord
node_bot -->|"finds voice sounds"| node_sounds
node_bot -->|"requests playback"| node_playback
node_playback -->|"joins voice channel"| node_discord
node_playback -->|"validates sound path"| node_sounds
node_playback -->|"records playback"| node_logger
node_sounds -->|"reads sound files"| node_soundfiles
node_ratings -->|"reads and writes votes"| node_ratingstore
node_ratings -->|"validates voted file"| node_sounds
node_ratings -->|"normalizes vote paths"| node_paths
node_sounds -->|"safely resolves paths"| node_paths
node_sounds -->|"uses extensions and directories"| node_config
node_webapp -->|"validates and initializes"| node_config
node_webapp -->|"renders escaped pages"| node_html

click node_webapp "https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/index.js"
click node_auth "https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/auth.js"
click node_bot "https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/services/discordBot.js"
click node_playback "https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/services/playback.js"
click node_sounds "https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/services/sounds.js"
click node_ratings "https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/services/ratings.js"
click node_logger "https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/services/logger.js"
click node_config "https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/config.js"
click node_paths "https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/utils/paths.js"
click node_html "https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/utils/html.js"
click node_soundfiles "https://github.com/krijn1992/discord-soundboard-bot-po-humo/tree/main/sounds"
click node_ratingstore "https://github.com/krijn1992/discord-soundboard-bot-po-humo/tree/main/data"

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_webapp,node_auth,node_browser toneBlue
class node_bot,node_soundfiles,node_ratingstore,node_sessionstore toneAmber
class node_playback,node_sounds,node_ratings,node_logger,node_member toneMint
class node_config,node_paths,node_html toneRose
class node_discord toneIndigo
```

## Components

### Web interface

- [Web UI and routes](https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/index.js): `src/index.js`
- [OAuth and sessions](https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/auth.js): `src/auth.js`

### Discord runtime

- [Bot commands and events](https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/services/discordBot.js): `src/services/discordBot.js`

### Soundboard services

- [Voice playback](https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/services/playback.js): `src/services/playback.js`
- [Sound catalog and search](https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/services/sounds.js): `src/services/sounds.js`
- [Votes and sorting](https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/services/ratings.js): `src/services/ratings.js`
- [Playback event logger](https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/services/logger.js): `src/services/logger.js`

### Configuration and helpers

- [Runtime configuration](https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/config.js): `src/config.js`
- [Path safety](https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/utils/paths.js): `src/utils/paths.js`
- [HTML helpers](https://github.com/krijn1992/discord-soundboard-bot-po-humo/blob/main/src/utils/html.js): `src/utils/html.js`

### Other components

- **Server member**
- **Web browser**
- **Discord platform**
- [Sound directory](https://github.com/krijn1992/discord-soundboard-bot-po-humo/tree/main/sounds): `sounds`
- [Ratings file](https://github.com/krijn1992/discord-soundboard-bot-po-humo/tree/main/data): `data`
- **Session file store**

## Connections

- Server member → Web browser: uses (evidence: `README.md`)
- Web browser → OAuth and sessions: signs in (evidence: `README.md`)
- OAuth and sessions → Discord platform: OAuth login (evidence: `src/auth.js`)
- OAuth and sessions → Session file store: persists sessions (evidence: `src/auth.js`)
- Web browser → Web UI and routes: browses and votes (evidence: `README.md`)
- Web UI and routes → Sound catalog and search: lists and searches (evidence: `src/index.js`)
- Web UI and routes → Votes and sorting: loads and records votes (evidence: `src/index.js`)
- Web UI and routes → Bot commands and events: fetches voice channels (evidence: `src/index.js`)
- Web UI and routes → Voice playback: requests playback (evidence: `src/index.js`)
- Bot commands and events → Discord platform: handles commands and events (evidence: `src/services/discordBot.js`)
- Bot commands and events → Sound catalog and search: finds voice sounds (evidence: `src/services/discordBot.js`)
- Bot commands and events → Voice playback: requests playback (evidence: `src/services/discordBot.js`)
- Voice playback → Discord platform: joins voice channel (evidence: `src/services/playback.js`)
- Voice playback → Sound catalog and search: validates sound path (evidence: `src/services/playback.js`)
- Voice playback → Playback event logger: records playback (evidence: `src/services/playback.js`)
- Sound catalog and search → Sound directory: reads sound files (evidence: `src/services/sounds.js`)
- Votes and sorting → Ratings file: reads and writes votes (evidence: `src/services/ratings.js`)
- Votes and sorting → Sound catalog and search: validates voted file (evidence: `src/services/ratings.js`)
- Votes and sorting → Path safety: normalizes vote paths (evidence: `src/services/ratings.js`)
- Sound catalog and search → Path safety: safely resolves paths (evidence: `src/services/sounds.js`)
- Sound catalog and search → Runtime configuration: uses extensions and directories (evidence: `src/services/sounds.js`)
- Web UI and routes → Runtime configuration: validates and initializes (evidence: `src/index.js`)
- Web UI and routes → HTML helpers: renders escaped pages (evidence: `src/index.js`)
