sfpm
Getting started

Installation

Install the sfpm CLI and the tools it depends on.

Requirements

  • Node.js 18 or later. This is the minimum declared by @b64hub/sfpm-cli.
  • pnpm 8 or later. Projects are pnpm workspaces.
  • Salesforce CLI (sf), authenticated to each org you deploy to. Building with --validation org or full also needs your DevHub authenticated.
  • Git. sfpm bootstrap clones its package source with git.

Contributors to the sfpm repository need Node.js 22, which is the root engines setting. People who only use the CLI do not.

Install the CLI

The CLI is published to npm as @b64hub/sfpm-cli.

pnpm add -g @b64hub/sfpm-cli

Check the install:

sfpm --version
sfpm --help

Set default orgs

If you leave out -o, sfpm deploy reads the target-org default from the Salesforce CLI config:

sf config set target-org=my-sandbox

sfpm build reads target-dev-hub from the same config, but only when the validation level uses an org (--validation org or full). At the default local level no org is used, so no DevHub is needed. At org or full, pass -v <devhub> or set the SF_DEV_HUB environment variable. Flags always take precedence over these defaults.

Companion packages and tools

The CLI includes the runtime packages it needs. Install these only when you use the feature that needs them.

@b64hub/sfpm-hooks provides the built-in hooks, including the script hook. The CLI does not include it, so install it into your project to use its built-ins. Install it in the workspace root, where sfpm.config.ts lives. An sfpm.config.ts that imports from @b64hub/sfpm-hooks will not load until it is installed:

pnpm add -D -w @b64hub/sfpm-hooks

@b64hub/sfpm-core ships with the CLI, so you do not need to install it. Install it in the workspace root only if you want editor types for defineConfig or the LifecycleHooks type:

pnpm add -D -w @b64hub/sfpm-core

The SFDMU plugin is needed for data packages. sfpm runs data loads with sf sfdmu run, so the plugin must be installed in the Salesforce CLI:

sf plugins install sfdmu

Nimbus provides local validation, which runs on your machine. Install it on each machine that runs sfpm build at the default local level. sfpm looks for the nimbus binary on your PATH, then in the Salesforce CLI plugin folder (~/.local/share/sf/nimbus/bin/ on macOS and Linux):

curl -fsSL https://install.testnimbus.dev | sh

Without Nimbus, both checks still run, just against a missing binary. The compile check reports itself as skipped, with a warning, and never fails the build. The dependency check instead reports an error: at the default local level that's also just a warning, but at full validation it fails the build.

Boundary (dependency) checks run nimbus graph for each metadata reference. The sfpm build command does not start the Nimbus daemon.

Next

Continue with the quick start.

On this page