# drakomichael/streamchatrelay architecture

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

- Interactive diagram: https://gitdiagram.com/drakomichael/streamchatrelay
- Repository: https://github.com/drakomichael/streamchatrelay

## Overview

Stream Chat Relay centralizes live-chat messages, analyzes them, persists a local log, and broadcasts them to connected dashboard clients. The documented path runs from `src/index.js` through settings and application bootstrap into the WebSocket service; the WebSocket normalizes each message, records analysis and log data, then broadcasts it. Express exposes the dashboard and APIs, while Twitch connectivity and a development spam generator are additional capabilities. The Angular workspace is an evolving alternative UI. Relationships follow the README’s workflow and sampled modules; unsampled subsystem wiring is omitted.

Main entry points: [`src/services/app/bootstrapApp.js`](https://github.com/drakomichael/streamchatrelay/blob/main/src/services/app/bootstrapApp.js) (App bootstrap), [`src/services/websocket/websocket_bootstrap.js`](https://github.com/drakomichael/streamchatrelay/blob/main/src/services/websocket/websocket_bootstrap.js) (WebSocket server), [`src/services/websocket/ws_functions.js`](https://github.com/drakomichael/streamchatrelay/blob/main/src/services/websocket/ws_functions.js) (Message handling), [`src/services/webmanager/express_bootstrap.js`](https://github.com/drakomichael/streamchatrelay/blob/main/src/services/webmanager/express_bootstrap.js) (HTTP server and API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and settings"]
  node_entry["Application entry<br/>[index.js]"]
  node_settings["Settings loader<br/>[loadsettings.js]"]
  node_config["Config store<br/>[configStore.js]"]
  node_bootstrap["App bootstrap<br/>[bootstrapApp.js]"]
end

subgraph group_messaging["Message pipeline"]
  node_wsserver["WebSocket server"]
  node_wsfunctions["Message handling<br/>[ws_functions.js]"]
  node_analysis["Message analysis<br/>[messageAnalysis.js]"]
  node_datacontrol["Log control<br/>[dataControl.js]"]
  node_logfile["Message log<br/>[chat_log.txt]"]
  node_sqlite[("SQLite storage<br/>[databaseHUB.js]")]
end

subgraph group_web["Web interface"]
  node_express["HTTP server and API"]
  node_dashboard["Legacy dashboard<br/>[scripts.js]"]
  node_angular["Angular UI<br/>[app.ts]"]
end

subgraph group_integrations["External and satellite services"]
  node_twitch(("Twitch platform"))
  node_twitchconn["Twitch connection"]
  node_spam["Dev spam generator"]
  node_spamservice["Spam service"]
end

node_client(("Chat client"))

node_entry -->|"loads settings"| node_settings
node_settings -->|"reads config"| node_config
node_settings -->|"starts app"| node_bootstrap
node_bootstrap -->|"starts WebSocket"| node_wsserver
node_client -->|"sends messages"| node_wsserver
node_wsserver -->|"dispatches events"| node_wsfunctions
node_wsfunctions -->|"registers messages"| node_analysis
node_wsfunctions -->|"records messages"| node_datacontrol
node_datacontrol -->|"writes log"| node_logfile
node_wsfunctions -->|"broadcasts messages"| node_client
node_bootstrap -->|"starts HTTP"| node_express
node_express -->|"serves dashboard"| node_dashboard
node_dashboard -->|"receives events"| node_wsserver
node_dashboard -->|"requests analysis"| node_express
node_express -->|"reads summary"| node_analysis
node_bootstrap -.->|"initializes optionally"| node_sqlite
node_bootstrap -.->|"initializes optionally"| node_twitchconn
node_twitchconn -.->|"connects"| node_twitch
node_bootstrap -.->|"enables in dev"| node_spam
node_spam -.->|"starts generation"| node_spamservice
node_spamservice -.->|"sends messages"| node_wsserver

click node_entry "https://github.com/drakomichael/streamchatrelay/blob/main/src/index.js"
click node_settings "https://github.com/drakomichael/streamchatrelay/blob/main/src/services/settings/loadsettings.js"
click node_config "https://github.com/drakomichael/streamchatrelay/blob/main/src/services/settings/configStore.js"
click node_bootstrap "https://github.com/drakomichael/streamchatrelay/blob/main/src/services/app/bootstrapApp.js"
click node_wsserver "https://github.com/drakomichael/streamchatrelay/blob/main/src/services/websocket/websocket_bootstrap.js"
click node_wsfunctions "https://github.com/drakomichael/streamchatrelay/blob/main/src/services/websocket/ws_functions.js"
click node_analysis "https://github.com/drakomichael/streamchatrelay/blob/main/src/services/dataAnalysis/messageAnalysis.js"
click node_datacontrol "https://github.com/drakomichael/streamchatrelay/blob/main/src/services/dataControl/dataControl.js"
click node_logfile "https://github.com/drakomichael/streamchatrelay/blob/main/src/logs/chat_log.txt"
click node_sqlite "https://github.com/drakomichael/streamchatrelay/blob/main/src/services/dataBase/databaseHUB.js"
click node_express "https://github.com/drakomichael/streamchatrelay/blob/main/src/services/webmanager/express_bootstrap.js"
click node_dashboard "https://github.com/drakomichael/streamchatrelay/blob/main/src/public/scripts.js"
click node_angular "https://github.com/drakomichael/streamchatrelay/blob/main/frontend/src/app/app.ts"
click node_twitchconn "https://github.com/drakomichael/streamchatrelay/blob/main/src/services/externalConnections/twitch/handleTwitchConnection.js"
click node_spam "https://github.com/drakomichael/streamchatrelay/blob/main/modules/service_spamChatBot/spammer.deprecated.js"
click node_spamservice "https://github.com/drakomichael/streamchatrelay/blob/main/modules/service_spamChatBot/src/services/SpamOrchestratorService.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_entry,node_settings,node_config,node_bootstrap,node_client toneBlue
class node_wsserver,node_wsfunctions,node_analysis,node_datacontrol,node_logfile,node_sqlite toneAmber
class node_express,node_dashboard,node_angular toneMint
class node_twitch,node_twitchconn,node_spam,node_spamservice toneRose
```

## Components

### Runtime and settings

- [Application entry](https://github.com/drakomichael/streamchatrelay/blob/main/src/index.js): `src/index.js`
- [Settings loader](https://github.com/drakomichael/streamchatrelay/blob/main/src/services/settings/loadsettings.js): `src/services/settings/loadsettings.js`
- [Config store](https://github.com/drakomichael/streamchatrelay/blob/main/src/services/settings/configStore.js): `src/services/settings/configStore.js`
- [App bootstrap](https://github.com/drakomichael/streamchatrelay/blob/main/src/services/app/bootstrapApp.js): `src/services/app/bootstrapApp.js`

### Message pipeline

- [WebSocket server](https://github.com/drakomichael/streamchatrelay/blob/main/src/services/websocket/websocket_bootstrap.js): `src/services/websocket/websocket_bootstrap.js`
- [Message handling](https://github.com/drakomichael/streamchatrelay/blob/main/src/services/websocket/ws_functions.js): `src/services/websocket/ws_functions.js`
- [Message analysis](https://github.com/drakomichael/streamchatrelay/blob/main/src/services/dataAnalysis/messageAnalysis.js): `src/services/dataAnalysis/messageAnalysis.js`
- [Log control](https://github.com/drakomichael/streamchatrelay/blob/main/src/services/dataControl/dataControl.js): `src/services/dataControl/dataControl.js`
- [Message log](https://github.com/drakomichael/streamchatrelay/blob/main/src/logs/chat_log.txt): `src/logs/chat_log.txt`
- [SQLite storage](https://github.com/drakomichael/streamchatrelay/blob/main/src/services/dataBase/databaseHUB.js): `src/services/dataBase/databaseHUB.js`

### Web interface

- [HTTP server and API](https://github.com/drakomichael/streamchatrelay/blob/main/src/services/webmanager/express_bootstrap.js): `src/services/webmanager/express_bootstrap.js`
- [Legacy dashboard](https://github.com/drakomichael/streamchatrelay/blob/main/src/public/scripts.js): `src/public/scripts.js`
- [Angular UI](https://github.com/drakomichael/streamchatrelay/blob/main/frontend/src/app/app.ts): `frontend/src/app/app.ts`

### External and satellite services

- **Twitch platform**
- [Twitch connection](https://github.com/drakomichael/streamchatrelay/blob/main/src/services/externalConnections/twitch/handleTwitchConnection.js): `src/services/externalConnections/twitch/handleTwitchConnection.js`
- [Dev spam generator](https://github.com/drakomichael/streamchatrelay/blob/main/modules/service_spamChatBot/spammer.deprecated.js): `modules/service_spamChatBot/spammer.deprecated.js`
- [Spam service](https://github.com/drakomichael/streamchatrelay/blob/main/modules/service_spamChatBot/src/services/SpamOrchestratorService.js): `modules/service_spamChatBot/src/services/SpamOrchestratorService.js`

### Other components

- **Chat client**

## Connections

- Application entry → Settings loader: loads settings
- Settings loader → Config store: reads config
- Settings loader → App bootstrap: starts app
- App bootstrap → WebSocket server: starts WebSocket
- Chat client → WebSocket server: sends messages
- WebSocket server → Message handling: dispatches events
- Message handling → Message analysis: registers messages
- Message handling → Log control: records messages
- Log control → Message log: writes log
- Message handling → Chat client: broadcasts messages
- App bootstrap → HTTP server and API: starts HTTP
- HTTP server and API → Legacy dashboard: serves dashboard
- Legacy dashboard → WebSocket server: receives events
- Legacy dashboard → HTTP server and API: requests analysis
- HTTP server and API → Message analysis: reads summary
- App bootstrap → SQLite storage: initializes optionally
- App bootstrap → Twitch connection: initializes optionally
- Twitch connection → Twitch platform: connects
- App bootstrap → Dev spam generator: enables in dev
- Dev spam generator → Spam service: starts generation
- Spam service → WebSocket server: sends messages
