# maciejwlodarski/mcpm architecture

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

- Interactive diagram: https://gitdiagram.com/maciejwlodarski/mcpm
- Repository: https://github.com/maciejwlodarski/mcpm

## Overview

MCPM is a CLI package manager and optional direct launcher for isolated Minecraft Java profiles. The main workflow initializes/selects a profile, resolves Modrinth mods and dependencies, applies changes to its mod directory, then prepares and launches the game. Profile state and shared launcher downloads serve different lifetimes. The graph follows documented product capabilities; several command and launcher internals are unsampled, so their wiring is shown only where the excerpts or README establish it.

Main entry points: [`bin/mcpm.js`](https://github.com/maciejwlodarski/mcpm/blob/master/bin/mcpm.js) (Command router), [`features/launcher/src/launch.js`](https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/launch.js) (Prepare and launch), [`src/installer.js`](https://github.com/maciejwlodarski/mcpm/blob/master/src/installer.js) (Dependency resolution and apply), [`features/launcher/src/index.js`](https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/index.js) (Launcher commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and profiles"]
  node_entry["Command router<br/>[mcpm.js]"]
  node_init["Initialize profile<br/>[init.js]"]
  node_profilecmd["Profile commands<br/>[projects.js]"]
  node_configcmd["Configure profile<br/>[configure.js]"]
  node_profile["Profile resolution<br/>[projects.js]"]
  node_featuremgr["Optional feature manager<br/>[features.js]"]
end

subgraph group_mods["Mod management"]
  node_search["Search mods<br/>[search.js]"]
  node_modapi["Modrinth API<br/>[api.js]"]
  node_installcmd["Install and remove<br/>[install.js]"]
  node_installer["Dependency resolution and apply<br/>[installer.js]"]
  node_updatecmd["Update mods<br/>[update.js]"]
  node_upgradecmd["Version upgrade<br/>[upgrade.js]"]
  node_downloader["File downloader<br/>[downloader.js]"]
end

subgraph group_launcher["Direct launcher"]
  node_launcherentry["Launcher commands<br/>[index.js]"]
  node_auth["Account authentication<br/>[auth.js]"]
  node_launch["Prepare and launch<br/>[launch.js]"]
  node_metadata["Game metadata<br/>[metadata.js]"]
  node_runtime["Minecraft runtime downloads"]
  node_downloads["Verified downloads<br/>[downloads.js]"]
  node_java["Java runtime selection<br/>[java-runtime.js]"]
end

subgraph group_state["Persistent state"]
  node_config["Profile config and lock<br/>[config.js]"]
  node_registry[("Profile registry<br/>[projects.js]")]
  node_credential["Encrypted session storage<br/>[secure-storage.js]"]
  node_sharedcache[("Shared runtime cache<br/>[launch.js]")]
end

node_user(("CLI user"))
node_microsoft{{"Microsoft and Xbox services"}}
node_fabric{{"Fabric Meta"}}
node_modrinth{{"Modrinth service"}}
node_minecraft(("Minecraft process"))

node_user -->|"runs commands"| node_entry
node_entry -->|"dispatches"| node_init
node_entry -->|"dispatches"| node_profilecmd
node_entry -->|"dispatches"| node_configcmd
node_entry -->|"dispatches"| node_search
node_entry -->|"dispatches"| node_installcmd
node_entry -->|"dispatches"| node_updatecmd
node_entry -->|"dispatches"| node_upgradecmd
node_entry -->|"loads features"| node_featuremgr
node_init -->|"fetches versions"| node_modapi
node_init -->|"writes profile"| node_config
node_init -->|"registers profile"| node_profile
node_profilecmd -->|"resolves registry"| node_profile
node_configcmd -->|"updates settings"| node_config
node_search -->|"searches"| node_modapi
node_modapi -->|"requests metadata"| node_modrinth
node_installcmd -->|"applies mod plan"| node_installer
node_updatecmd -->|"resolves and applies"| node_installer
node_upgradecmd -->|"migrates mod set"| node_installer
node_installer -->|"resolves versions"| node_modapi
node_installer -->|"downloads mod files"| node_downloader
node_installer -->|"writes config and lock"| node_config
node_installer -->|"resolves project root"| node_profile
node_featuremgr -.->|"loads optional module"| node_launcherentry
node_launcherentry -->|"gets profile context"| node_profile
node_launcherentry -->|"creates or renews session"| node_auth
node_launcherentry -->|"reads and saves session"| node_credential
node_auth -->|"authenticates"| node_microsoft
node_launcherentry -->|"prepares or starts"| node_launch
node_launch -->|"resolves game metadata"| node_metadata
node_metadata -->|"resolves Fabric profile"| node_fabric
node_launch -->|"prepares game files"| node_runtime
node_runtime -->|"downloads verified files"| node_downloads
node_launch -->|"selects Java"| node_java
node_runtime -->|"reads and writes cache"| node_sharedcache
node_launch -->|"reuses runtime data"| node_sharedcache
node_launch -->|"uses session"| node_credential
node_launch -->|"starts game"| node_minecraft

click node_entry "https://github.com/maciejwlodarski/mcpm/blob/master/bin/mcpm.js"
click node_init "https://github.com/maciejwlodarski/mcpm/blob/master/src/commands/init.js"
click node_profilecmd "https://github.com/maciejwlodarski/mcpm/blob/master/src/commands/projects.js"
click node_configcmd "https://github.com/maciejwlodarski/mcpm/blob/master/src/commands/configure.js"
click node_profile "https://github.com/maciejwlodarski/mcpm/blob/master/src/projects.js"
click node_config "https://github.com/maciejwlodarski/mcpm/blob/master/src/config.js"
click node_registry "https://github.com/maciejwlodarski/mcpm/blob/master/src/projects.js"
click node_search "https://github.com/maciejwlodarski/mcpm/blob/master/src/commands/search.js"
click node_modapi "https://github.com/maciejwlodarski/mcpm/blob/master/src/api.js"
click node_installcmd "https://github.com/maciejwlodarski/mcpm/blob/master/src/commands/install.js"
click node_installer "https://github.com/maciejwlodarski/mcpm/blob/master/src/installer.js"
click node_updatecmd "https://github.com/maciejwlodarski/mcpm/blob/master/src/commands/update.js"
click node_upgradecmd "https://github.com/maciejwlodarski/mcpm/blob/master/src/commands/upgrade.js"
click node_downloader "https://github.com/maciejwlodarski/mcpm/blob/master/src/downloader.js"
click node_featuremgr "https://github.com/maciejwlodarski/mcpm/blob/master/src/features.js"
click node_launcherentry "https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/index.js"
click node_auth "https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/auth.js"
click node_credential "https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/secure-storage.js"
click node_launch "https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/launch.js"
click node_metadata "https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/metadata.js"
click node_runtime "https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/minecraft-runtime.js"
click node_downloads "https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/downloads.js"
click node_java "https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/java-runtime.js"
click node_sharedcache "https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/launch.js"

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_init,node_profilecmd,node_configcmd,node_profile,node_featuremgr,node_user toneBlue
class node_search,node_modapi,node_installcmd,node_installer,node_updatecmd,node_upgradecmd,node_downloader toneAmber
class node_launcherentry,node_auth,node_launch,node_metadata,node_runtime,node_downloads,node_java toneMint
class node_config,node_registry,node_credential,node_sharedcache toneRose
class node_microsoft,node_fabric,node_modrinth,node_minecraft toneIndigo
```

## Components

### CLI and profiles

- [Command router](https://github.com/maciejwlodarski/mcpm/blob/master/bin/mcpm.js): `bin/mcpm.js`
- [Initialize profile](https://github.com/maciejwlodarski/mcpm/blob/master/src/commands/init.js): `src/commands/init.js`
- [Profile commands](https://github.com/maciejwlodarski/mcpm/blob/master/src/commands/projects.js): `src/commands/projects.js`
- [Configure profile](https://github.com/maciejwlodarski/mcpm/blob/master/src/commands/configure.js): `src/commands/configure.js`
- [Profile resolution](https://github.com/maciejwlodarski/mcpm/blob/master/src/projects.js): `src/projects.js`
- [Optional feature manager](https://github.com/maciejwlodarski/mcpm/blob/master/src/features.js): `src/features.js`

### Mod management

- [Search mods](https://github.com/maciejwlodarski/mcpm/blob/master/src/commands/search.js): `src/commands/search.js`
- [Modrinth API](https://github.com/maciejwlodarski/mcpm/blob/master/src/api.js): `src/api.js`
- [Install and remove](https://github.com/maciejwlodarski/mcpm/blob/master/src/commands/install.js): `src/commands/install.js`
- [Dependency resolution and apply](https://github.com/maciejwlodarski/mcpm/blob/master/src/installer.js): `src/installer.js`
- [Update mods](https://github.com/maciejwlodarski/mcpm/blob/master/src/commands/update.js): `src/commands/update.js`
- [Version upgrade](https://github.com/maciejwlodarski/mcpm/blob/master/src/commands/upgrade.js): `src/commands/upgrade.js`
- [File downloader](https://github.com/maciejwlodarski/mcpm/blob/master/src/downloader.js): `src/downloader.js`

### Direct launcher

- [Launcher commands](https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/index.js): `features/launcher/src/index.js`
- [Account authentication](https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/auth.js): `features/launcher/src/auth.js`
- [Prepare and launch](https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/launch.js): `features/launcher/src/launch.js`
- [Game metadata](https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/metadata.js): `features/launcher/src/metadata.js`
- [Minecraft runtime downloads](https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/minecraft-runtime.js): `features/launcher/src/minecraft-runtime.js`
- [Verified downloads](https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/downloads.js): `features/launcher/src/downloads.js`
- [Java runtime selection](https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/java-runtime.js): `features/launcher/src/java-runtime.js`

### Persistent state

- [Profile config and lock](https://github.com/maciejwlodarski/mcpm/blob/master/src/config.js): `src/config.js`
- [Profile registry](https://github.com/maciejwlodarski/mcpm/blob/master/src/projects.js): `src/projects.js`
- [Encrypted session storage](https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/secure-storage.js): `features/launcher/src/secure-storage.js`
- [Shared runtime cache](https://github.com/maciejwlodarski/mcpm/blob/master/features/launcher/src/launch.js): `features/launcher/src/launch.js`

### Other components

- **CLI user**
- **Microsoft and Xbox services**
- **Fabric Meta**
- **Modrinth service**
- **Minecraft process**

## Connections

- CLI user → Command router: runs commands
- Command router → Initialize profile: dispatches
- Command router → Profile commands: dispatches
- Command router → Configure profile: dispatches
- Command router → Search mods: dispatches
- Command router → Install and remove: dispatches
- Command router → Update mods: dispatches
- Command router → Version upgrade: dispatches
- Command router → Optional feature manager: loads features
- Initialize profile → Modrinth API: fetches versions
- Initialize profile → Profile config and lock: writes profile
- Initialize profile → Profile resolution: registers profile
- Profile commands → Profile resolution: resolves registry
- Configure profile → Profile config and lock: updates settings
- Search mods → Modrinth API: searches
- Modrinth API → Modrinth service: requests metadata
- Install and remove → Dependency resolution and apply: applies mod plan
- Update mods → Dependency resolution and apply: resolves and applies
- Version upgrade → Dependency resolution and apply: migrates mod set
- Dependency resolution and apply → Modrinth API: resolves versions
- Dependency resolution and apply → File downloader: downloads mod files
- Dependency resolution and apply → Profile config and lock: writes config and lock
- Dependency resolution and apply → Profile resolution: resolves project root
- Optional feature manager → Launcher commands: loads optional module
- Launcher commands → Profile resolution: gets profile context
- Launcher commands → Account authentication: creates or renews session
- Launcher commands → Encrypted session storage: reads and saves session
- Account authentication → Microsoft and Xbox services: authenticates
- Launcher commands → Prepare and launch: prepares or starts
- Prepare and launch → Game metadata: resolves game metadata
- Game metadata → Fabric Meta: resolves Fabric profile
- Prepare and launch → Minecraft runtime downloads: prepares game files
- Minecraft runtime downloads → Verified downloads: downloads verified files
- Prepare and launch → Java runtime selection: selects Java
- Minecraft runtime downloads → Shared runtime cache: reads and writes cache
- Prepare and launch → Shared runtime cache: reuses runtime data
- Prepare and launch → Encrypted session storage: uses session
- Prepare and launch → Minecraft process: starts game
