# kernelpanic-studios/dropwatch architecture

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

- Interactive diagram: https://gitdiagram.com/kernelpanic-studios/dropwatch
- Repository: https://github.com/kernelpanic-studios/dropwatch

## Overview

Dropwatch is a background Twitch Drops and channel-points miner with a web dashboard. The workflow is: authenticate a Twitch account, run the mining service, refresh campaign and live-channel data, plan and watch eligible streams, claim rewards, persist activity, and expose status and controls through the dashboard. README capabilities also include priorities and pins, favourite-channel points and streaks, history, notifications, backups, and proxy checks. Several of these feature implementations were not excerpted; their subsystem nodes are retained from the repository tree, while uncertain connections are omitted. The reference Twitch implementation is shown separately from the main runtime.

Main entry points: [`src/dropwatch/runner.py`](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/runner.py) (Mining runner), [`src/dropwatch/api/app.py`](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/api/app.py) (HTTP API), [`src/dropwatch/service.py`](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/service.py) (Mining service), [`src/dropwatch/twitch/gql.py`](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/gql.py) (GraphQL operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Mining runtime"]
  node_entry["Application entry<br/>[__main__.py]"]
  node_service["Mining service<br/>[service.py]"]
  node_runner["Mining runner<br/>[runner.py]"]
  node_planner["Campaign planner<br/>[planner.py]"]
  node_events["Runtime events<br/>[events.py]"]
end

subgraph group_twitch["Twitch integration"]
  node_auth["Twitch sign-in<br/>[auth_device.py]"]
  node_catalog["Campaign catalog<br/>[catalog.py]"]
  node_twitchclient["Twitch client<br/>[client.py]"]
  node_gql["GraphQL operations<br/>[gql.py]"]
  node_pubsub["Twitch PubSub<br/>[pubsub.py]"]
  node_watch["Stream watching<br/>[watch.py]"]
  node_transport["HTTP transport<br/>[transport.py]"]
  node_session["Twitch session<br/>[session.py]"]
end

subgraph group_data["Persistence and operations"]
  node_store[("Application store<br/>[store.py]")]
  node_models["Domain models<br/>[models.py]"]
  node_alerts["Notifications<br/>[alerts.py]"]
  node_backup["Backup and restore<br/>[backup.py]"]
end

subgraph group_api["API and dashboard"]
  node_apiapp["HTTP API<br/>[app.py]"]
  node_apimodels["API schemas<br/>[models.py]"]
  node_webclient["Dashboard API client<br/>[client.ts]"]
  node_webstore["Dashboard state<br/>[store.tsx]"]
  node_router["Dashboard routing<br/>[router.ts]"]
  node_dashboard["Dashboard views"]
  node_connect["Twitch connect screen<br/>[Connect.tsx]"]
  node_uiicons["Dashboard icons<br/>[Icons.tsx]"]
end

subgraph group_reference["Protocol reference"]
  node_protocolref["Reference Twitch client<br/>[twitch.py]"]
end

node_user(("Dropwatch operator"))
node_operator(("Operator browser"))
node_twitchservice["Twitch service"]

node_user -->|"uses dashboard"| node_operator
node_entry -.->|"starts"| node_service
node_service -->|"builds and runs"| node_runner
node_service -->|"publishes events"| node_events
node_service -->|"handles events"| node_pubsub
node_service -->|"builds parts"| node_twitchclient
node_service -->|"builds parts"| node_catalog
node_runner -->|"plans campaigns"| node_planner
node_runner -->|"uses domain data"| node_models
node_runner -->|"fetches and claims"| node_gql
node_runner -->|"handles updates"| node_pubsub
node_runner -->|"emits activity"| node_events
node_runner -.->|"reads preferences"| node_store
node_twitchclient -->|"queries"| node_gql
node_gql -->|"uses session"| node_session
node_gql -->|"sends requests"| node_transport
node_auth -->|"creates session"| node_session
node_auth -->|"sends auth requests"| node_transport
node_user -->|"authorizes Twitch"| node_auth
node_watch -.->|"watches streams"| node_twitchservice
node_runner -.->|"assigns watchers"| node_watch
node_twitchclient -.->|"requests Twitch data"| node_twitchservice
node_apiapp -->|"reads and writes"| node_store
node_apiapp -->|"replans miner"| node_runner
node_apiapp -->|"restores backup"| node_backup
node_apiapp -->|"validates responses"| node_apimodels
node_apiapp -->|"accesses service"| node_service
node_store -->|"persists domain data"| node_models
node_store -->|"persists session"| node_session
node_apiapp -.->|"configures notifications"| node_alerts
node_operator -.->|"controls miner"| node_webclient
node_webclient -.->|"calls HTTP API"| node_apiapp
node_webstore -->|"loads API data"| node_webclient
node_dashboard -.->|"renders state"| node_webstore
node_connect -->|"submits sign-in"| node_webclient
node_dashboard -.->|"uses routes"| node_router
node_dashboard -.->|"renders icons"| node_uiicons
node_protocolref -.->|"informs protocol"| node_twitchservice

click node_entry "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/__main__.py"
click node_service "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/service.py"
click node_runner "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/runner.py"
click node_planner "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/planner.py"
click node_events "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/events.py"
click node_auth "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/auth_device.py"
click node_catalog "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/catalog.py"
click node_twitchclient "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/client.py"
click node_gql "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/gql.py"
click node_pubsub "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/pubsub.py"
click node_watch "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/watch.py"
click node_transport "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/transport.py"
click node_session "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/session.py"
click node_store "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/store.py"
click node_models "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/models.py"
click node_alerts "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/alerts.py"
click node_backup "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/backup.py"
click node_apiapp "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/api/app.py"
click node_apimodels "https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/api/models.py"
click node_webclient "https://github.com/kernelpanic-studios/dropwatch/blob/main/web/src/api/client.ts"
click node_webstore "https://github.com/kernelpanic-studios/dropwatch/blob/main/web/src/store.tsx"
click node_router "https://github.com/kernelpanic-studios/dropwatch/blob/main/web/src/router.ts"
click node_dashboard "https://github.com/kernelpanic-studios/dropwatch/tree/main/web/src/views"
click node_connect "https://github.com/kernelpanic-studios/dropwatch/blob/main/web/src/screens/Connect.tsx"
click node_uiicons "https://github.com/kernelpanic-studios/dropwatch/blob/main/web/src/ui/Icons.tsx"
click node_protocolref "https://github.com/kernelpanic-studios/dropwatch/blob/main/reference/fireph-webui/twitch.py"

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_service,node_runner,node_planner,node_events,node_operator toneBlue
class node_auth,node_catalog,node_twitchclient,node_gql,node_pubsub,node_watch,node_transport,node_session toneAmber
class node_store,node_models,node_alerts,node_backup toneMint
class node_apiapp,node_apimodels,node_webclient,node_webstore,node_router,node_dashboard,node_connect,node_uiicons toneRose
class node_protocolref,node_user,node_twitchservice toneIndigo
```

## Components

### Mining runtime

- [Application entry](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/__main__.py): `src/dropwatch/__main__.py`
- [Mining service](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/service.py): `src/dropwatch/service.py`
- [Mining runner](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/runner.py): `src/dropwatch/runner.py`
- [Campaign planner](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/planner.py): `src/dropwatch/planner.py`
- [Runtime events](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/events.py): `src/dropwatch/events.py`

### Twitch integration

- [Twitch sign-in](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/auth_device.py): `src/dropwatch/twitch/auth_device.py`
- [Campaign catalog](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/catalog.py): `src/dropwatch/twitch/catalog.py`
- [Twitch client](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/client.py): `src/dropwatch/twitch/client.py`
- [GraphQL operations](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/gql.py): `src/dropwatch/twitch/gql.py`
- [Twitch PubSub](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/pubsub.py): `src/dropwatch/twitch/pubsub.py`
- [Stream watching](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/watch.py): `src/dropwatch/twitch/watch.py`
- [HTTP transport](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/transport.py): `src/dropwatch/twitch/transport.py`
- [Twitch session](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/twitch/session.py): `src/dropwatch/twitch/session.py`

### Persistence and operations

- [Application store](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/store.py): `src/dropwatch/store.py`
- [Domain models](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/models.py): `src/dropwatch/models.py`
- [Notifications](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/alerts.py): `src/dropwatch/alerts.py`
- [Backup and restore](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/backup.py): `src/dropwatch/backup.py`

### API and dashboard

- [HTTP API](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/api/app.py): `src/dropwatch/api/app.py`
- [API schemas](https://github.com/kernelpanic-studios/dropwatch/blob/main/src/dropwatch/api/models.py): `src/dropwatch/api/models.py`
- [Dashboard API client](https://github.com/kernelpanic-studios/dropwatch/blob/main/web/src/api/client.ts): `web/src/api/client.ts`
- [Dashboard state](https://github.com/kernelpanic-studios/dropwatch/blob/main/web/src/store.tsx): `web/src/store.tsx`
- [Dashboard routing](https://github.com/kernelpanic-studios/dropwatch/blob/main/web/src/router.ts): `web/src/router.ts`
- [Dashboard views](https://github.com/kernelpanic-studios/dropwatch/tree/main/web/src/views): `web/src/views`
- [Twitch connect screen](https://github.com/kernelpanic-studios/dropwatch/blob/main/web/src/screens/Connect.tsx): `web/src/screens/Connect.tsx`
- [Dashboard icons](https://github.com/kernelpanic-studios/dropwatch/blob/main/web/src/ui/Icons.tsx): `web/src/ui/Icons.tsx`

### Protocol reference

- [Reference Twitch client](https://github.com/kernelpanic-studios/dropwatch/blob/main/reference/fireph-webui/twitch.py): `reference/fireph-webui/twitch.py`

### Other components

- **Dropwatch operator**
- **Operator browser**
- **Twitch service**

## Connections

- Dropwatch operator → Operator browser: uses dashboard (evidence: `README.md`)
- Application entry → Mining service: starts
- Mining service → Mining runner: builds and runs (evidence: `src/dropwatch/service.py`)
- Mining service → Runtime events: publishes events (evidence: `src/dropwatch/service.py`)
- Mining service → Twitch PubSub: handles events (evidence: `src/dropwatch/service.py`)
- Mining service → Twitch client: builds parts (evidence: `src/dropwatch/service.py`)
- Mining service → Campaign catalog: builds parts (evidence: `src/dropwatch/service.py`)
- Mining runner → Campaign planner: plans campaigns (evidence: `src/dropwatch/runner.py`)
- Mining runner → Domain models: uses domain data (evidence: `src/dropwatch/runner.py`)
- Mining runner → GraphQL operations: fetches and claims (evidence: `src/dropwatch/runner.py`)
- Mining runner → Twitch PubSub: handles updates (evidence: `src/dropwatch/runner.py`)
- Mining runner → Runtime events: emits activity (evidence: `src/dropwatch/runner.py`)
- Mining runner → Application store: reads preferences
- Twitch client → GraphQL operations: queries (evidence: `src/dropwatch/twitch/client.py`)
- GraphQL operations → Twitch session: uses session (evidence: `src/dropwatch/twitch/gql.py`)
- GraphQL operations → HTTP transport: sends requests (evidence: `src/dropwatch/twitch/gql.py`)
- Twitch sign-in → Twitch session: creates session (evidence: `src/dropwatch/twitch/auth_device.py`)
- Twitch sign-in → HTTP transport: sends auth requests (evidence: `src/dropwatch/twitch/auth_device.py`)
- Dropwatch operator → Twitch sign-in: authorizes Twitch (evidence: `README.md`)
- Stream watching → Twitch service: watches streams
- Mining runner → Stream watching: assigns watchers
- Twitch client → Twitch service: requests Twitch data
- HTTP API → Application store: reads and writes (evidence: `src/dropwatch/api/app.py`)
- HTTP API → Mining runner: replans miner (evidence: `src/dropwatch/api/app.py`)
- HTTP API → Backup and restore: restores backup (evidence: `src/dropwatch/api/app.py`)
- HTTP API → API schemas: validates responses (evidence: `src/dropwatch/api/app.py`)
- HTTP API → Mining service: accesses service (evidence: `src/dropwatch/api/app.py`)
- Application store → Domain models: persists domain data (evidence: `src/dropwatch/store.py`)
- Application store → Twitch session: persists session (evidence: `src/dropwatch/store.py`)
- HTTP API → Notifications: configures notifications
- Operator browser → Dashboard API client: controls miner
- Dashboard API client → HTTP API: calls HTTP API
- Dashboard state → Dashboard API client: loads API data (evidence: `web/src/store.tsx`)
- Dashboard views → Dashboard state: renders state (evidence: `web/src/views/Overview.tsx`)
- Twitch connect screen → Dashboard API client: submits sign-in (evidence: `web/src/screens/Connect.tsx`)
- Dashboard views → Dashboard routing: uses routes (evidence: `web/src/views/Overview.tsx`)
- Dashboard views → Dashboard icons: renders icons (evidence: `web/src/views/Overview.tsx`)
- Reference Twitch client → Twitch service: informs protocol
