# clementtsang/bottom architecture

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

- Interactive diagram: https://gitdiagram.com/clementtsang/bottom
- Repository: https://github.com/clementtsang/bottom

## Overview

bottom is a cross-platform terminal system monitor. Its main workflow collects host and process metrics, keeps application data and interaction state, then presents configurable widgets and accepts user actions such as searching, changing focus, and terminating processes. The README documents the major visualization, table, configuration, basic-mode, and expansion capabilities. Some subsystem links below rely on README descriptions or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`src/app.rs`](https://github.com/clementtsang/bottom/blob/main/src/app.rs) (Application state), [`src/lib.rs`](https://github.com/clementtsang/bottom/blob/main/src/lib.rs) (Runtime bootstrap), [`src/widgets/process_table.rs`](https://github.com/clementtsang/bottom/blob/main/src/widgets/process_table.rs) (Process table), [`src/collection.rs`](https://github.com/clementtsang/bottom/blob/main/src/collection.rs) (Metric collector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and control"]
  node_runtime["Runtime bootstrap<br/>[lib.rs]"]
  node_app["Application state<br/>[app.rs]"]
  node_input["Input handling<br/>[input.rs]"]
  node_layout["Widget layout<br/>[layout_manager.rs]"]
  node_appdata["Application data<br/>[store.rs]"]
  node_filters["Data filters<br/>[filter.rs]"]
end

subgraph group_collection["System collection"]
  node_collector["Metric collector<br/>[collection.rs]"]
  node_processes["Process harvesting<br/>[processes.rs]"]
end

subgraph group_presentation["Widgets and rendering"]
  node_processwidget["Process table<br/>[process_table.rs]"]
  node_processquery["Process search<br/>[query.rs]"]
  node_widgets["Metric widgets"]
  node_canvas["Terminal rendering<br/>[canvas.rs]"]
  node_timeseries["Time-series chart<br/>[vendored.rs]"]
  node_killdialog["Process kill dialog"]
end

subgraph group_configuration["Configuration"]
  node_options["CLI and config<br/>[options.rs]"]
end

node_user(("Terminal user"))

node_user -->|"starts"| node_runtime
node_runtime -->|"runs"| node_app
node_runtime -->|"collects metrics"| node_collector
node_runtime -->|"updates data"| node_appdata
node_collector -->|"harvests processes"| node_processes
node_app -->|"uses layout"| node_layout
node_app -->|"applies filters"| node_filters
node_options -->|"configures"| node_app
node_user -->|"enters queries"| node_input
node_processwidget -->|"evaluates search"| node_processquery
node_processwidget -->|"displays process data"| node_processes
node_app -.->|"manages process view"| node_processwidget
node_app -.->|"selects widgets"| node_widgets
node_widgets -.->|"renders charts"| node_timeseries
node_app -.->|"drives rendering"| node_canvas
node_user -->|"requests termination"| node_killdialog
node_app -.->|"opens dialog"| node_killdialog

click node_runtime "https://github.com/clementtsang/bottom/blob/main/src/lib.rs"
click node_app "https://github.com/clementtsang/bottom/blob/main/src/app.rs"
click node_input "https://github.com/clementtsang/bottom/blob/main/src/utils/input.rs"
click node_layout "https://github.com/clementtsang/bottom/blob/main/src/app/layout_manager.rs"
click node_appdata "https://github.com/clementtsang/bottom/blob/main/src/app/data/store.rs"
click node_collector "https://github.com/clementtsang/bottom/blob/main/src/collection.rs"
click node_processes "https://github.com/clementtsang/bottom/blob/main/src/collection/processes.rs"
click node_filters "https://github.com/clementtsang/bottom/blob/main/src/app/filter.rs"
click node_options "https://github.com/clementtsang/bottom/blob/main/src/options.rs"
click node_processwidget "https://github.com/clementtsang/bottom/blob/main/src/widgets/process_table.rs"
click node_processquery "https://github.com/clementtsang/bottom/blob/main/src/widgets/process_table/query.rs"
click node_widgets "https://github.com/clementtsang/bottom/tree/main/src/widgets"
click node_canvas "https://github.com/clementtsang/bottom/blob/main/src/canvas.rs"
click node_timeseries "https://github.com/clementtsang/bottom/blob/main/src/canvas/components/time_series/vendored.rs"
click node_killdialog "https://github.com/clementtsang/bottom/blob/main/src/canvas/dialogs/process_kill_dialog.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_runtime,node_app,node_input,node_layout,node_appdata,node_filters,node_user toneBlue
class node_collector,node_processes toneAmber
class node_processwidget,node_processquery,node_widgets,node_canvas,node_timeseries,node_killdialog toneMint
class node_options toneRose
```

## Components

### Runtime and control

- [Runtime bootstrap](https://github.com/clementtsang/bottom/blob/main/src/lib.rs): `src/lib.rs`
- [Application state](https://github.com/clementtsang/bottom/blob/main/src/app.rs): `src/app.rs`
- [Input handling](https://github.com/clementtsang/bottom/blob/main/src/utils/input.rs): `src/utils/input.rs`
- [Widget layout](https://github.com/clementtsang/bottom/blob/main/src/app/layout_manager.rs): `src/app/layout_manager.rs`
- [Application data](https://github.com/clementtsang/bottom/blob/main/src/app/data/store.rs): `src/app/data/store.rs`
- [Data filters](https://github.com/clementtsang/bottom/blob/main/src/app/filter.rs): `src/app/filter.rs`

### System collection

- [Metric collector](https://github.com/clementtsang/bottom/blob/main/src/collection.rs): `src/collection.rs`
- [Process harvesting](https://github.com/clementtsang/bottom/blob/main/src/collection/processes.rs): `src/collection/processes.rs`

### Widgets and rendering

- [Process table](https://github.com/clementtsang/bottom/blob/main/src/widgets/process_table.rs): `src/widgets/process_table.rs`
- [Process search](https://github.com/clementtsang/bottom/blob/main/src/widgets/process_table/query.rs): `src/widgets/process_table/query.rs`
- [Metric widgets](https://github.com/clementtsang/bottom/tree/main/src/widgets): `src/widgets`
- [Terminal rendering](https://github.com/clementtsang/bottom/blob/main/src/canvas.rs): `src/canvas.rs`
- [Time-series chart](https://github.com/clementtsang/bottom/blob/main/src/canvas/components/time_series/vendored.rs): `src/canvas/components/time_series/vendored.rs`
- [Process kill dialog](https://github.com/clementtsang/bottom/blob/main/src/canvas/dialogs/process_kill_dialog.rs): `src/canvas/dialogs/process_kill_dialog.rs`

### Configuration

- [CLI and config](https://github.com/clementtsang/bottom/blob/main/src/options.rs): `src/options.rs`

### Other components

- **Terminal user**

## Connections

- Terminal user → Runtime bootstrap: starts
- Runtime bootstrap → Application state: runs (evidence: `src/lib.rs`)
- Runtime bootstrap → Metric collector: collects metrics (evidence: `src/lib.rs`)
- Runtime bootstrap → Application data: updates data (evidence: `src/lib.rs`)
- Metric collector → Process harvesting: harvests processes (evidence: `src/collection.rs`)
- Application state → Widget layout: uses layout (evidence: `src/app.rs`)
- Application state → Data filters: applies filters (evidence: `src/app.rs`)
- CLI and config → Application state: configures (evidence: `src/options.rs`)
- Terminal user → Input handling: enters queries
- Process table → Process search: evaluates search (evidence: `src/widgets/process_table.rs`)
- Process table → Process harvesting: displays process data (evidence: `src/widgets/process_table.rs`)
- Application state → Process table: manages process view
- Application state → Metric widgets: selects widgets
- Metric widgets → Time-series chart: renders charts
- Application state → Terminal rendering: drives rendering
- Terminal user → Process kill dialog: requests termination
- Application state → Process kill dialog: opens dialog
