# sergi0g/cup architecture

> Architecture diagram of the GitHub repository sergi0g/cup, 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/sergi0g/cup
- Repository: https://github.com/sergi0g/cup

## Overview

Cup checks container images for version-tag or digest changes and presents the results through a CLI or a web server/UI. The main CLI dispatch and server routes are visible in excerpts; the registry-checking internals are only partly sampled, so some subsystem links are omitted. The README documents registry support and JSON access, while the browser component relationships below are supported by the App excerpt and SOURCE INDEX references.

Main entry points: [`web/src/App.tsx`](https://github.com/sergi0g/cup/blob/main/web/src/App.tsx) (Dashboard app), [`src/structs/image.rs`](https://github.com/sergi0g/cup/blob/main/src/structs/image.rs) (Image evaluation), [`src/main.rs`](https://github.com/sergi0g/cup/blob/main/src/main.rs) (CLI commands), [`src/server.rs`](https://github.com/sergi0g/cup/blob/main/src/server.rs) (HTTP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Product entry points"]
  node_cli["CLI commands<br/>[main.rs]"]
  node_server["HTTP server<br/>[server.rs]"]
  node_config["Configuration<br/>[config.rs]"]
end

subgraph group_checking["Image update checking"]
  node_check["Update checks<br/>[check.rs]"]
  node_docker["Docker inspection<br/>[docker.rs]"]
  node_image["Image evaluation<br/>[image.rs]"]
  node_reference["Reference parsing<br/>[reference.rs]"]
  node_registry["Registry queries<br/>[registry.rs]"]
  node_httpclient["HTTP client<br/>[http.rs]"]
end

subgraph group_results["Results and serialization"]
  node_update["Update result model<br/>[update.rs]"]
  node_status["Update statuses<br/>[status.rs]"]
  node_version["Version comparison<br/>[version.rs]"]
  node_json["JSON output<br/>[json.rs]"]
  node_clioutput["CLI formatting<br/>[mod.rs]"]
end

subgraph group_web["Web experience"]
  node_app["Dashboard app<br/>[App.tsx]"]
  node_datahook["Dashboard data hook<br/>[use-data.tsx]"]
  node_imageview["Image result view<br/>[Image.tsx]"]
  node_filters["Search and filters<br/>[Filters.tsx]"]
  node_serverview["Server grouping view<br/>[Server.tsx]"]
  node_logo["Cup branding<br/>[Logo.tsx]"]
  node_tooltip["Tooltip UI<br/>[Tooltip.tsx]"]
  node_theme["Runtime theme<br/>[theme.ts]"]
end

node_user(("Cup user"))
node_browser(("Browser user"))
node_registryservice{{"Container registries"}}

node_user -->|"runs command"| node_cli
node_cli -->|"loads settings"| node_config
node_cli -->|"runs check"| node_check
node_cli -->|"starts server"| node_server
node_cli -->|"prints results"| node_clioutput
node_image -->|"parses reference"| node_reference
node_image -->|"queries tags or digests"| node_registry
node_image -->|"compares versions"| node_version
node_image -->|"derives status"| node_status
node_image -->|"creates result"| node_update
node_registry -.->|"queries registry"| node_registryservice
node_clioutput -->|"formats raw JSON"| node_json
node_clioutput -->|"prints status"| node_status
node_server -->|"builds JSON views"| node_json
node_server -->|"serves API"| node_user
node_browser -->|"opens dashboard"| node_app
node_app -->|"loads data"| node_datahook
node_app -->|"renders images"| node_imageview
node_app -->|"renders filters"| node_filters
node_app -->|"groups by server"| node_serverview
node_app -->|"renders branding"| node_logo
node_app -->|"uses tooltips"| node_tooltip
node_imageview -->|"uses tooltips"| node_tooltip
node_app -->|"uses theme"| node_theme
node_datahook -.->|"requests JSON"| node_server

click node_cli "https://github.com/sergi0g/cup/blob/main/src/main.rs"
click node_server "https://github.com/sergi0g/cup/blob/main/src/server.rs"
click node_config "https://github.com/sergi0g/cup/blob/main/src/config.rs"
click node_check "https://github.com/sergi0g/cup/blob/main/src/check.rs"
click node_docker "https://github.com/sergi0g/cup/blob/main/src/docker.rs"
click node_image "https://github.com/sergi0g/cup/blob/main/src/structs/image.rs"
click node_reference "https://github.com/sergi0g/cup/blob/main/src/utils/reference.rs"
click node_registry "https://github.com/sergi0g/cup/blob/main/src/registry.rs"
click node_httpclient "https://github.com/sergi0g/cup/blob/main/src/http.rs"
click node_update "https://github.com/sergi0g/cup/blob/main/src/structs/update.rs"
click node_status "https://github.com/sergi0g/cup/blob/main/src/structs/status.rs"
click node_version "https://github.com/sergi0g/cup/blob/main/src/structs/version.rs"
click node_json "https://github.com/sergi0g/cup/blob/main/src/utils/json.rs"
click node_clioutput "https://github.com/sergi0g/cup/blob/main/src/formatting/mod.rs"
click node_app "https://github.com/sergi0g/cup/blob/main/web/src/App.tsx"
click node_datahook "https://github.com/sergi0g/cup/blob/main/web/src/hooks/use-data.tsx"
click node_imageview "https://github.com/sergi0g/cup/blob/main/web/src/components/Image.tsx"
click node_filters "https://github.com/sergi0g/cup/blob/main/web/src/components/Filters.tsx"
click node_serverview "https://github.com/sergi0g/cup/blob/main/web/src/components/Server.tsx"
click node_logo "https://github.com/sergi0g/cup/blob/main/web/src/components/Logo.tsx"
click node_tooltip "https://github.com/sergi0g/cup/blob/main/web/src/components/ui/Tooltip.tsx"
click node_theme "https://github.com/sergi0g/cup/blob/main/web/src/theme.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_cli,node_server,node_config,node_user,node_browser toneBlue
class node_check,node_docker,node_image,node_reference,node_registry,node_httpclient toneAmber
class node_update,node_status,node_version,node_json,node_clioutput toneMint
class node_app,node_datahook,node_imageview,node_filters,node_serverview,node_logo,node_tooltip,node_theme toneRose
class node_registryservice toneIndigo
```

## Components

### Product entry points

- [CLI commands](https://github.com/sergi0g/cup/blob/main/src/main.rs): `src/main.rs`
- [HTTP server](https://github.com/sergi0g/cup/blob/main/src/server.rs): `src/server.rs`
- [Configuration](https://github.com/sergi0g/cup/blob/main/src/config.rs): `src/config.rs`

### Image update checking

- [Update checks](https://github.com/sergi0g/cup/blob/main/src/check.rs): `src/check.rs`
- [Docker inspection](https://github.com/sergi0g/cup/blob/main/src/docker.rs): `src/docker.rs`
- [Image evaluation](https://github.com/sergi0g/cup/blob/main/src/structs/image.rs): `src/structs/image.rs`
- [Reference parsing](https://github.com/sergi0g/cup/blob/main/src/utils/reference.rs): `src/utils/reference.rs`
- [Registry queries](https://github.com/sergi0g/cup/blob/main/src/registry.rs): `src/registry.rs`
- [HTTP client](https://github.com/sergi0g/cup/blob/main/src/http.rs): `src/http.rs`

### Results and serialization

- [Update result model](https://github.com/sergi0g/cup/blob/main/src/structs/update.rs): `src/structs/update.rs`
- [Update statuses](https://github.com/sergi0g/cup/blob/main/src/structs/status.rs): `src/structs/status.rs`
- [Version comparison](https://github.com/sergi0g/cup/blob/main/src/structs/version.rs): `src/structs/version.rs`
- [JSON output](https://github.com/sergi0g/cup/blob/main/src/utils/json.rs): `src/utils/json.rs`
- [CLI formatting](https://github.com/sergi0g/cup/blob/main/src/formatting/mod.rs): `src/formatting/mod.rs`

### Web experience

- [Dashboard app](https://github.com/sergi0g/cup/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Dashboard data hook](https://github.com/sergi0g/cup/blob/main/web/src/hooks/use-data.tsx): `web/src/hooks/use-data.tsx`
- [Image result view](https://github.com/sergi0g/cup/blob/main/web/src/components/Image.tsx): `web/src/components/Image.tsx`
- [Search and filters](https://github.com/sergi0g/cup/blob/main/web/src/components/Filters.tsx): `web/src/components/Filters.tsx`
- [Server grouping view](https://github.com/sergi0g/cup/blob/main/web/src/components/Server.tsx): `web/src/components/Server.tsx`
- [Cup branding](https://github.com/sergi0g/cup/blob/main/web/src/components/Logo.tsx): `web/src/components/Logo.tsx`
- [Tooltip UI](https://github.com/sergi0g/cup/blob/main/web/src/components/ui/Tooltip.tsx): `web/src/components/ui/Tooltip.tsx`
- [Runtime theme](https://github.com/sergi0g/cup/blob/main/web/src/theme.ts): `web/src/theme.ts`

### Other components

- **Cup user**
- **Browser user**
- **Container registries**

## Connections

- Cup user → CLI commands: runs command (evidence: `src/main.rs`)
- CLI commands → Configuration: loads settings (evidence: `src/main.rs`)
- CLI commands → Update checks: runs check (evidence: `src/main.rs`)
- CLI commands → HTTP server: starts server (evidence: `src/main.rs`)
- CLI commands → CLI formatting: prints results (evidence: `src/main.rs`)
- Image evaluation → Reference parsing: parses reference (evidence: `src/structs/image.rs`)
- Image evaluation → Registry queries: queries tags or digests (evidence: `src/structs/image.rs`)
- Image evaluation → Version comparison: compares versions (evidence: `src/structs/image.rs`)
- Image evaluation → Update statuses: derives status (evidence: `src/structs/image.rs`)
- Image evaluation → Update result model: creates result (evidence: `src/structs/image.rs`)
- Registry queries → Container registries: queries registry
- CLI formatting → JSON output: formats raw JSON (evidence: `src/formatting/mod.rs`)
- CLI formatting → Update statuses: prints status (evidence: `src/formatting/mod.rs`)
- HTTP server → JSON output: builds JSON views (evidence: `src/server.rs`)
- HTTP server → Cup user: serves API (evidence: `src/server.rs`)
- Browser user → Dashboard app: opens dashboard (evidence: `web/src/App.tsx`)
- Dashboard app → Dashboard data hook: loads data (evidence: `web/src/App.tsx`)
- Dashboard app → Image result view: renders images (evidence: `web/src/App.tsx`)
- Dashboard app → Search and filters: renders filters (evidence: `web/src/App.tsx`)
- Dashboard app → Server grouping view: groups by server (evidence: `web/src/App.tsx`)
- Dashboard app → Cup branding: renders branding (evidence: `web/src/App.tsx`)
- Dashboard app → Tooltip UI: uses tooltips (evidence: `web/src/App.tsx`)
- Image result view → Tooltip UI: uses tooltips (evidence: `web/src/components/Image.tsx`)
- Dashboard app → Runtime theme: uses theme (evidence: `web/src/App.tsx`)
- Dashboard data hook → HTTP server: requests JSON
