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, pnpm, 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.
In a CI job, lpm setup ci npmrc can write the token into .npmrc instead. That command stops if Git tracks .npmrc. CI/CD compares the two options.
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 an npm-compatible install, commit the .npmrc from Choose the install path. The default install command of Vercel then reads the token from the build environment.
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 works with the npm-compatible dependency install of Netlify. 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.