# euno-hq/discord architecture

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

- Interactive diagram: https://gitdiagram.com/euno-hq/discord
- Repository: https://github.com/euno-hq/discord

## Overview

Euno is a Discord moderation bot with an accompanying web application. Its main user workflow is Discord activity or moderation commands entering bot handlers, which analyze or resolve the event and apply moderation actions or record reports. The code also includes a web portal, background jobs, analytics, and persistence. The graph emphasizes relationships directly shown in excerpts or the SOURCE INDEX; some documented capabilities have no verified runtime links in the available evidence.

Main entry points: [`app/features/spam/service.ts`](https://github.com/euno-hq/discord/blob/main/app/features/spam/service.ts) (Spam Detection), [`app/server.ts`](https://github.com/euno-hq/discord/blob/main/app/server.ts) (HTTP Server), [`app/features/spam/spamResponseHandler.ts`](https://github.com/euno-hq/discord/blob/main/app/features/spam/spamResponseHandler.ts) (Spam Responses), [`app/commands/escalate/handlers.ts`](https://github.com/euno-hq/discord/blob/main/app/commands/escalate/handlers.ts) (Escalation Handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot Runtime"]
  node_server["HTTP Server<br/>[server.ts]"]
  node_runtime_init["Runtime Setup<br/>[AppRuntime.ts]"]
end

subgraph group_moderation["Moderation"]
  node_commands["Bot Commands"]
  node_escalation_handlers["Escalation Handlers<br/>[handlers.ts]"]
  node_escalation_service["Escalation Service<br/>[service.ts]"]
  node_escalation_ui["Vote Messages<br/>[strings.ts]"]
  node_setup["Guild Setup<br/>[setupAll.server.ts]"]
  node_reports["Report Logging<br/>[userLog.ts]"]
end

subgraph group_spam["Spam Detection"]
  node_spam_service["Spam Detection<br/>[service.ts]"]
  node_spam_analyzers["Spam Analyzers<br/>[contentAnalyzer.ts]"]
  node_activity_tracker["Activity Tracker"]
  node_spam_scoring["Verdict Scoring<br/>[spamScorer.ts]"]
  node_spam_response["Spam Responses"]
end

subgraph group_web["Web Portal"]
  node_web_routes["Web Routes"]
  node_admin["Admin Features"]
  node_stripe_webhook["Stripe Webhooks"]
end

subgraph group_platform["Data and Operations"]
  node_jobs["Background Jobs<br/>[jobRunner.ts]"]
  node_database[("SQLite Database<br/>[Database.ts]")]
  node_observability["Observability<br/>[observability.ts]"]
end

node_discord(("Discord"))

node_server -->|"warms runtime"| node_runtime_init
node_discord -->|"sends interactions"| node_server
node_server -->|"registers commands"| node_commands
node_escalation_handlers -->|"resolves actions"| node_escalation_service
node_escalation_handlers -->|"builds vote UI"| node_escalation_ui
node_escalation_service -->|"reads and writes"| node_database
node_spam_service -->|"runs analysis"| node_spam_analyzers
node_spam_service -->|"tracks activity"| node_activity_tracker
node_spam_service -->|"computes verdict"| node_spam_scoring
node_spam_service -->|"executes response"| node_spam_response
node_spam_response -->|"logs messages"| node_reports
node_spam_response -->|"records reports"| node_database
node_spam_service -->|"logs detection"| node_observability
node_server -->|"logs startup"| node_observability

click node_server "https://github.com/euno-hq/discord/blob/main/app/server.ts"
click node_runtime_init "https://github.com/euno-hq/discord/blob/main/app/AppRuntime.ts"
click node_commands "https://github.com/euno-hq/discord/tree/main/app/commands"
click node_escalation_handlers "https://github.com/euno-hq/discord/blob/main/app/commands/escalate/handlers.ts"
click node_escalation_service "https://github.com/euno-hq/discord/blob/main/app/commands/escalate/service.ts"
click node_escalation_ui "https://github.com/euno-hq/discord/blob/main/app/commands/escalate/strings.ts"
click node_setup "https://github.com/euno-hq/discord/blob/main/app/helpers/setupAll.server.ts"
click node_spam_service "https://github.com/euno-hq/discord/blob/main/app/features/spam/service.ts"
click node_spam_analyzers "https://github.com/euno-hq/discord/blob/main/app/features/spam/contentAnalyzer.ts"
click node_activity_tracker "https://github.com/euno-hq/discord/blob/main/app/features/spam/recentActivityTracker.ts"
click node_spam_scoring "https://github.com/euno-hq/discord/blob/main/app/features/spam/spamScorer.ts"
click node_spam_response "https://github.com/euno-hq/discord/blob/main/app/features/spam/spamResponseHandler.ts"
click node_web_routes "https://github.com/euno-hq/discord/tree/main/app/routes"
click node_admin "https://github.com/euno-hq/discord/tree/main/app/features/Admin"
click node_stripe_webhook "https://github.com/euno-hq/discord/blob/main/app/routes/webhooks.stripe.server.ts"
click node_jobs "https://github.com/euno-hq/discord/blob/main/app/jobs/jobRunner.ts"
click node_database "https://github.com/euno-hq/discord/blob/main/app/Database.ts"
click node_observability "https://github.com/euno-hq/discord/blob/main/app/effects/observability.ts"
click node_reports "https://github.com/euno-hq/discord/blob/main/app/commands/report/userLog.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_server,node_runtime_init toneBlue
class node_commands,node_escalation_handlers,node_escalation_service,node_escalation_ui,node_setup,node_reports toneAmber
class node_spam_service,node_spam_analyzers,node_activity_tracker,node_spam_scoring,node_spam_response toneMint
class node_web_routes,node_admin,node_stripe_webhook toneRose
class node_jobs,node_database,node_observability,node_discord toneIndigo
```

## Components

### Bot Runtime

- [HTTP Server](https://github.com/euno-hq/discord/blob/main/app/server.ts): `app/server.ts`
- [Runtime Setup](https://github.com/euno-hq/discord/blob/main/app/AppRuntime.ts): `app/AppRuntime.ts`

### Moderation

- [Bot Commands](https://github.com/euno-hq/discord/tree/main/app/commands): `app/commands`
- [Escalation Handlers](https://github.com/euno-hq/discord/blob/main/app/commands/escalate/handlers.ts): `app/commands/escalate/handlers.ts`
- [Escalation Service](https://github.com/euno-hq/discord/blob/main/app/commands/escalate/service.ts): `app/commands/escalate/service.ts`
- [Vote Messages](https://github.com/euno-hq/discord/blob/main/app/commands/escalate/strings.ts): `app/commands/escalate/strings.ts`
- [Guild Setup](https://github.com/euno-hq/discord/blob/main/app/helpers/setupAll.server.ts): `app/helpers/setupAll.server.ts`
- [Report Logging](https://github.com/euno-hq/discord/blob/main/app/commands/report/userLog.ts): `app/commands/report/userLog.ts`

### Spam Detection

- [Spam Detection](https://github.com/euno-hq/discord/blob/main/app/features/spam/service.ts): `app/features/spam/service.ts`
- [Spam Analyzers](https://github.com/euno-hq/discord/blob/main/app/features/spam/contentAnalyzer.ts): `app/features/spam/contentAnalyzer.ts`
- [Activity Tracker](https://github.com/euno-hq/discord/blob/main/app/features/spam/recentActivityTracker.ts): `app/features/spam/recentActivityTracker.ts`
- [Verdict Scoring](https://github.com/euno-hq/discord/blob/main/app/features/spam/spamScorer.ts): `app/features/spam/spamScorer.ts`
- [Spam Responses](https://github.com/euno-hq/discord/blob/main/app/features/spam/spamResponseHandler.ts): `app/features/spam/spamResponseHandler.ts`

### Web Portal

- [Web Routes](https://github.com/euno-hq/discord/tree/main/app/routes): `app/routes`
- [Admin Features](https://github.com/euno-hq/discord/tree/main/app/features/Admin): `app/features/Admin`
- [Stripe Webhooks](https://github.com/euno-hq/discord/blob/main/app/routes/webhooks.stripe.server.ts): `app/routes/webhooks.stripe.server.ts`

### Data and Operations

- [Background Jobs](https://github.com/euno-hq/discord/blob/main/app/jobs/jobRunner.ts): `app/jobs/jobRunner.ts`
- [SQLite Database](https://github.com/euno-hq/discord/blob/main/app/Database.ts): `app/Database.ts`
- [Observability](https://github.com/euno-hq/discord/blob/main/app/effects/observability.ts): `app/effects/observability.ts`

### Other components

- **Discord**

## Connections

- HTTP Server → Runtime Setup: warms runtime (evidence: `app/server.ts`)
- Discord → HTTP Server: sends interactions (evidence: `app/server.ts`)
- HTTP Server → Bot Commands: registers commands (evidence: `app/server.ts`)
- Escalation Handlers → Escalation Service: resolves actions (evidence: `app/commands/escalate/handlers.ts`)
- Escalation Handlers → Vote Messages: builds vote UI (evidence: `app/commands/escalate/handlers.ts`)
- Escalation Service → SQLite Database: reads and writes (evidence: `app/commands/escalate/service.ts`)
- Spam Detection → Spam Analyzers: runs analysis (evidence: `app/features/spam/service.ts`)
- Spam Detection → Activity Tracker: tracks activity (evidence: `app/features/spam/service.ts`)
- Spam Detection → Verdict Scoring: computes verdict (evidence: `app/features/spam/service.ts`)
- Spam Detection → Spam Responses: executes response (evidence: `app/features/spam/service.ts`)
- Spam Responses → Report Logging: logs messages (evidence: `app/features/spam/spamResponseHandler.ts`)
- Spam Responses → SQLite Database: records reports (evidence: `app/features/spam/spamResponseHandler.ts`)
- Spam Detection → Observability: logs detection (evidence: `app/features/spam/service.ts`)
- HTTP Server → Observability: logs startup (evidence: `app/server.ts`)
