# nayandas69/supporthub architecture

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

- Interactive diagram: https://gitdiagram.com/nayandas69/supporthub
- Repository: https://github.com/nayandas69/supporthub

## Overview

SupportHub is a Discord server ticketing bot backed by Supabase. Server administrators configure or remove the ticket system; users open tickets through a Discord panel, and staff can claim and close them. The interaction event routes commands and ticket buttons to their handlers, which coordinate Discord actions and persistent ticket data. The README also documents transcripts, multi-server configuration, activity updates, and health monitoring. Some command and lifecycle details are represented from documentation or source references because their full implementations were not sampled.

Main entry points: [`src/handlers/ticketHandler.js`](https://github.com/nayandas69/supporthub/blob/main/src/handlers/ticketHandler.js) (Ticket lifecycle), [`src/events/interactionCreate.js`](https://github.com/nayandas69/supporthub/blob/main/src/events/interactionCreate.js) (Interaction router), [`src/utils/storage-supabase.js`](https://github.com/nayandas69/supporthub/blob/main/src/utils/storage-supabase.js) (Ticket data access), [`src/index.js`](https://github.com/nayandas69/supporthub/blob/main/src/index.js) (Bot bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_bootstrap["Bot bootstrap<br/>[index.js]"]
  node_config["Runtime config<br/>[config.js]"]
  node_interactions["Interaction router"]
end

subgraph group_ticketing["Ticket operations"]
  node_setup["Configure tickets<br/>[setup.js]"]
  node_reconfigure["Update settings<br/>[reconfigure.js]"]
  node_remove["Remove setup<br/>[remove-setup.js]"]
  node_ticket_handler["Ticket lifecycle<br/>[ticketHandler.js]"]
  node_transcripts["Ticket transcripts<br/>[ticketHandler.js]"]
end

subgraph group_persistence["Persistence"]
  node_storage["Ticket data access"]
  node_supabase_client["Supabase client<br/>[supabase.js]"]
  node_database[("PostgreSQL records")]
end

subgraph group_operations["Bot operations"]
  node_activity["Activity status<br/>[activityManager.js]"]
  node_health["Health endpoint<br/>[healthcheck.js]"]
  node_logging["Console logging<br/>[log.js]"]
end

node_admin(("Server admin"))
node_member(("Server member"))
node_discord{{"Discord platform"}}

node_admin -->|"runs commands"| node_discord
node_member -->|"uses ticket panel"| node_discord
node_discord -->|"dispatches interactions"| node_interactions
node_bootstrap -->|"loads settings"| node_config
node_bootstrap -->|"registers events"| node_interactions
node_interactions -->|"routes commands"| node_setup
node_interactions -->|"routes commands"| node_reconfigure
node_interactions -->|"routes commands"| node_remove
node_interactions -->|"routes buttons"| node_ticket_handler
node_setup -->|"saves configuration"| node_storage
node_setup -->|"creates panel"| node_ticket_handler
node_reconfigure -->|"updates configuration"| node_storage
node_remove -->|"removes records"| node_storage
node_ticket_handler -->|"reads and writes tickets"| node_storage
node_ticket_handler -->|"manages channels"| node_discord
node_ticket_handler -->|"generates history"| node_transcripts
node_ticket_handler -->|"updates status"| node_activity
node_storage -->|"runs queries"| node_supabase_client
node_supabase_client -->|"persists records"| node_database
node_bootstrap -->|"starts endpoint"| node_health
node_health -->|"reads database stats"| node_supabase_client
node_bootstrap -->|"cancels reset"| node_activity
node_bootstrap -->|"checks connection"| node_supabase_client
node_ticket_handler -->|"records events"| node_logging
node_storage -->|"records errors"| node_logging
node_health -->|"records status"| node_logging

click node_bootstrap "https://github.com/nayandas69/supporthub/blob/main/src/index.js"
click node_config "https://github.com/nayandas69/supporthub/blob/main/src/config/config.js"
click node_interactions "https://github.com/nayandas69/supporthub/blob/main/src/events/interactionCreate.js"
click node_setup "https://github.com/nayandas69/supporthub/blob/main/src/commands/setup.js"
click node_reconfigure "https://github.com/nayandas69/supporthub/blob/main/src/commands/reconfigure.js"
click node_remove "https://github.com/nayandas69/supporthub/blob/main/src/commands/remove-setup.js"
click node_ticket_handler "https://github.com/nayandas69/supporthub/blob/main/src/handlers/ticketHandler.js"
click node_transcripts "https://github.com/nayandas69/supporthub/blob/main/src/handlers/ticketHandler.js"
click node_storage "https://github.com/nayandas69/supporthub/blob/main/src/utils/storage-supabase.js"
click node_supabase_client "https://github.com/nayandas69/supporthub/blob/main/src/utils/supabase.js"
click node_database "https://github.com/nayandas69/supporthub/blob/main/db/init_supporthub_database.sql"
click node_activity "https://github.com/nayandas69/supporthub/blob/main/src/utils/activityManager.js"
click node_health "https://github.com/nayandas69/supporthub/blob/main/src/utils/healthcheck.js"
click node_logging "https://github.com/nayandas69/supporthub/blob/main/src/utils/log.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_bootstrap,node_config,node_interactions toneBlue
class node_setup,node_reconfigure,node_remove,node_ticket_handler,node_transcripts toneAmber
class node_storage,node_supabase_client,node_database,node_admin,node_member toneMint
class node_activity,node_health,node_logging toneRose
class node_discord toneIndigo
```

## Components

### Bot runtime

- [Bot bootstrap](https://github.com/nayandas69/supporthub/blob/main/src/index.js): `src/index.js`
- [Runtime config](https://github.com/nayandas69/supporthub/blob/main/src/config/config.js): `src/config/config.js`
- [Interaction router](https://github.com/nayandas69/supporthub/blob/main/src/events/interactionCreate.js): `src/events/interactionCreate.js`

### Ticket operations

- [Configure tickets](https://github.com/nayandas69/supporthub/blob/main/src/commands/setup.js): `src/commands/setup.js`
- [Update settings](https://github.com/nayandas69/supporthub/blob/main/src/commands/reconfigure.js): `src/commands/reconfigure.js`
- [Remove setup](https://github.com/nayandas69/supporthub/blob/main/src/commands/remove-setup.js): `src/commands/remove-setup.js`
- [Ticket lifecycle](https://github.com/nayandas69/supporthub/blob/main/src/handlers/ticketHandler.js): `src/handlers/ticketHandler.js`
- [Ticket transcripts](https://github.com/nayandas69/supporthub/blob/main/src/handlers/ticketHandler.js): `src/handlers/ticketHandler.js`

### Persistence

- [Ticket data access](https://github.com/nayandas69/supporthub/blob/main/src/utils/storage-supabase.js): `src/utils/storage-supabase.js`
- [Supabase client](https://github.com/nayandas69/supporthub/blob/main/src/utils/supabase.js): `src/utils/supabase.js`
- [PostgreSQL records](https://github.com/nayandas69/supporthub/blob/main/db/init_supporthub_database.sql): `db/init_supporthub_database.sql`

### Bot operations

- [Activity status](https://github.com/nayandas69/supporthub/blob/main/src/utils/activityManager.js): `src/utils/activityManager.js`
- [Health endpoint](https://github.com/nayandas69/supporthub/blob/main/src/utils/healthcheck.js): `src/utils/healthcheck.js`
- [Console logging](https://github.com/nayandas69/supporthub/blob/main/src/utils/log.js): `src/utils/log.js`

### Other components

- **Server admin**
- **Server member**
- **Discord platform**

## Connections

- Server admin → Discord platform: runs commands (evidence: `README.md`)
- Server member → Discord platform: uses ticket panel (evidence: `README.md`)
- Discord platform → Interaction router: dispatches interactions (evidence: `src/events/interactionCreate.js`)
- Bot bootstrap → Runtime config: loads settings (evidence: `src/index.js`)
- Bot bootstrap → Interaction router: registers events (evidence: `src/index.js`)
- Interaction router → Configure tickets: routes commands (evidence: `src/events/interactionCreate.js`)
- Interaction router → Update settings: routes commands (evidence: `src/events/interactionCreate.js`)
- Interaction router → Remove setup: routes commands (evidence: `src/events/interactionCreate.js`)
- Interaction router → Ticket lifecycle: routes buttons (evidence: `src/events/interactionCreate.js`)
- Configure tickets → Ticket data access: saves configuration (evidence: `src/commands/setup.js`)
- Configure tickets → Ticket lifecycle: creates panel (evidence: `src/commands/setup.js`)
- Update settings → Ticket data access: updates configuration (evidence: `src/commands/reconfigure.js`)
- Remove setup → Ticket data access: removes records (evidence: `src/commands/remove-setup.js`)
- Ticket lifecycle → Ticket data access: reads and writes tickets (evidence: `src/handlers/ticketHandler.js`)
- Ticket lifecycle → Discord platform: manages channels (evidence: `README.md`)
- Ticket lifecycle → Ticket transcripts: generates history (evidence: `README.md`)
- Ticket lifecycle → Activity status: updates status (evidence: `src/handlers/ticketHandler.js`)
- Ticket data access → Supabase client: runs queries (evidence: `src/utils/storage-supabase.js`)
- Supabase client → PostgreSQL records: persists records (evidence: `README.md`)
- Bot bootstrap → Health endpoint: starts endpoint (evidence: `src/index.js`)
- Health endpoint → Supabase client: reads database stats (evidence: `src/utils/healthcheck.js`)
- Bot bootstrap → Activity status: cancels reset (evidence: `src/index.js`)
- Bot bootstrap → Supabase client: checks connection (evidence: `src/index.js`)
- Ticket lifecycle → Console logging: records events (evidence: `src/handlers/ticketHandler.js`)
- Ticket data access → Console logging: records errors (evidence: `src/utils/storage-supabase.js`)
- Health endpoint → Console logging: records status (evidence: `src/utils/healthcheck.js`)
