# nvm-windows/cli architecture

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

- Interactive diagram: https://gitdiagram.com/nvm-windows/cli
- Repository: https://github.com/nvm-windows/cli

## Overview

NVM for Windows CLI manages Node.js downloads, installs and removals, caching, and configuration. The principal workflow is a user invoking the CLI to install a version, then select an operating mode/version so the installation becomes active; listing, cache management, configuration, firewall, and malware commands are additional capabilities. Bootstrap and installer modules provide internal setup and installation machinery. The README establishes the product scope, but the sampled excerpts do not show most command-to-installer calls, so those relationships are omitted or marked unverified.

Main entry points: [`src/commands`](https://github.com/nvm-windows/cli/tree/main/src/commands) (Command handlers), [`src/installer/installer.go`](https://github.com/nvm-windows/cli/blob/main/src/installer/installer.go) (Installer engine), [`src/mode/mode.go`](https://github.com/nvm-windows/cli/blob/main/src/mode/mode.go) (Operating mode), [`src/cmd/main.go`](https://github.com/nvm-windows/cli/blob/main/src/cmd/main.go) (Command entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_main["Command entry<br/>[main.go]"]
  node_commands["Command handlers"]
end

subgraph group_lifecycle["Node lifecycle"]
  node_install["Install command<br/>[install.go]"]
  node_installer["Installer engine<br/>[installer.go]"]
  node_verification["Package verification<br/>[verification.go]"]
  node_uninstaller["Uninstaller<br/>[uninstaller.go]"]
  node_cache["Download cache<br/>[cache.go]"]
end

subgraph group_management["Version management"]
  node_select["Version selection"]
  node_listing["Version listings"]
  node_cachecmd["Cache commands"]
  node_config["Configuration"]
  node_aliases["Version aliases"]
  node_pin["Version pinning<br/>[pin.go]"]
  node_sync["Release sync<br/>[sync.go]"]
end

subgraph group_platform["Windows integration"]
  node_bootstrap["First-run setup<br/>[init.go]"]
  node_identity["Install identity<br/>[identity.go]"]
  node_migration["Legacy migration<br/>[migration.go]"]
  node_paths["Storage paths<br/>[paths.go]"]
  node_firewall["Module firewall<br/>[root.go]"]
  node_malware["Malware checks<br/>[malware.go]"]
  node_environment["Environment report<br/>[env.go]"]
  node_mode["Operating mode<br/>[mode.go]"]
  node_link["Activation links<br/>[link.go]"]
  node_reshim["Shim refresh<br/>[reshim.go]"]
end

node_user(("CLI user"))

node_user -->|"invokes"| node_main
node_main -->|"runs CLI"| node_commands
node_commands -.->|"dispatches"| node_install
node_install -.->|"starts install"| node_installer
node_installer -.->|"verifies package"| node_verification
node_installer -.->|"uses cache"| node_cache
node_commands -.->|"dispatches removal"| node_uninstaller
node_commands -.->|"dispatches selection"| node_select
node_commands -.->|"dispatches listing"| node_listing
node_commands -.->|"dispatches cache"| node_cachecmd
node_commands -.->|"dispatches config"| node_config
node_commands -.->|"dispatches aliases"| node_aliases
node_commands -.->|"dispatches pinning"| node_pin
node_commands -.->|"dispatches sync"| node_sync
node_commands -.->|"dispatches firewall"| node_firewall
node_commands -.->|"dispatches checks"| node_malware
node_commands -.->|"dispatches report"| node_environment
node_commands -.->|"dispatches mode"| node_mode
node_mode -->|"creates junction"| node_link
node_mode -->|"refreshes shims"| node_reshim

click node_main "https://github.com/nvm-windows/cli/blob/main/src/cmd/main.go"
click node_commands "https://github.com/nvm-windows/cli/tree/main/src/commands"
click node_install "https://github.com/nvm-windows/cli/blob/main/src/commands/install/install.go"
click node_installer "https://github.com/nvm-windows/cli/blob/main/src/installer/installer.go"
click node_verification "https://github.com/nvm-windows/cli/blob/main/src/installer/verification.go"
click node_uninstaller "https://github.com/nvm-windows/cli/blob/main/src/installer/uninstaller.go"
click node_cache "https://github.com/nvm-windows/cli/blob/main/src/installer/cache.go"
click node_select "https://github.com/nvm-windows/cli/tree/main/src/commands/use"
click node_listing "https://github.com/nvm-windows/cli/tree/main/src/commands/list"
click node_cachecmd "https://github.com/nvm-windows/cli/tree/main/src/commands/cache"
click node_config "https://github.com/nvm-windows/cli/tree/main/src/commands/cfg"
click node_aliases "https://github.com/nvm-windows/cli/tree/main/src/commands/alias"
click node_pin "https://github.com/nvm-windows/cli/blob/main/src/commands/pin.go"
click node_sync "https://github.com/nvm-windows/cli/blob/main/src/commands/sync.go"
click node_bootstrap "https://github.com/nvm-windows/cli/blob/main/src/bootstrap/init.go"
click node_identity "https://github.com/nvm-windows/cli/blob/main/src/bootstrap/identity.go"
click node_migration "https://github.com/nvm-windows/cli/blob/main/src/bootstrap/migration.go"
click node_paths "https://github.com/nvm-windows/cli/blob/main/src/bootstrap/paths.go"
click node_firewall "https://github.com/nvm-windows/cli/blob/main/src/commands/firewall/root.go"
click node_malware "https://github.com/nvm-windows/cli/blob/main/src/commands/malware/malware.go"
click node_environment "https://github.com/nvm-windows/cli/blob/main/src/commands/env.go"
click node_mode "https://github.com/nvm-windows/cli/blob/main/src/mode/mode.go"
click node_link "https://github.com/nvm-windows/cli/blob/main/src/link/link.go"
click node_reshim "https://github.com/nvm-windows/cli/blob/main/src/reshim/reshim.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_commands,node_user toneBlue
class node_install,node_installer,node_verification,node_uninstaller,node_cache toneAmber
class node_select,node_listing,node_cachecmd,node_config,node_aliases,node_pin,node_sync toneMint
class node_bootstrap,node_identity,node_migration,node_paths,node_firewall,node_malware,node_environment,node_mode,node_link,node_reshim toneRose
```

## Components

### CLI entry

- [Command entry](https://github.com/nvm-windows/cli/blob/main/src/cmd/main.go): `src/cmd/main.go`
- [Command handlers](https://github.com/nvm-windows/cli/tree/main/src/commands): `src/commands`

### Node lifecycle

- [Install command](https://github.com/nvm-windows/cli/blob/main/src/commands/install/install.go): `src/commands/install/install.go`
- [Installer engine](https://github.com/nvm-windows/cli/blob/main/src/installer/installer.go): `src/installer/installer.go`
- [Package verification](https://github.com/nvm-windows/cli/blob/main/src/installer/verification.go): `src/installer/verification.go`
- [Uninstaller](https://github.com/nvm-windows/cli/blob/main/src/installer/uninstaller.go): `src/installer/uninstaller.go`
- [Download cache](https://github.com/nvm-windows/cli/blob/main/src/installer/cache.go): `src/installer/cache.go`

### Version management

- [Version selection](https://github.com/nvm-windows/cli/tree/main/src/commands/use): `src/commands/use`
- [Version listings](https://github.com/nvm-windows/cli/tree/main/src/commands/list): `src/commands/list`
- [Cache commands](https://github.com/nvm-windows/cli/tree/main/src/commands/cache): `src/commands/cache`
- [Configuration](https://github.com/nvm-windows/cli/tree/main/src/commands/cfg): `src/commands/cfg`
- [Version aliases](https://github.com/nvm-windows/cli/tree/main/src/commands/alias): `src/commands/alias`
- [Version pinning](https://github.com/nvm-windows/cli/blob/main/src/commands/pin.go): `src/commands/pin.go`
- [Release sync](https://github.com/nvm-windows/cli/blob/main/src/commands/sync.go): `src/commands/sync.go`

### Windows integration

- [First-run setup](https://github.com/nvm-windows/cli/blob/main/src/bootstrap/init.go): `src/bootstrap/init.go`
- [Install identity](https://github.com/nvm-windows/cli/blob/main/src/bootstrap/identity.go): `src/bootstrap/identity.go`
- [Legacy migration](https://github.com/nvm-windows/cli/blob/main/src/bootstrap/migration.go): `src/bootstrap/migration.go`
- [Storage paths](https://github.com/nvm-windows/cli/blob/main/src/bootstrap/paths.go): `src/bootstrap/paths.go`
- [Module firewall](https://github.com/nvm-windows/cli/blob/main/src/commands/firewall/root.go): `src/commands/firewall/root.go`
- [Malware checks](https://github.com/nvm-windows/cli/blob/main/src/commands/malware/malware.go): `src/commands/malware/malware.go`
- [Environment report](https://github.com/nvm-windows/cli/blob/main/src/commands/env.go): `src/commands/env.go`
- [Operating mode](https://github.com/nvm-windows/cli/blob/main/src/mode/mode.go): `src/mode/mode.go`
- [Activation links](https://github.com/nvm-windows/cli/blob/main/src/link/link.go): `src/link/link.go`
- [Shim refresh](https://github.com/nvm-windows/cli/blob/main/src/reshim/reshim.go): `src/reshim/reshim.go`

### Other components

- **CLI user**

## Connections

- CLI user → Command entry: invokes
- Command entry → Command handlers: runs CLI (evidence: `src/cmd/main.go`)
- Command handlers → Install command: dispatches
- Install command → Installer engine: starts install
- Installer engine → Package verification: verifies package
- Installer engine → Download cache: uses cache
- Command handlers → Uninstaller: dispatches removal
- Command handlers → Version selection: dispatches selection
- Command handlers → Version listings: dispatches listing
- Command handlers → Cache commands: dispatches cache
- Command handlers → Configuration: dispatches config
- Command handlers → Version aliases: dispatches aliases
- Command handlers → Version pinning: dispatches pinning
- Command handlers → Release sync: dispatches sync
- Command handlers → Module firewall: dispatches firewall
- Command handlers → Malware checks: dispatches checks
- Command handlers → Environment report: dispatches report
- Command handlers → Operating mode: dispatches mode
- Operating mode → Activation links: creates junction (evidence: `src/mode/mode.go`)
- Operating mode → Shim refresh: refreshes shims (evidence: `src/mode/mode.go`)
