# xhelio/dummydreams-discord-bot architecture

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

- Interactive diagram: https://gitdiagram.com/xhelio/dummydreams-discord-bot
- Repository: https://github.com/xhelio/dummydreams-discord-bot

## Overview

This repository is primarily a Discord bot for monitoring TikTok Live accounts, announcing live-state changes, verifying users, and administering tracked hosts and bot settings. The main workflow runs through the bot and observer, persists activity and session state, and exposes management and API routes through Flask. The tree also contains a separate React component-preview sandbox and a small Express health API; their relationship to the bot is not shown. Several connections below are limited to SOURCE INDEX references and sampled excerpts.

Main entry points: [`main.py`](https://github.com/xhelio/dummydreams-discord-bot/blob/main/main.py) (Bot orchestration), [`observer.py`](https://github.com/xhelio/dummydreams-discord-bot/blob/main/observer.py) (Live observer), [`routes/admin.py`](https://github.com/xhelio/dummydreams-discord-bot/blob/main/routes/admin.py) (Admin dashboard), [`db.py`](https://github.com/xhelio/dummydreams-discord-bot/blob/main/db.py) (Persistent data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bot["Bot runtime"]
  node_main["Bot orchestration<br/>[main.py]"]
  node_chatbot["Chat handling<br/>[chatbot.py]"]
  node_verification["User verification<br/>[verification.py]"]
  node_timed["Timed tasks<br/>[timed_executor.py]"]
end

subgraph group_monitor["Live monitoring"]
  node_observer["Live observer<br/>[observer.py]"]
  node_parser["Live event parser"]
end

subgraph group_web["Web management"]
  node_webserver["Flask server<br/>[server.py]"]
  node_admin["Admin dashboard<br/>[admin.py]"]
  node_api["Bot API<br/>[api.py]"]
  node_settings["Settings panel<br/>[settings.py]"]
  node_qa["QA routes<br/>[qa.py]"]
  node_styles["Dashboard rendering<br/>[styles.py]"]
end

subgraph group_state["State and diagnostics"]
  node_database[("Persistent data<br/>[db.py]")]
  node_runtime["Runtime status<br/>[runtime_status.py]"]
  node_logging["Logging<br/>[log_setup.py]"]
end

subgraph group_tools["Separate preview services"]
  node_preview["Component preview<br/>[App.tsx]"]
  node_apiapp["Health API app<br/>[app.ts]"]
  node_apilog["API logger<br/>[logger.ts]"]
end

node_discord(("Discord users"))
node_tiktok(("TikTok Live"))

node_discord -->|"interacts with"| node_main
node_main -->|"starts observer"| node_observer
node_observer -->|"parses events"| node_parser
node_observer -->|"reads and writes"| node_database
node_observer -->|"updates diagnostics"| node_runtime
node_main -->|"handles chat"| node_chatbot
node_main -->|"runs verification"| node_verification
node_main -->|"uses scheduler"| node_timed
node_main -->|"reads and writes"| node_database
node_main -->|"updates status"| node_runtime
node_main -->|"configures logging"| node_logging
node_tiktok -.->|"provides live events"| node_observer
node_webserver -->|"registers routes"| node_admin
node_webserver -->|"registers routes"| node_api
node_webserver -->|"registers routes"| node_settings
node_webserver -->|"registers routes"| node_qa
node_admin -->|"reads and writes"| node_database
node_admin -->|"reads status"| node_runtime
node_admin -->|"requests verification"| node_verification
node_admin -->|"reads monitor state"| node_observer
node_admin -->|"uses styles"| node_styles
node_settings -->|"reads and writes"| node_database
node_settings -->|"uses styles"| node_styles
node_api -->|"reads state"| node_database
node_api -->|"reads status"| node_runtime
node_api -->|"dispatches announcement"| node_observer
node_preview -.->|"serves workspace previews"| node_discord
node_apiapp -->|"configures request logging"| node_apilog

click node_main "https://github.com/xhelio/dummydreams-discord-bot/blob/main/main.py"
click node_chatbot "https://github.com/xhelio/dummydreams-discord-bot/blob/main/chatbot.py"
click node_verification "https://github.com/xhelio/dummydreams-discord-bot/blob/main/verification.py"
click node_observer "https://github.com/xhelio/dummydreams-discord-bot/blob/main/observer.py"
click node_parser "https://github.com/xhelio/dummydreams-discord-bot/blob/main/tiktoklive_parser.py"
click node_timed "https://github.com/xhelio/dummydreams-discord-bot/blob/main/timed_executor.py"
click node_webserver "https://github.com/xhelio/dummydreams-discord-bot/blob/main/server.py"
click node_admin "https://github.com/xhelio/dummydreams-discord-bot/blob/main/routes/admin.py"
click node_api "https://github.com/xhelio/dummydreams-discord-bot/blob/main/routes/api.py"
click node_settings "https://github.com/xhelio/dummydreams-discord-bot/blob/main/routes/settings.py"
click node_qa "https://github.com/xhelio/dummydreams-discord-bot/blob/main/routes/qa.py"
click node_database "https://github.com/xhelio/dummydreams-discord-bot/blob/main/db.py"
click node_runtime "https://github.com/xhelio/dummydreams-discord-bot/blob/main/runtime_status.py"
click node_logging "https://github.com/xhelio/dummydreams-discord-bot/blob/main/log_setup.py"
click node_styles "https://github.com/xhelio/dummydreams-discord-bot/blob/main/styles.py"
click node_preview "https://github.com/xhelio/dummydreams-discord-bot/blob/main/artifacts/mockup-sandbox/src/App.tsx"
click node_apiapp "https://github.com/xhelio/dummydreams-discord-bot/blob/main/artifacts/api-server/src/app.ts"
click node_apilog "https://github.com/xhelio/dummydreams-discord-bot/blob/main/artifacts/api-server/src/lib/logger.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_main,node_chatbot,node_verification,node_timed,node_discord toneBlue
class node_observer,node_parser toneAmber
class node_webserver,node_admin,node_api,node_settings,node_qa,node_styles toneMint
class node_database,node_runtime,node_logging toneRose
class node_preview,node_apiapp,node_apilog,node_tiktok toneIndigo
```

## Components

### Bot runtime

- [Bot orchestration](https://github.com/xhelio/dummydreams-discord-bot/blob/main/main.py): `main.py`
- [Chat handling](https://github.com/xhelio/dummydreams-discord-bot/blob/main/chatbot.py): `chatbot.py`
- [User verification](https://github.com/xhelio/dummydreams-discord-bot/blob/main/verification.py): `verification.py`
- [Timed tasks](https://github.com/xhelio/dummydreams-discord-bot/blob/main/timed_executor.py): `timed_executor.py`

### Live monitoring

- [Live observer](https://github.com/xhelio/dummydreams-discord-bot/blob/main/observer.py): `observer.py`
- [Live event parser](https://github.com/xhelio/dummydreams-discord-bot/blob/main/tiktoklive_parser.py): `tiktoklive_parser.py`

### Web management

- [Flask server](https://github.com/xhelio/dummydreams-discord-bot/blob/main/server.py): `server.py`
- [Admin dashboard](https://github.com/xhelio/dummydreams-discord-bot/blob/main/routes/admin.py): `routes/admin.py`
- [Bot API](https://github.com/xhelio/dummydreams-discord-bot/blob/main/routes/api.py): `routes/api.py`
- [Settings panel](https://github.com/xhelio/dummydreams-discord-bot/blob/main/routes/settings.py): `routes/settings.py`
- [QA routes](https://github.com/xhelio/dummydreams-discord-bot/blob/main/routes/qa.py): `routes/qa.py`
- [Dashboard rendering](https://github.com/xhelio/dummydreams-discord-bot/blob/main/styles.py): `styles.py`

### State and diagnostics

- [Persistent data](https://github.com/xhelio/dummydreams-discord-bot/blob/main/db.py): `db.py`
- [Runtime status](https://github.com/xhelio/dummydreams-discord-bot/blob/main/runtime_status.py): `runtime_status.py`
- [Logging](https://github.com/xhelio/dummydreams-discord-bot/blob/main/log_setup.py): `log_setup.py`

### Separate preview services

- [Component preview](https://github.com/xhelio/dummydreams-discord-bot/blob/main/artifacts/mockup-sandbox/src/App.tsx): `artifacts/mockup-sandbox/src/App.tsx`
- [Health API app](https://github.com/xhelio/dummydreams-discord-bot/blob/main/artifacts/api-server/src/app.ts): `artifacts/api-server/src/app.ts`
- [API logger](https://github.com/xhelio/dummydreams-discord-bot/blob/main/artifacts/api-server/src/lib/logger.ts): `artifacts/api-server/src/lib/logger.ts`

### Other components

- **Discord users**
- **TikTok Live**

## Connections

- Discord users → Bot orchestration: interacts with (evidence: `main.py`)
- Bot orchestration → Live observer: starts observer (evidence: `main.py`)
- Live observer → Live event parser: parses events (evidence: `observer.py`)
- Live observer → Persistent data: reads and writes (evidence: `observer.py`)
- Live observer → Runtime status: updates diagnostics (evidence: `observer.py`)
- Bot orchestration → Chat handling: handles chat (evidence: `main.py`)
- Bot orchestration → User verification: runs verification (evidence: `main.py`)
- Bot orchestration → Timed tasks: uses scheduler (evidence: `main.py`)
- Bot orchestration → Persistent data: reads and writes (evidence: `main.py`)
- Bot orchestration → Runtime status: updates status (evidence: `main.py`)
- Bot orchestration → Logging: configures logging (evidence: `main.py`)
- TikTok Live → Live observer: provides live events
- Flask server → Admin dashboard: registers routes (evidence: `server.py`)
- Flask server → Bot API: registers routes (evidence: `server.py`)
- Flask server → Settings panel: registers routes (evidence: `server.py`)
- Flask server → QA routes: registers routes (evidence: `server.py`)
- Admin dashboard → Persistent data: reads and writes (evidence: `routes/admin.py`)
- Admin dashboard → Runtime status: reads status (evidence: `routes/admin.py`)
- Admin dashboard → User verification: requests verification (evidence: `routes/admin.py`)
- Admin dashboard → Live observer: reads monitor state (evidence: `routes/admin.py`)
- Admin dashboard → Dashboard rendering: uses styles (evidence: `routes/admin.py`)
- Settings panel → Persistent data: reads and writes (evidence: `routes/settings.py`)
- Settings panel → Dashboard rendering: uses styles (evidence: `routes/settings.py`)
- Bot API → Persistent data: reads state (evidence: `routes/api.py`)
- Bot API → Runtime status: reads status (evidence: `routes/api.py`)
- Bot API → Live observer: dispatches announcement (evidence: `routes/api.py`)
- Component preview → Discord users: serves workspace previews
- Health API app → API logger: configures request logging (evidence: `artifacts/api-server/src/app.ts`)
