# lostinsyntaxx/bot-discord-demo architecture

> Architecture diagram of the GitHub repository lostinsyntaxx/bot-discord-demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lostinsyntaxx/bot-discord-demo
- Repository: https://github.com/lostinsyntaxx/bot-discord-demo

## Overview

This is a Discord.js bot with a companion authenticated HTTP API/dashboard. Its main user workflow is Discord interactions dispatched to commands or components, which perform bot features and return Discord responses. The API offers a second management path for guild, moderation, music, and utility features. The README documents broader command and component capabilities than the sampled source; links among unsampled feature modules are therefore omitted.

Main entry points: [`src/webServer/routes`](https://github.com/lostinsyntaxx/bot-discord-demo/tree/main/src/webServer/routes) (Management routes), [`src/commands`](https://github.com/lostinsyntaxx/bot-discord-demo/tree/main/src/commands) (Slash commands), [`src/index.ts`](https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/index.ts) (Bot startup), [`src/api/server.ts`](https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/api/server.ts) (HTTP application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_entry["Bot startup<br/>[index.ts]"]
  node_events["Discord events"]
  node_interaction["Interaction dispatch"]
  node_command_handler["Command loader<br/>[commandHandler.ts]"]
  node_component_handler["Component loader"]
end

subgraph group_discord_features["Discord features"]
  node_commands["Slash commands"]
  node_components["Buttons and forms"]
  node_moderation["Moderation features"]
  node_music["Music controls"]
  node_utilities["Guild utilities"]
end

subgraph group_api["HTTP API"]
  node_api_service["API lifecycle<br/>[api.service.ts]"]
  node_api_server["HTTP application<br/>[server.ts]"]
  node_routes["Management routes"]
  node_auth["API authentication<br/>[auth.ts]"]
end

subgraph group_services["Business services"]
  node_ticket_service["Ticket lifecycle<br/>[ticket.service.ts]"]
  node_channel_edit["Channel editing"]
end

subgraph group_state["Configuration and state"]
  node_guild_config["Guild configuration<br/>[guildConfig.ts]"]
  node_database[("SQLite database")]
end

node_discord_user(("Discord user"))
node_admin(("Dashboard admin"))
node_discord(("Discord platform"))

node_discord_user -->|"uses"| node_discord
node_discord -->|"delivers interactions"| node_interaction
node_interaction -->|"dispatches commands"| node_commands
node_interaction -->|"dispatches components"| node_components
node_entry -->|"loads commands"| node_command_handler
node_entry -->|"loads components"| node_component_handler
node_entry -->|"loads events"| node_events
node_command_handler -->|"loads"| node_commands
node_component_handler -->|"loads"| node_components
node_commands -->|"includes"| node_moderation
node_commands -->|"includes"| node_music
node_commands -->|"includes"| node_utilities
node_commands -->|"replies and acts"| node_discord
node_components -->|"updates interactions"| node_discord
node_admin -->|"sends requests"| node_api_server
node_entry -->|"initializes"| node_api_service
node_api_service -->|"creates app"| node_api_server
node_api_server -->|"applies middleware"| node_auth
node_api_server -->|"mounts routers"| node_routes
node_routes -->|"manages guilds"| node_discord
node_routes -->|"handles moderation"| node_moderation
node_routes -->|"handles music"| node_music
node_routes -->|"manages tickets"| node_ticket_service
node_routes -->|"edits channels"| node_channel_edit
node_routes -->|"reads and writes"| node_guild_config
node_ticket_service -->|"reads and writes"| node_database
node_entry -->|"initializes"| node_database

click node_entry "https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/index.ts"
click node_events "https://github.com/lostinsyntaxx/bot-discord-demo/tree/main/src/events"
click node_interaction "https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/events/interaction/interactionCreate.ts"
click node_command_handler "https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/handlers/commandHandler.ts"
click node_component_handler "https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/handlers/componentHandler.ts"
click node_commands "https://github.com/lostinsyntaxx/bot-discord-demo/tree/main/src/commands"
click node_components "https://github.com/lostinsyntaxx/bot-discord-demo/tree/main/src/components"
click node_moderation "https://github.com/lostinsyntaxx/bot-discord-demo/tree/main/src/commands/moderation"
click node_music "https://github.com/lostinsyntaxx/bot-discord-demo/tree/main/src/commands/music"
click node_utilities "https://github.com/lostinsyntaxx/bot-discord-demo/tree/main/src/commands/utility"
click node_api_service "https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/services/api.service.ts"
click node_api_server "https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/api/server.ts"
click node_routes "https://github.com/lostinsyntaxx/bot-discord-demo/tree/main/src/webServer/routes"
click node_auth "https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/webServer/middleware/auth.ts"
click node_ticket_service "https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/services/ticket.service.ts"
click node_channel_edit "https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/services/channelEdit.service.ts"
click node_guild_config "https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/utils/guildConfig.ts"
click node_database "https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/services/database.service.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_entry,node_events,node_interaction,node_command_handler,node_component_handler,node_discord_user toneBlue
class node_commands,node_components,node_moderation,node_music,node_utilities toneAmber
class node_api_service,node_api_server,node_routes,node_auth toneMint
class node_ticket_service,node_channel_edit toneRose
class node_guild_config,node_database,node_admin,node_discord toneIndigo
```

## Components

### Bot runtime

- [Bot startup](https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/index.ts): `src/index.ts`
- [Discord events](https://github.com/lostinsyntaxx/bot-discord-demo/tree/main/src/events): `src/events`
- [Interaction dispatch](https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/events/interaction/interactionCreate.ts): `src/events/interaction/interactionCreate.ts`
- [Command loader](https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/handlers/commandHandler.ts): `src/handlers/commandHandler.ts`
- [Component loader](https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/handlers/componentHandler.ts): `src/handlers/componentHandler.ts`

### Discord features

- [Slash commands](https://github.com/lostinsyntaxx/bot-discord-demo/tree/main/src/commands): `src/commands`
- [Buttons and forms](https://github.com/lostinsyntaxx/bot-discord-demo/tree/main/src/components): `src/components`
- [Moderation features](https://github.com/lostinsyntaxx/bot-discord-demo/tree/main/src/commands/moderation): `src/commands/moderation`
- [Music controls](https://github.com/lostinsyntaxx/bot-discord-demo/tree/main/src/commands/music): `src/commands/music`
- [Guild utilities](https://github.com/lostinsyntaxx/bot-discord-demo/tree/main/src/commands/utility): `src/commands/utility`

### HTTP API

- [API lifecycle](https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/services/api.service.ts): `src/services/api.service.ts`
- [HTTP application](https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/api/server.ts): `src/api/server.ts`
- [Management routes](https://github.com/lostinsyntaxx/bot-discord-demo/tree/main/src/webServer/routes): `src/webServer/routes`
- [API authentication](https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/webServer/middleware/auth.ts): `src/webServer/middleware/auth.ts`

### Business services

- [Ticket lifecycle](https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/services/ticket.service.ts): `src/services/ticket.service.ts`
- [Channel editing](https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/services/channelEdit.service.ts): `src/services/channelEdit.service.ts`

### Configuration and state

- [Guild configuration](https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/utils/guildConfig.ts): `src/utils/guildConfig.ts`
- [SQLite database](https://github.com/lostinsyntaxx/bot-discord-demo/blob/main/src/services/database.service.ts): `src/services/database.service.ts`

### Other components

- **Discord user**
- **Dashboard admin**
- **Discord platform**

## Connections

- Discord user → Discord platform: uses
- Discord platform → Interaction dispatch: delivers interactions
- Interaction dispatch → Slash commands: dispatches commands
- Interaction dispatch → Buttons and forms: dispatches components
- Bot startup → Command loader: loads commands
- Bot startup → Component loader: loads components
- Bot startup → Discord events: loads events
- Command loader → Slash commands: loads
- Component loader → Buttons and forms: loads
- Slash commands → Moderation features: includes
- Slash commands → Music controls: includes
- Slash commands → Guild utilities: includes
- Slash commands → Discord platform: replies and acts
- Buttons and forms → Discord platform: updates interactions
- Dashboard admin → HTTP application: sends requests
- Bot startup → API lifecycle: initializes
- API lifecycle → HTTP application: creates app
- HTTP application → API authentication: applies middleware
- HTTP application → Management routes: mounts routers
- Management routes → Discord platform: manages guilds
- Management routes → Moderation features: handles moderation
- Management routes → Music controls: handles music
- Management routes → Ticket lifecycle: manages tickets
- Management routes → Channel editing: edits channels
- Management routes → Guild configuration: reads and writes
- Ticket lifecycle → SQLite database: reads and writes
- Bot startup → SQLite database: initializes
