npm registry

View as Markdown

An NPM Package artifact is a private npm registry at https://npm.registry.sh/. You publish and install packages with the regular npm client, and each package version is an artifact version in Buddy.

Package naming

The package name has the form @<workspace>/<artifact>: the scope is the workspace, and the name without the scope is the artifact identifier. The my-lib artifact in the my-workspace workspace corresponds to the @my-workspace/my-lib package.

The version from package.json becomes the artifact version name.

Artifact creation

The npm publish command automatically creates an artifact if the corresponding artifact does not exist in the workspace. Automatically created artifacts have the Workspace scope, Buddy Auth access control, and the Deny permission level for all pipelines and sandboxes. Pipeline and sandbox permissions are configured on the artifact's Permissions tab. An incorrect package name may also result in the creation of a new artifact.

Info
If you need an artifact in the project scope or with permissions set before the first publish, create it beforehand in the UI or through the REST API. bdy artifact create supports only the Bucket and Container Image types.

In the project sidebar, open Artifacts, click New artifact and select NPM Package. The artifact identifier must match the package name without the scope.

Image loading...Artifact types in the New artifact menu

Through the Artifacts API, you create it with "type": "NPM".

Registry authentication

The npm client authenticates in the registry with a Buddy user's personal access token. Add two lines to the project's .npmrc:

@my-workspace:registry=https://npm.registry.sh/
//npm.registry.sh/:_authToken=${NPM_TOKEN}

The first line associates the @my-workspace scope with the Buddy registry. The second configures the authentication token. The npm client substitutes ${NPM_TOKEN} with the value of the corresponding environment variable, allowing the .npmrc file to be committed to the repository without exposing the token.

Warning
Do not commit a token written directly in .npmrc. The token works with the permissions of the user who generated it.

Package publishing

In package.json, set the name with the workspace scope and the version:

json
{
  "name": "@my-workspace/my-lib",
  "version": "1.0.0"
}

Then publish the package:

bash
npm publish
$

After a successful publish, npm prints + @my-workspace/my-lib@1.0.0, and the 1.0.0 version appears in the artifact's Versions tab.

Image loading...NPM Package artifact versions

Published package versions cannot be overwritten. Package changes require publication of a new version.

Install a package

With the same .npmrc, you install the package like any other:

bash
npm install @my-workspace/my-lib
$

npm view @my-workspace/my-lib versions returns the list of published versions. An NPM Package artifact has no Browse tab, so you check the package content after installation.

Registry usage in pipelines

In the pipeline, save the token as an encrypted NPM_TOKEN variable and add the .npmrc from the section above to the repository. A BUILD action with a Node.js image then installs packages from the Buddy registry:

yaml
- action: Install dependencies
  type: BUILD
  docker_image_name: library/node
  docker_image_tag: "22"
  commands: |-
    npm ci

Variables and their scope are described in Variables.

See also:

Last modified on Dec 3, 2026