Deployment Platforms

Vercel

Add LPM_TOKEN as an environment variable in your Vercel project:

  1. Go to your project on vercel.com
  2. Navigate to Settings > Environment Variables
  3. Add LPM_TOKEN with your auth token
  4. Redeploy

Vercel runs npm install during builds, which will use the token to authenticate with the LPM registry.

If your project does not have an .npmrc file, add one to your repository root:

@lpm.dev:registry=https://lpm.dev/api/registry
//lpm.dev/api/registry/:_authToken=${LPM_TOKEN}

Netlify

Add LPM_TOKEN as an environment variable:

  1. Go to your site on app.netlify.com
  2. Navigate to Site configuration > Environment variables
  3. Add LPM_TOKEN with your auth token
  4. Trigger a new deploy

Add an .npmrc file to your repository if you do not have one:

@lpm.dev:registry=https://lpm.dev/api/registry
//lpm.dev/api/registry/:_authToken=${LPM_TOKEN}

Docker

Use a multi-stage build to keep your token out of the final image:

# Build stage
FROM node:20-alpine AS builder

WORKDIR /app
COPY package*.json .npmrc ./

ARG LPM_TOKEN
RUN echo "//lpm.dev/api/registry/:_authToken=${LPM_TOKEN}" >> .npmrc
RUN npm install
RUN rm .npmrc

COPY . .
RUN npm run build

# Production stage
FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app .
CMD ["node", "server.js"]

Build with the token as a build argument:

docker build --build-arg LPM_TOKEN=your-token -t myapp .

The token is only available during the build stage and is not included in the final image.

General Pattern

Any platform that runs npm install during builds can use LPM packages. The requirements are:

  1. An .npmrc file with the @lpm.dev registry configured
  2. The LPM_TOKEN environment variable set with a valid auth token

If the platform supports a pre-install script, you can also run lpm setup instead of maintaining an .npmrc file manually.