# nvm-sh/nvm architecture

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

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

## Overview

nvm is a per-user, per-shell Node.js version manager. The main workflow is to install and load nvm, install a Node version, then select it for the current shell; users can also list versions, manage aliases, and use project .nvmrc files. The README documents additional capabilities including io.js, offline installs, mirrors, package migration, and shell completion. Source excerpts are unavailable for runtime implementation details, so paths and relationships below rely on the tree and documented behavior.

Main entry points: [`nvm.sh`](https://github.com/nvm-sh/nvm/blob/master/nvm.sh) (Install version), [`install.sh`](https://github.com/nvm-sh/nvm/blob/master/install.sh) (Installer), [`nvm-exec`](https://github.com/nvm-sh/nvm/blob/master/nvm-exec) (Command executor), [`bash_completion`](https://github.com/nvm-sh/nvm/blob/master/bash_completion) (Bash completion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Setup and shell"]
  node_installer["Installer<br/>[install.sh]"]
  node_shell["Shell runtime<br/>[nvm.sh]"]
  node_executor["Command executor"]
  node_completion["Bash completion"]
end

subgraph group_versions["Version management"]
  node_install_version["Install version<br/>[nvm.sh]"]
  node_activate["Select version<br/>[nvm.sh]"]
  node_version_listing["Version listing<br/>[nvm.sh]"]
  node_alias_management["Alias management<br/>[nvm.sh]"]
  node_version_storage[("Installed versions<br/>[nvm.sh]")]
end

subgraph group_project["Project integration"]
  node_project_config["Project version<br/>[nvm.sh]"]
end

subgraph group_extras["Additional capabilities"]
  node_package_migration["Package migration<br/>[nvm.sh]"]
  node_offline_install["Offline install<br/>[nvm.sh]"]
  node_mirror_support["Mirror support<br/>[nvm.sh]"]
  node_iojs_support["io.js versions<br/>[nvm.sh]"]
end

node_user(("Shell user"))
node_node_source["Node.js source"]

node_user -->|"runs installer"| node_installer
node_installer -->|"installs runtime"| node_shell
node_user -->|"loads and invokes"| node_shell
node_user -->|"runs command"| node_executor
node_user -->|"requests completion"| node_completion
node_user -->|"requests install"| node_install_version
node_install_version -.->|"installs version"| node_version_storage
node_user -->|"selects version"| node_activate
node_activate -.->|"uses installed version"| node_version_storage
node_user -->|"lists versions"| node_version_listing
node_user -->|"manages aliases"| node_alias_management
node_user -->|"uses project config"| node_project_config
node_project_config -.->|"selects configured version"| node_activate
node_user -->|"migrates packages"| node_package_migration
node_user -->|"installs offline"| node_offline_install
node_user -->|"configures mirror"| node_mirror_support
node_user -->|"uses io.js"| node_iojs_support
node_install_version -.->|"obtains releases"| node_node_source

click node_installer "https://github.com/nvm-sh/nvm/blob/master/install.sh"
click node_shell "https://github.com/nvm-sh/nvm/blob/master/nvm.sh"
click node_executor "https://github.com/nvm-sh/nvm/blob/master/nvm-exec"
click node_completion "https://github.com/nvm-sh/nvm/blob/master/bash_completion"
click node_install_version "https://github.com/nvm-sh/nvm/blob/master/nvm.sh"
click node_activate "https://github.com/nvm-sh/nvm/blob/master/nvm.sh"
click node_version_listing "https://github.com/nvm-sh/nvm/blob/master/nvm.sh"
click node_alias_management "https://github.com/nvm-sh/nvm/blob/master/nvm.sh"
click node_version_storage "https://github.com/nvm-sh/nvm/blob/master/nvm.sh"
click node_project_config "https://github.com/nvm-sh/nvm/blob/master/nvm.sh"
click node_package_migration "https://github.com/nvm-sh/nvm/blob/master/nvm.sh"
click node_offline_install "https://github.com/nvm-sh/nvm/blob/master/nvm.sh"
click node_mirror_support "https://github.com/nvm-sh/nvm/blob/master/nvm.sh"
click node_iojs_support "https://github.com/nvm-sh/nvm/blob/master/nvm.sh"

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_installer,node_shell,node_executor,node_completion,node_user toneBlue
class node_install_version,node_activate,node_version_listing,node_alias_management,node_version_storage toneAmber
class node_project_config toneMint
class node_package_migration,node_offline_install,node_mirror_support,node_iojs_support toneRose
class node_node_source toneIndigo
```

## Components

### Setup and shell

- [Installer](https://github.com/nvm-sh/nvm/blob/master/install.sh): `install.sh`
- [Shell runtime](https://github.com/nvm-sh/nvm/blob/master/nvm.sh): `nvm.sh`
- [Command executor](https://github.com/nvm-sh/nvm/blob/master/nvm-exec): `nvm-exec`
- [Bash completion](https://github.com/nvm-sh/nvm/blob/master/bash_completion): `bash_completion`

### Version management

- [Install version](https://github.com/nvm-sh/nvm/blob/master/nvm.sh): `nvm.sh`
- [Select version](https://github.com/nvm-sh/nvm/blob/master/nvm.sh): `nvm.sh`
- [Version listing](https://github.com/nvm-sh/nvm/blob/master/nvm.sh): `nvm.sh`
- [Alias management](https://github.com/nvm-sh/nvm/blob/master/nvm.sh): `nvm.sh`
- [Installed versions](https://github.com/nvm-sh/nvm/blob/master/nvm.sh): `nvm.sh`

### Project integration

- [Project version](https://github.com/nvm-sh/nvm/blob/master/nvm.sh): `nvm.sh`

### Additional capabilities

- [Package migration](https://github.com/nvm-sh/nvm/blob/master/nvm.sh): `nvm.sh`
- [Offline install](https://github.com/nvm-sh/nvm/blob/master/nvm.sh): `nvm.sh`
- [Mirror support](https://github.com/nvm-sh/nvm/blob/master/nvm.sh): `nvm.sh`
- [io.js versions](https://github.com/nvm-sh/nvm/blob/master/nvm.sh): `nvm.sh`

### Other components

- **Shell user**
- **Node.js source**

## Connections

- Shell user → Installer: runs installer (evidence: `README.md`)
- Installer → Shell runtime: installs runtime (evidence: `README.md`)
- Shell user → Shell runtime: loads and invokes (evidence: `README.md`)
- Shell user → Command executor: runs command (evidence: `README.md`)
- Shell user → Bash completion: requests completion (evidence: `README.md`)
- Shell user → Install version: requests install (evidence: `README.md`)
- Install version → Installed versions: installs version
- Shell user → Select version: selects version (evidence: `README.md`)
- Select version → Installed versions: uses installed version
- Shell user → Version listing: lists versions (evidence: `README.md`)
- Shell user → Alias management: manages aliases (evidence: `README.md`)
- Shell user → Project version: uses project config (evidence: `README.md`)
- Project version → Select version: selects configured version
- Shell user → Package migration: migrates packages (evidence: `README.md`)
- Shell user → Offline install: installs offline (evidence: `README.md`)
- Shell user → Mirror support: configures mirror (evidence: `README.md`)
- Shell user → io.js versions: uses io.js (evidence: `README.md`)
- Install version → Node.js source: obtains releases
