# spicetify/cli architecture

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

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

## Overview

Spicetify CLI customizes the installed Spotify client. The main workflow is: a user invokes a CLI command, Spicetify manages a Spotify backup and applies configured changes to the client, which then loads injected themes, extensions, and custom apps. The graph also preserves the documented color/CSS customization capabilities and the repository’s separate JavaScript wrapper and sample-product branches. Some runtime wiring is not shown in the excerpts; those connections are omitted rather than inferred.

Main entry points: [`src/apply/apply.go`](https://github.com/spicetify/cli/blob/main/src/apply/apply.go) (Apply Modifications), [`src/cmd/apply.go`](https://github.com/spicetify/cli/blob/main/src/cmd/apply.go) (Apply Command), [`src/cmd/backup.go`](https://github.com/spicetify/cli/blob/main/src/cmd/backup.go) (Backup Command), [`src/cmd/cmd.go`](https://github.com/spicetify/cli/blob/main/src/cmd/cmd.go) (Command Setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and State"]
  node_entry["CLI Entry<br/>[spicetify.go]"]
  node_commands["Command Setup<br/>[cmd.go]"]
  node_applycmd["Apply Command<br/>[apply.go]"]
  node_backupcmd["Backup Command<br/>[backup.go]"]
  node_backup["Backup Operations<br/>[backup.go]"]
  node_backupstatus["Backup Status<br/>[backup.go]"]
  node_spotify["Spotify Status<br/>[spotify.go]"]
end

subgraph group_apply["Client Modification"]
  node_applyengine["Apply Modifications<br/>[apply.go]"]
  node_preprocess["Client Preprocessing<br/>[preprocess.go]"]
  node_backupstore[("Spotify Backup")]
end

subgraph group_runtime["Injected Runtime"]
  node_wrapper["Spicetify API"]
  node_webpack["Webpack Discovery"]
  node_query["Query Discovery<br/>[react-query.js]"]
  node_icons["Icon API<br/>[icons.js]"]
  node_menus["Context Menus<br/>[menus.js]"]
end

subgraph group_products["Customizations"]
  node_theme["Themes and Colors<br/>[apply.go]"]
  node_extensions["Extensions"]
  node_lyrics["Lyrics Plus"]
  node_newreleases["New Releases App"]
  node_reddit["Reddit App"]
end

node_user(("User"))
node_client["Spotify Client"]

node_user -->|"invokes"| node_entry
node_entry -->|"dispatches"| node_commands
node_commands -->|"routes to"| node_applycmd
node_commands -->|"routes to"| node_backupcmd
node_backupcmd -->|"calls"| node_backup
node_backupcmd -->|"calls"| node_preprocess
node_backupcmd -->|"checks"| node_backupstatus
node_backupcmd -->|"checks"| node_spotify
node_backup -->|"writes or extracts"| node_backupstore
node_applycmd -->|"calls"| node_applyengine
node_applycmd -->|"checks"| node_backupstatus
node_applycmd -->|"checks"| node_spotify
node_applycmd -.->|"modifies"| node_client
node_applyengine -->|"applies theme"| node_theme
node_applyengine -->|"injects"| node_extensions
node_applyengine -->|"injects app"| node_lyrics
node_applyengine -->|"injects app"| node_newreleases
node_applyengine -->|"injects app"| node_reddit
node_preprocess -.->|"patches"| node_client
node_client -.->|"loads"| node_wrapper
node_wrapper -.->|"resolves modules"| node_webpack
node_query -->|"uses inventory"| node_webpack
node_menus -->|"renders icons"| node_icons

click node_entry "https://github.com/spicetify/cli/blob/main/spicetify.go"
click node_commands "https://github.com/spicetify/cli/blob/main/src/cmd/cmd.go"
click node_applycmd "https://github.com/spicetify/cli/blob/main/src/cmd/apply.go"
click node_backupcmd "https://github.com/spicetify/cli/blob/main/src/cmd/backup.go"
click node_backup "https://github.com/spicetify/cli/blob/main/src/backup/backup.go"
click node_backupstatus "https://github.com/spicetify/cli/blob/main/src/status/backup/backup.go"
click node_spotify "https://github.com/spicetify/cli/blob/main/src/status/spotify/spotify.go"
click node_applyengine "https://github.com/spicetify/cli/blob/main/src/apply/apply.go"
click node_preprocess "https://github.com/spicetify/cli/blob/main/src/preprocess/preprocess.go"
click node_wrapper "https://github.com/spicetify/cli/tree/main/src/jsHelper/spicetifyWrapper"
click node_webpack "https://github.com/spicetify/cli/tree/main/src/jsHelper/spicetifyWrapper/webpack"
click node_query "https://github.com/spicetify/cli/blob/main/src/jsHelper/spicetifyWrapper/webpack/react-query.js"
click node_icons "https://github.com/spicetify/cli/blob/main/src/jsHelper/spicetifyWrapper/icons.js"
click node_menus "https://github.com/spicetify/cli/blob/main/src/jsHelper/spicetifyWrapper/menus.js"
click node_theme "https://github.com/spicetify/cli/blob/main/src/cmd/apply.go"
click node_extensions "https://github.com/spicetify/cli/tree/main/Extensions"
click node_lyrics "https://github.com/spicetify/cli/tree/main/CustomApps/lyrics-plus"
click node_newreleases "https://github.com/spicetify/cli/tree/main/CustomApps/new-releases"
click node_reddit "https://github.com/spicetify/cli/tree/main/CustomApps/reddit"

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_entry,node_commands,node_applycmd,node_backupcmd,node_backup,node_backupstatus,node_spotify,node_user,node_client toneBlue
class node_applyengine,node_preprocess,node_backupstore toneAmber
class node_wrapper,node_webpack,node_query,node_icons,node_menus toneMint
class node_theme,node_extensions,node_lyrics,node_newreleases,node_reddit toneRose
```

## Components

### CLI and State

- [CLI Entry](https://github.com/spicetify/cli/blob/main/spicetify.go): `spicetify.go`
- [Command Setup](https://github.com/spicetify/cli/blob/main/src/cmd/cmd.go): `src/cmd/cmd.go`
- [Apply Command](https://github.com/spicetify/cli/blob/main/src/cmd/apply.go): `src/cmd/apply.go`
- [Backup Command](https://github.com/spicetify/cli/blob/main/src/cmd/backup.go): `src/cmd/backup.go`
- [Backup Operations](https://github.com/spicetify/cli/blob/main/src/backup/backup.go): `src/backup/backup.go`
- [Backup Status](https://github.com/spicetify/cli/blob/main/src/status/backup/backup.go): `src/status/backup/backup.go`
- [Spotify Status](https://github.com/spicetify/cli/blob/main/src/status/spotify/spotify.go): `src/status/spotify/spotify.go`

### Client Modification

- [Apply Modifications](https://github.com/spicetify/cli/blob/main/src/apply/apply.go): `src/apply/apply.go`
- [Client Preprocessing](https://github.com/spicetify/cli/blob/main/src/preprocess/preprocess.go): `src/preprocess/preprocess.go`
- **Spotify Backup**

### Injected Runtime

- [Spicetify API](https://github.com/spicetify/cli/tree/main/src/jsHelper/spicetifyWrapper): `src/jsHelper/spicetifyWrapper`
- [Webpack Discovery](https://github.com/spicetify/cli/tree/main/src/jsHelper/spicetifyWrapper/webpack): `src/jsHelper/spicetifyWrapper/webpack`
- [Query Discovery](https://github.com/spicetify/cli/blob/main/src/jsHelper/spicetifyWrapper/webpack/react-query.js): `src/jsHelper/spicetifyWrapper/webpack/react-query.js`
- [Icon API](https://github.com/spicetify/cli/blob/main/src/jsHelper/spicetifyWrapper/icons.js): `src/jsHelper/spicetifyWrapper/icons.js`
- [Context Menus](https://github.com/spicetify/cli/blob/main/src/jsHelper/spicetifyWrapper/menus.js): `src/jsHelper/spicetifyWrapper/menus.js`

### Customizations

- [Themes and Colors](https://github.com/spicetify/cli/blob/main/src/cmd/apply.go): `src/cmd/apply.go`
- [Extensions](https://github.com/spicetify/cli/tree/main/Extensions): `Extensions`
- [Lyrics Plus](https://github.com/spicetify/cli/tree/main/CustomApps/lyrics-plus): `CustomApps/lyrics-plus`
- [New Releases App](https://github.com/spicetify/cli/tree/main/CustomApps/new-releases): `CustomApps/new-releases`
- [Reddit App](https://github.com/spicetify/cli/tree/main/CustomApps/reddit): `CustomApps/reddit`

### Other components

- **User**
- **Spotify Client**

## Connections

- User → CLI Entry: invokes (evidence: `spicetify.go`)
- CLI Entry → Command Setup: dispatches (evidence: `spicetify.go`)
- Command Setup → Apply Command: routes to
- Command Setup → Backup Command: routes to
- Backup Command → Backup Operations: calls (evidence: `src/cmd/backup.go`)
- Backup Command → Client Preprocessing: calls (evidence: `src/cmd/backup.go`)
- Backup Command → Backup Status: checks (evidence: `src/cmd/backup.go`)
- Backup Command → Spotify Status: checks (evidence: `src/cmd/backup.go`)
- Backup Operations → Spotify Backup: writes or extracts (evidence: `src/backup/backup.go`)
- Apply Command → Apply Modifications: calls (evidence: `src/cmd/apply.go`)
- Apply Command → Backup Status: checks (evidence: `src/cmd/apply.go`)
- Apply Command → Spotify Status: checks (evidence: `src/cmd/apply.go`)
- Apply Command → Spotify Client: modifies
- Apply Modifications → Themes and Colors: applies theme
- Apply Modifications → Extensions: injects
- Apply Modifications → Lyrics Plus: injects app
- Apply Modifications → New Releases App: injects app
- Apply Modifications → Reddit App: injects app
- Client Preprocessing → Spotify Client: patches
- Spotify Client → Spicetify API: loads
- Spicetify API → Webpack Discovery: resolves modules (evidence: `src/jsHelper/spicetifyWrapper/webpack/react-query.js`)
- Query Discovery → Webpack Discovery: uses inventory (evidence: `src/jsHelper/spicetifyWrapper/webpack/react-query.js`)
- Context Menus → Icon API: renders icons (evidence: `src/jsHelper/spicetifyWrapper/menus.js`)
