Deployment platforms
A deployment build needs a read token to install private, Pool, or Marketplace packages from LPM.dev Registry. Give the token to the build as LPM_TOKEN. Keep the token out of source control, images, artifacts, and build caches.
Choose the install path
LPM CLI reads the token from LPM_TOKEN:
npm install -g @lpm-registry/cli
lpm ci
Use this path for projects that use lpm.lock.
npm, Yarn 1, and Bun read the registry of the @lpm.dev scope and its token from .npmrc. Commit a .npmrc that reads the token from LPM_TOKEN:
@lpm.dev:registry=https://lpm.dev/api/registry/
//lpm.dev/api/registry/:_authToken=${LPM_TOKEN}
The file contains no token, so you can commit it. At install time, the package client replaces ${LPM_TOKEN} with the value of the environment variable. Do not commit an .npmrc that contains a literal token.
The committed token line also applies on developer machines. There, npm, Yarn 1, and Bun use it instead of a token line in ~/.npmrc. Each developer who installs the project with them must also set LPM_TOKEN.
Since pnpm 10.34.2 and 11.5.3, pnpm does not replace environment variables in a token line of the project .npmrc. It ignores the line and prints a warning. Commit the same .npmrc, and use one of these options:
- With pnpm 11 or later, set
PNPM_CONFIG_NPMRC_AUTH_FILEto.npmrcin the build environment. pnpm then reads the token line of the committed file. Set this variable only in the builds of your own repository. - With any pnpm version, store the token in npm's user configuration in the install command:
npm config set "//lpm.dev/api/registry/:_authToken" "$LPM_TOKEN" && pnpm install --frozen-lockfile
Yarn 2 and later do not read .npmrc. Commit a .yarnrc.yml that reads the token from LPM_TOKEN:
npmScopes:
lpm.dev:
npmRegistryServer: "https://lpm.dev/api/registry/"
npmAuthToken: "${LPM_TOKEN}"
If LPM_TOKEN is not set, Yarn stops every command with the error Environment variable not found (LPM_TOKEN).
lpm setup local and lpm setup ci npmrc stop in a project that commits this token line. CI/CD shows a CI setup that commits no token line.
Keep the trailing slash in the registry URL. Without it, Bun removes /api/registry from the URL. Only @lpm.dev/* packages use this route. Public npm packages and other configured scopes keep their own registries.
Create a deployment credential
Create a read token in your personal token settings or in the token settings of the organization.
Use a separate token for deployments. Do not use an LPM CLI session or a publish token. If you must revoke or audit each deployment context on its own, give each context its own token.
A token expires after 7, 30, 60, or 90 days. Replace the LPM_TOKEN value before the token expires.
LPM.dev Registry revokes an organization token when its creator leaves the organization or loses the Owner or Admin role. Then the build needs a new token.
Vercel
- Open the Vercel project.
- Open "Settings", then "Environment Variables".
- Add
LPM_TOKENto each deployment environment that installs LPM.dev Registry packages. - Redeploy.
For npm, Yarn, or Bun, commit the .npmrc or .yarnrc.yml from Choose the install path. The default install command of Vercel then reads the token from the build environment. For pnpm, also use one of the pnpm options in that section.
To install with LPM CLI, set the install command of the project to:
npm install -g @lpm-registry/cli && lpm ci
Keep a separate build command, such as npm run build.
Netlify
- Open the Netlify site.
- Open "Site configuration", then "Environment variables".
- Add
LPM_TOKENfor each deploy context that installs LPM.dev Registry packages. - Start a new deploy.
The committed .npmrc or .yarnrc.yml works with the automatic dependency install of Netlify. For pnpm, also set PNPM_CONFIG_NPMRC_AUTH_FILE to .npmrc. This option needs pnpm 11 or later.
To install with LPM CLI, use this build command:
npm install -g @lpm-registry/cli && lpm ci && npm run build
Use this command only if the site leaves dependency installation to the build command. Otherwise, the automatic install of Netlify still needs the committed .npmrc.
To use the same LPM CLI version in each production build, pin the package version in the build command.
Docker with LPM CLI
Give the token to the build through a BuildKit secret mount. Do not pass LPM_TOKEN through ARG. Do not write it into an image layer.
# syntax=docker/dockerfile:1.7
FROM node:22-bookworm-slim
RUN npm install -g @lpm-registry/cli
WORKDIR /app
COPY lpm.lock ./
RUN --mount=type=secret,id=lpm_token \
LPM_TOKEN="$(cat /run/secrets/lpm_token)" \
lpm fetch --platform linux/x64/glibc
COPY package.json ./
RUN lpm install --offline --frozen-lockfile --prod
COPY . .
CMD ["node", "server.js"]
Pass the secret from the build environment:
docker build --secret id=lpm_token,env=LPM_TOKEN -t myapp .
Only the lpm fetch step can read the token. The lpm install --offline step installs from the LPM CLI store that lpm fetch filled. It makes no LPM.dev Registry request and needs no token.
Set --platform to match the runtime image. Use linux/x64/glibc for Debian-based x64 images and linux/x64/musl for Alpine x64 images. The LPM CLI Docker guide explains workspaces, lpm deploy, local dependencies, and fetches for other platforms.
For the LPM CLI build, add a .dockerignore file. It keeps local credentials and environment files out of the build context:
node_modules
.lpm
.npmrc
.env*
.git
Docker with npm
If the project installs with npm, copy the committed .npmrc that reads ${LPM_TOKEN}. Mount the token for the install step only:
# syntax=docker/dockerfile:1.7
FROM node:22-bookworm-slim
WORKDIR /app
COPY package.json package-lock.json .npmrc ./
RUN --mount=type=secret,id=lpm_token \
LPM_TOKEN="$(cat /run/secrets/lpm_token)" \
npm ci
COPY . .
CMD ["node", "server.js"]
Pass the token with the same docker build --secret command. This build needs .npmrc in the build context, so do not list it in .dockerignore. Make sure that the file contains ${LPM_TOKEN} and no literal token.
Credential hygiene
- Use read tokens for builds that only install packages.
- Do not print
LPM_TOKENor upload.npmrcas an artifact. - Do not pass the token through Docker
ARGorENV. - Give hosted-platform variables only to the deployment contexts that need them.
- If a token is exposed, revoke it and create a new one.
See also
- CI/CD explains package installs and publish automation.
- Authentication explains LPM CLI sessions and read tokens.
- The LPM CLI Docker guide explains store warming, offline installs, and workspace deployment images.
- The LPM CLI setup reference explains how to generate
.npmrcfor CI or local development.