# nyxxbit/discord-quest-completer architecture

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

- Interactive diagram: https://gitdiagram.com/nyxxbit/discord-quest-completer
- Repository: https://github.com/nyxxbit/discord-quest-completer

## Overview

Orion automates eligible Discord Quests through either a DevTools userscript or a Vencord plugin. The engine discovers and schedules quests, drives task-specific progress requests, and can claim rewards; the achievement path additionally authorizes the quest app, reports activity progress, and cleans up the grant. The README documents all five task types and the optional local relay for userscript achievement quests. Several engine internals are only partially excerpted, so the graph omits unverified call relationships rather than inferring them.

Main entry points: [`tasks.ts`](https://github.com/nyxxbit/discord-quest-completer/blob/main/tasks.ts) (Quest task handlers), [`orion.ts`](https://github.com/nyxxbit/discord-quest-completer/blob/main/orion.ts) (Run orchestration), [`index.tsx`](https://github.com/nyxxbit/discord-quest-completer/blob/main/index.tsx) (Vencord plugin), [`traffic.ts`](https://github.com/nyxxbit/discord-quest-completer/blob/main/traffic.ts) (Request queue)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Run entry points"]
  node_userscript["Userscript<br/>[index.js]"]
  node_plugin["Vencord plugin<br/>[index.tsx]"]
end

subgraph group_engine["Quest engine"]
  node_engine["Run orchestration<br/>[orion.ts]"]
  node_discovery["Quest discovery<br/>[questConfig.ts]"]
  node_targeting["Quest targeting<br/>[questTarget.ts]"]
  node_scheduler["Task scheduling"]
end

subgraph group_execution["Task execution"]
  node_taskhandlers["Quest task handlers<br/>[tasks.ts]"]
  node_taskcontrol["Task lifetime control<br/>[taskControl.ts]"]
  node_traffic["Request queue<br/>[traffic.ts]"]
  node_patcher["Game presence patch<br/>[patcher.ts]"]
  node_watchdog["Heartbeat watchdog"]
  node_oauth["OAuth cleanup<br/>[oauthLifecycle.ts]"]
  node_relay["Local relay<br/>[orion-relay.py]"]
end

subgraph group_support["State and integrations"]
  node_settings["Plugin settings<br/>[settings.ts]"]
  node_hooks["Settings hooks<br/>[hooks.ts]"]
  node_identity["Account identity<br/>[accountIdentity.ts]"]
  node_native["Native runtime<br/>[native.ts]"]
  node_rewards["Reward formatting<br/>[questRewards.ts]"]
end

subgraph group_companion["Companion interface"]
  node_events["Companion events<br/>[companionEvents.ts]"]
end

node_user(("Discord user"))
node_discord{{"Discord services"}}

node_user -->|"runs"| node_userscript
node_user -->|"starts"| node_plugin
node_userscript -->|"runs engine"| node_engine
node_plugin -->|"starts and controls"| node_engine
node_plugin -->|"exposes settings"| node_settings
node_settings -->|"fires changes"| node_hooks
node_plugin -->|"registers watcher"| node_hooks
node_engine -->|"loads quest config"| node_discovery
node_engine -->|"selects quests"| node_targeting
node_engine -->|"assigns task lanes"| node_scheduler
node_engine -->|"dispatches handlers"| node_taskhandlers
node_engine -->|"tracks task lifetime"| node_taskcontrol
node_taskhandlers -->|"queues requests"| node_traffic
node_traffic -->|"posts quest requests"| node_discord
node_taskhandlers -->|"patches game presence"| node_patcher
node_taskhandlers -.->|"monitors heartbeats"| node_watchdog
node_taskhandlers -->|"cleans OAuth grants"| node_oauth
node_taskhandlers -->|"authorizes quest app"| node_discord
node_taskhandlers -->|"uses for userscript bypass"| node_relay
node_relay -.->|"forwards activity requests"| node_discord
node_taskhandlers -.->|"formats reward balance"| node_rewards
node_engine -->|"emits run events"| node_events
node_patcher -->|"emits patch events"| node_events
node_traffic -->|"emits retry events"| node_events
node_plugin -.->|"reads account state"| node_identity
node_taskhandlers -.->|"uses runtime identity"| node_native

click node_userscript "https://github.com/nyxxbit/discord-quest-completer/blob/main/index.js"
click node_plugin "https://github.com/nyxxbit/discord-quest-completer/blob/main/index.tsx"
click node_engine "https://github.com/nyxxbit/discord-quest-completer/blob/main/orion.ts"
click node_discovery "https://github.com/nyxxbit/discord-quest-completer/blob/main/questConfig.ts"
click node_targeting "https://github.com/nyxxbit/discord-quest-completer/blob/main/questTarget.ts"
click node_scheduler "https://github.com/nyxxbit/discord-quest-completer/blob/main/schedulerMetadata.ts"
click node_taskhandlers "https://github.com/nyxxbit/discord-quest-completer/blob/main/tasks.ts"
click node_taskcontrol "https://github.com/nyxxbit/discord-quest-completer/blob/main/taskControl.ts"
click node_traffic "https://github.com/nyxxbit/discord-quest-completer/blob/main/traffic.ts"
click node_patcher "https://github.com/nyxxbit/discord-quest-completer/blob/main/patcher.ts"
click node_watchdog "https://github.com/nyxxbit/discord-quest-completer/blob/main/heartbeatWatchdog.ts"
click node_oauth "https://github.com/nyxxbit/discord-quest-completer/blob/main/oauthLifecycle.ts"
click node_relay "https://github.com/nyxxbit/discord-quest-completer/blob/main/tools/orion-relay/orion-relay.py"
click node_settings "https://github.com/nyxxbit/discord-quest-completer/blob/main/settings.ts"
click node_hooks "https://github.com/nyxxbit/discord-quest-completer/blob/main/hooks.ts"
click node_identity "https://github.com/nyxxbit/discord-quest-completer/blob/main/accountIdentity.ts"
click node_native "https://github.com/nyxxbit/discord-quest-completer/blob/main/native.ts"
click node_rewards "https://github.com/nyxxbit/discord-quest-completer/blob/main/questRewards.ts"
click node_events "https://github.com/nyxxbit/discord-quest-completer/blob/main/companionEvents.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_userscript,node_plugin,node_user toneBlue
class node_engine,node_discovery,node_targeting,node_scheduler toneAmber
class node_taskhandlers,node_taskcontrol,node_traffic,node_patcher,node_watchdog,node_oauth,node_relay toneMint
class node_settings,node_hooks,node_identity,node_native,node_rewards toneRose
class node_events,node_discord toneIndigo
```

## Components

### Run entry points

- [Userscript](https://github.com/nyxxbit/discord-quest-completer/blob/main/index.js): `index.js`
- [Vencord plugin](https://github.com/nyxxbit/discord-quest-completer/blob/main/index.tsx): `index.tsx`

### Quest engine

- [Run orchestration](https://github.com/nyxxbit/discord-quest-completer/blob/main/orion.ts): `orion.ts`
- [Quest discovery](https://github.com/nyxxbit/discord-quest-completer/blob/main/questConfig.ts): `questConfig.ts`
- [Quest targeting](https://github.com/nyxxbit/discord-quest-completer/blob/main/questTarget.ts): `questTarget.ts`
- [Task scheduling](https://github.com/nyxxbit/discord-quest-completer/blob/main/schedulerMetadata.ts): `schedulerMetadata.ts`

### Task execution

- [Quest task handlers](https://github.com/nyxxbit/discord-quest-completer/blob/main/tasks.ts): `tasks.ts`
- [Task lifetime control](https://github.com/nyxxbit/discord-quest-completer/blob/main/taskControl.ts): `taskControl.ts`
- [Request queue](https://github.com/nyxxbit/discord-quest-completer/blob/main/traffic.ts): `traffic.ts`
- [Game presence patch](https://github.com/nyxxbit/discord-quest-completer/blob/main/patcher.ts): `patcher.ts`
- [Heartbeat watchdog](https://github.com/nyxxbit/discord-quest-completer/blob/main/heartbeatWatchdog.ts): `heartbeatWatchdog.ts`
- [OAuth cleanup](https://github.com/nyxxbit/discord-quest-completer/blob/main/oauthLifecycle.ts): `oauthLifecycle.ts`
- [Local relay](https://github.com/nyxxbit/discord-quest-completer/blob/main/tools/orion-relay/orion-relay.py): `tools/orion-relay/orion-relay.py`

### State and integrations

- [Plugin settings](https://github.com/nyxxbit/discord-quest-completer/blob/main/settings.ts): `settings.ts`
- [Settings hooks](https://github.com/nyxxbit/discord-quest-completer/blob/main/hooks.ts): `hooks.ts`
- [Account identity](https://github.com/nyxxbit/discord-quest-completer/blob/main/accountIdentity.ts): `accountIdentity.ts`
- [Native runtime](https://github.com/nyxxbit/discord-quest-completer/blob/main/native.ts): `native.ts`
- [Reward formatting](https://github.com/nyxxbit/discord-quest-completer/blob/main/questRewards.ts): `questRewards.ts`

### Companion interface

- [Companion events](https://github.com/nyxxbit/discord-quest-completer/blob/main/companionEvents.ts): `companionEvents.ts`

### Other components

- **Discord user**
- **Discord services**

## Connections

- Discord user → Userscript: runs (evidence: `README.md`)
- Discord user → Vencord plugin: starts (evidence: `README.md`)
- Userscript → Run orchestration: runs engine (evidence: `README.md`)
- Vencord plugin → Run orchestration: starts and controls (evidence: `index.tsx`)
- Vencord plugin → Plugin settings: exposes settings (evidence: `settings.ts`)
- Plugin settings → Settings hooks: fires changes (evidence: `settings.ts`)
- Vencord plugin → Settings hooks: registers watcher (evidence: `index.tsx`)
- Run orchestration → Quest discovery: loads quest config (evidence: `orion.ts`)
- Run orchestration → Quest targeting: selects quests (evidence: `orion.ts`)
- Run orchestration → Task scheduling: assigns task lanes (evidence: `orion.ts`)
- Run orchestration → Quest task handlers: dispatches handlers (evidence: `orion.ts`)
- Run orchestration → Task lifetime control: tracks task lifetime (evidence: `orion.ts`)
- Quest task handlers → Request queue: queues requests (evidence: `tasks.ts`)
- Request queue → Discord services: posts quest requests (evidence: `traffic.ts`)
- Quest task handlers → Game presence patch: patches game presence (evidence: `tasks.ts`)
- Quest task handlers → Heartbeat watchdog: monitors heartbeats (evidence: `tasks.ts`)
- Quest task handlers → OAuth cleanup: cleans OAuth grants (evidence: `tasks.ts`)
- Quest task handlers → Discord services: authorizes quest app (evidence: `README.md`)
- Quest task handlers → Local relay: uses for userscript bypass (evidence: `README.md`)
- Local relay → Discord services: forwards activity requests
- Quest task handlers → Reward formatting: formats reward balance
- Run orchestration → Companion events: emits run events (evidence: `orion.ts`)
- Game presence patch → Companion events: emits patch events (evidence: `patcher.ts`)
- Request queue → Companion events: emits retry events (evidence: `traffic.ts`)
- Vencord plugin → Account identity: reads account state
- Quest task handlers → Native runtime: uses runtime identity (evidence: `tasks.ts`)
