# rust-lang/triagebot architecture

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

- Interactive diagram: https://gitdiagram.com/rust-lang/triagebot
- Repository: https://github.com/rust-lang/triagebot

## Overview

Triagebot is the Rust organization’s triage and team-assistance web service. Its principal workflow is to accept GitHub or Zulip webhooks, load repository configuration, parse and dispatch event-driven actions, then update GitHub or notify Zulip; PostgreSQL retains operational state and jobs. It also serves agenda, PR-comment, diff, and CI-log pages, and supports review coordination, release notes, crates.io yanks, and other repository automation. The map follows documented routes and sampled dispatch/API code; unsampled handler wiring is represented only at the documented subsystem level.

Main entry points: [`src/main.rs`](https://github.com/rust-lang/triagebot/blob/main/src/main.rs) (HTTP server), [`src/handlers.rs`](https://github.com/rust-lang/triagebot/blob/main/src/handlers.rs) (Event dispatch), [`src/github/client.rs`](https://github.com/rust-lang/triagebot/blob/main/src/github/client.rs) (GitHub API), [`src/handlers`](https://github.com/rust-lang/triagebot/tree/main/src/handlers) (Review coordination)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingress["Web ingress"]
  node_server["HTTP server<br/>[main.rs]"]
  node_gh_webhook["GitHub webhook<br/>[webhook.rs]"]
  node_zulip_webhook["Zulip webhook<br/>[zulip.rs]"]
end

subgraph group_automation["Triage automation"]
  node_event_dispatch["Event dispatch<br/>[handlers.rs]"]
  node_repository_config["Repository config<br/>[config.rs]"]
  node_command_parser["Command parser<br/>[command.rs]"]
  node_issue_pr_actions["Issue and PR actions"]
  node_review_coordination["Review coordination"]
  node_release_automation["Release automation"]
  node_job_scheduler["Scheduled jobs<br/>[jobs.rs]"]
end

subgraph group_state["State and jobs"]
  node_postgres[("PostgreSQL<br/>[db.rs]")]
end

subgraph group_views["User views"]
  node_agenda_views["Agenda endpoints<br/>[agenda.rs]"]
  node_comment_views["Comment views<br/>[gh_comments.rs]"]
  node_diff_view["Review diff view<br/>[gh_range_diff.rs]"]
  node_ci_log_view["CI log view<br/>[gha_logs.rs]"]
end

subgraph group_integrations["External integrations"]
  node_github_api["GitHub API<br/>[client.rs]"]
  node_zulip_api["Zulip API<br/>[client.rs]"]
  node_team_service["Team data<br/>[team_data.rs]"]
  node_crates_api["crates.io API<br/>[mod.rs]"]
end

node_github_actor(("GitHub"))
node_zulip_actor(("Zulip users"))

node_github_actor -->|"sends hooks"| node_server
node_zulip_actor -->|"sends hooks"| node_server
node_server -->|"routes hooks"| node_gh_webhook
node_server -->|"routes hooks"| node_zulip_webhook
node_server -->|"serves pages"| node_agenda_views
node_server -->|"serves pages"| node_comment_views
node_server -->|"serves diffs"| node_diff_view
node_server -->|"serves logs"| node_ci_log_view
node_gh_webhook -->|"dispatches events"| node_event_dispatch
node_zulip_webhook -->|"dispatches events"| node_event_dispatch
node_event_dispatch -->|"loads config"| node_repository_config
node_event_dispatch -->|"parses commands"| node_command_parser
node_event_dispatch -->|"runs handlers"| node_issue_pr_actions
node_event_dispatch -->|"runs handlers"| node_review_coordination
node_event_dispatch -->|"runs handlers"| node_release_automation
node_issue_pr_actions -->|"updates issues"| node_github_api
node_review_coordination -->|"reads reviews"| node_github_api
node_release_automation -->|"manages releases"| node_github_api
node_release_automation -.->|"yanks versions"| node_crates_api
node_issue_pr_actions -.->|"sends notifications"| node_zulip_api
node_review_coordination -->|"reads preferences"| node_postgres
node_review_coordination -->|"schedules work"| node_job_scheduler
node_job_scheduler -->|"stores jobs"| node_postgres
node_agenda_views -->|"reads state"| node_postgres
node_agenda_views -->|"queries issues"| node_github_api
node_comment_views -->|"fetches comments"| node_github_api
node_diff_view -->|"fetches changes"| node_github_api
node_ci_log_view -->|"fetches logs"| node_github_api
node_event_dispatch -->|"loads team data"| node_team_service

click node_server "https://github.com/rust-lang/triagebot/blob/main/src/main.rs"
click node_gh_webhook "https://github.com/rust-lang/triagebot/blob/main/src/github/webhook.rs"
click node_zulip_webhook "https://github.com/rust-lang/triagebot/blob/main/src/zulip.rs"
click node_event_dispatch "https://github.com/rust-lang/triagebot/blob/main/src/handlers.rs"
click node_repository_config "https://github.com/rust-lang/triagebot/blob/main/src/config.rs"
click node_command_parser "https://github.com/rust-lang/triagebot/blob/main/parser/src/command.rs"
click node_issue_pr_actions "https://github.com/rust-lang/triagebot/tree/main/src/handlers"
click node_review_coordination "https://github.com/rust-lang/triagebot/tree/main/src/handlers"
click node_release_automation "https://github.com/rust-lang/triagebot/tree/main/src/handlers"
click node_job_scheduler "https://github.com/rust-lang/triagebot/blob/main/src/jobs.rs"
click node_postgres "https://github.com/rust-lang/triagebot/blob/main/src/db.rs"
click node_agenda_views "https://github.com/rust-lang/triagebot/blob/main/src/agenda.rs"
click node_comment_views "https://github.com/rust-lang/triagebot/blob/main/src/gh_comments.rs"
click node_diff_view "https://github.com/rust-lang/triagebot/blob/main/src/gh_range_diff.rs"
click node_ci_log_view "https://github.com/rust-lang/triagebot/blob/main/src/gha_logs.rs"
click node_github_api "https://github.com/rust-lang/triagebot/blob/main/src/github/client.rs"
click node_zulip_api "https://github.com/rust-lang/triagebot/blob/main/src/zulip/client.rs"
click node_team_service "https://github.com/rust-lang/triagebot/blob/main/src/team_data.rs"
click node_crates_api "https://github.com/rust-lang/triagebot/blob/main/src/crates_io/mod.rs"

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_gh_webhook,node_zulip_webhook,node_zulip_actor toneBlue
class node_event_dispatch,node_repository_config,node_command_parser,node_issue_pr_actions,node_review_coordination,node_release_automation,node_job_scheduler toneAmber
class node_postgres toneMint
class node_agenda_views,node_comment_views,node_diff_view,node_ci_log_view toneRose
class node_github_api,node_zulip_api,node_team_service,node_crates_api,node_github_actor toneIndigo
```

## Components

### Web ingress

- [HTTP server](https://github.com/rust-lang/triagebot/blob/main/src/main.rs): `src/main.rs`
- [GitHub webhook](https://github.com/rust-lang/triagebot/blob/main/src/github/webhook.rs): `src/github/webhook.rs`
- [Zulip webhook](https://github.com/rust-lang/triagebot/blob/main/src/zulip.rs): `src/zulip.rs`

### Triage automation

- [Event dispatch](https://github.com/rust-lang/triagebot/blob/main/src/handlers.rs): `src/handlers.rs`
- [Repository config](https://github.com/rust-lang/triagebot/blob/main/src/config.rs): `src/config.rs`
- [Command parser](https://github.com/rust-lang/triagebot/blob/main/parser/src/command.rs): `parser/src/command.rs`
- [Issue and PR actions](https://github.com/rust-lang/triagebot/tree/main/src/handlers): `src/handlers`
- [Review coordination](https://github.com/rust-lang/triagebot/tree/main/src/handlers): `src/handlers`
- [Release automation](https://github.com/rust-lang/triagebot/tree/main/src/handlers): `src/handlers`
- [Scheduled jobs](https://github.com/rust-lang/triagebot/blob/main/src/jobs.rs): `src/jobs.rs`

### State and jobs

- [PostgreSQL](https://github.com/rust-lang/triagebot/blob/main/src/db.rs): `src/db.rs`

### User views

- [Agenda endpoints](https://github.com/rust-lang/triagebot/blob/main/src/agenda.rs): `src/agenda.rs`
- [Comment views](https://github.com/rust-lang/triagebot/blob/main/src/gh_comments.rs): `src/gh_comments.rs`
- [Review diff view](https://github.com/rust-lang/triagebot/blob/main/src/gh_range_diff.rs): `src/gh_range_diff.rs`
- [CI log view](https://github.com/rust-lang/triagebot/blob/main/src/gha_logs.rs): `src/gha_logs.rs`

### External integrations

- [GitHub API](https://github.com/rust-lang/triagebot/blob/main/src/github/client.rs): `src/github/client.rs`
- [Zulip API](https://github.com/rust-lang/triagebot/blob/main/src/zulip/client.rs): `src/zulip/client.rs`
- [Team data](https://github.com/rust-lang/triagebot/blob/main/src/team_data.rs): `src/team_data.rs`
- [crates.io API](https://github.com/rust-lang/triagebot/blob/main/src/crates_io/mod.rs): `src/crates_io/mod.rs`

### Other components

- **GitHub**
- **Zulip users**

## Connections

- GitHub → HTTP server: sends hooks
- Zulip users → HTTP server: sends hooks
- HTTP server → GitHub webhook: routes hooks
- HTTP server → Zulip webhook: routes hooks
- HTTP server → Agenda endpoints: serves pages
- HTTP server → Comment views: serves pages
- HTTP server → Review diff view: serves diffs
- HTTP server → CI log view: serves logs
- GitHub webhook → Event dispatch: dispatches events
- Zulip webhook → Event dispatch: dispatches events
- Event dispatch → Repository config: loads config
- Event dispatch → Command parser: parses commands
- Event dispatch → Issue and PR actions: runs handlers
- Event dispatch → Review coordination: runs handlers
- Event dispatch → Release automation: runs handlers
- Issue and PR actions → GitHub API: updates issues
- Review coordination → GitHub API: reads reviews
- Release automation → GitHub API: manages releases
- Release automation → crates.io API: yanks versions
- Issue and PR actions → Zulip API: sends notifications
- Review coordination → PostgreSQL: reads preferences
- Review coordination → Scheduled jobs: schedules work
- Scheduled jobs → PostgreSQL: stores jobs
- Agenda endpoints → PostgreSQL: reads state
- Agenda endpoints → GitHub API: queries issues
- Comment views → GitHub API: fetches comments
- Review diff view → GitHub API: fetches changes
- CI log view → GitHub API: fetches logs
- Event dispatch → Team data: loads team data
