# kumarasakti/dpv architecture

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

- Interactive diagram: https://gitdiagram.com/kumarasakti/dpv
- Repository: https://github.com/kumarasakti/dpv

## Overview

dpv is a Go CLI that presents Docker container listings as readable terminal cards, a slim list, or JSON. The principal workflow is: the user supplies listing and display options; the CLI retrieves containers from Docker, filters and sorts them, computes summary statistics, selects a formatter, and writes the result. The formatter package provides the three documented output modes, with shared color styling for the human-readable modes. The graph follows the sampled CLI and runtime source; the README documents the output modes and flags.

Main entry points: [`cmd/root.go`](https://github.com/kumarasakti/dpv/blob/master/cmd/root.go) (CLI orchestration), [`internal/formatter/formatter.go`](https://github.com/kumarasakti/dpv/blob/master/internal/formatter/formatter.go) (Formatter helpers), [`internal/docker/client.go`](https://github.com/kumarasakti/dpv/blob/master/internal/docker/client.go) (Docker client), [`internal/formatter/pretty.go`](https://github.com/kumarasakti/dpv/blob/master/internal/formatter/pretty.go) (Card output)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_main["Program entry<br/>[main.go]"]
  node_root["CLI orchestration<br/>[root.go]"]
end

subgraph group_data["Container data"]
  node_dockerclient["Docker client<br/>[client.go]"]
  node_models["Container models<br/>[types.go]"]
  node_filter["Search and sort<br/>[filter.go]"]
end

subgraph group_output["Output rendering"]
  node_formatter["Formatter helpers<br/>[formatter.go]"]
  node_pretty["Card output<br/>[pretty.go]"]
  node_slim["Slim output<br/>[slim.go]"]
  node_json["JSON output<br/>[json.go]"]
  node_color["Terminal styling<br/>[color.go]"]
end

node_user(("CLI user"))
node_daemon[("Docker Engine")]
node_terminal(("Terminal"))

node_user -->|"invokes"| node_main
node_main -->|"executes"| node_root
node_root -->|"creates, lists"| node_dockerclient
node_dockerclient -->|"requests containers"| node_daemon
node_dockerclient -->|"normalizes data"| node_models
node_root -->|"filters, sorts"| node_filter
node_root -->|"builds statistics"| node_models
node_root -->|"selects, writes"| node_formatter
node_formatter -->|"dispatches"| node_pretty
node_formatter -->|"dispatches"| node_slim
node_formatter -->|"dispatches"| node_json
node_pretty -->|"styles output"| node_color
node_slim -->|"styles output"| node_color
node_pretty -->|"writes cards"| node_terminal
node_slim -->|"writes list"| node_terminal
node_json -->|"writes JSON"| node_terminal

click node_main "https://github.com/kumarasakti/dpv/blob/master/main.go"
click node_root "https://github.com/kumarasakti/dpv/blob/master/cmd/root.go"
click node_dockerclient "https://github.com/kumarasakti/dpv/blob/master/internal/docker/client.go"
click node_models "https://github.com/kumarasakti/dpv/blob/master/internal/docker/types.go"
click node_filter "https://github.com/kumarasakti/dpv/blob/master/internal/filter/filter.go"
click node_formatter "https://github.com/kumarasakti/dpv/blob/master/internal/formatter/formatter.go"
click node_pretty "https://github.com/kumarasakti/dpv/blob/master/internal/formatter/pretty.go"
click node_slim "https://github.com/kumarasakti/dpv/blob/master/internal/formatter/slim.go"
click node_json "https://github.com/kumarasakti/dpv/blob/master/internal/formatter/json.go"
click node_color "https://github.com/kumarasakti/dpv/blob/master/internal/color/color.go"

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_main,node_root,node_user toneBlue
class node_dockerclient,node_models,node_filter,node_daemon toneAmber
class node_formatter,node_pretty,node_slim,node_json,node_color toneMint
class node_terminal toneIndigo
```

## Components

### CLI workflow

- [Program entry](https://github.com/kumarasakti/dpv/blob/master/main.go): `main.go`
- [CLI orchestration](https://github.com/kumarasakti/dpv/blob/master/cmd/root.go): `cmd/root.go`

### Container data

- [Docker client](https://github.com/kumarasakti/dpv/blob/master/internal/docker/client.go): `internal/docker/client.go`
- [Container models](https://github.com/kumarasakti/dpv/blob/master/internal/docker/types.go): `internal/docker/types.go`
- [Search and sort](https://github.com/kumarasakti/dpv/blob/master/internal/filter/filter.go): `internal/filter/filter.go`

### Output rendering

- [Formatter helpers](https://github.com/kumarasakti/dpv/blob/master/internal/formatter/formatter.go): `internal/formatter/formatter.go`
- [Card output](https://github.com/kumarasakti/dpv/blob/master/internal/formatter/pretty.go): `internal/formatter/pretty.go`
- [Slim output](https://github.com/kumarasakti/dpv/blob/master/internal/formatter/slim.go): `internal/formatter/slim.go`
- [JSON output](https://github.com/kumarasakti/dpv/blob/master/internal/formatter/json.go): `internal/formatter/json.go`
- [Terminal styling](https://github.com/kumarasakti/dpv/blob/master/internal/color/color.go): `internal/color/color.go`

### Other components

- **CLI user**
- **Docker Engine**
- **Terminal**

## Connections

- CLI user → Program entry: invokes
- Program entry → CLI orchestration: executes
- CLI orchestration → Docker client: creates, lists
- Docker client → Docker Engine: requests containers
- Docker client → Container models: normalizes data
- CLI orchestration → Search and sort: filters, sorts
- CLI orchestration → Container models: builds statistics
- CLI orchestration → Formatter helpers: selects, writes
- Formatter helpers → Card output: dispatches
- Formatter helpers → Slim output: dispatches
- Formatter helpers → JSON output: dispatches
- Card output → Terminal styling: styles output
- Slim output → Terminal styling: styles output
- Card output → Terminal: writes cards
- Slim output → Terminal: writes list
- JSON output → Terminal: writes JSON
