← All templates · Developer tools
Deploy Verdaccio in one click
A private npm registry for your own packages, which also caches npm’s
A self-hosted alternative to npm Teams, GitHub Packages, and JFrog Artifactory.
What is Verdaccio?
Verdaccio is a lightweight private npm registry, which teams and solo developers run in place of npm’s paid private packages, GitHub Packages or JFrog Artifactory. You publish packages to it with npm publish, and install them with npm, yarn or pnpm as from npmjs. It needs no database: packages and their metadata are files on its disk.
It is also a proxy of the public registry: a package it does not hold comes from npmjs through its uplink and is kept, so later installs come from Verdaccio, not from npmjs, and a scope such as @yourname can stay private while everything else comes from npm. Its web page shows each package’s readme, versions and dependencies.
This template runs Verdaccio with its storage in a volume and one account, the username and password you give, written into its htpasswd file at every start. Sign-up is off, and packages, your own and npm’s, are read and installed only by a user who signed in, so the registry is no open mirror for strangers.
Hosting Verdaccio on Pethost
- You sign in to Pethost with a passkey, GitHub or Google. No machine yet? You pick a plan, and the link waits until it is ready.
- New project opens at Verdaccio. You fill in what it asks for and click Create project: Username, Admin password.
- In a minute or two Verdaccio is live at its own address with HTTPS. Its secrets are made at random, and its data is in the nightly backup.
- It is a project like any other: you or your agent can change it, roll it back or restore it.
Questions about Verdaccio
Is Verdaccio free?
Yes. Verdaccio is open source under the MIT license, with no paid edition, and running it yourself costs only the server.
How do I publish a package to Verdaccio?
Run npm login --registry https://your-address/ with your username and password, then npm publish --registry https://your-address/ in the package’s folder. Setting publishConfig.registry in package.json or registry in .npmrc saves typing the address each time.
Can Verdaccio install public packages too?
Yes. A package that is not on Verdaccio is fetched from npmjs through its uplink and cached, so you can point npm, yarn or pnpm at Verdaccio alone and get both your packages and public ones. In this template, installing needs a signed-in user too.
Does Verdaccio work with yarn and pnpm?
Yes. Verdaccio speaks the npm registry’s protocol, so npm, yarn and pnpm publish to it and install from it once their registry setting points at its address and they have its token.
How much memory and disk does Verdaccio need?
Verdaccio is light: about 100 MB of memory; its disk holds your packages and the public ones installed through it, a few megabytes each. On Pethost the Starter plan is enough for it, with room for other apps beside it.
Verdaccio Docker Compose file
The template is this compose.yaml and the variables written into the project’s .env as it is created. Pethost runs the file as it is written.
Containers: verdaccio (verdaccio/verdaccio:6).
Volumes, in the nightly backup: storage.
services:
verdaccio:
image: verdaccio/verdaccio:6
restart: unless-stopped
environment:
VERDACCIO_PUBLIC_URL: ${URL}
ADMIN_USERNAME: ${ADMIN_USERNAME}
ADMIN_PASSWORD: ${ADMIN_PASSWORD}
# The administrator's line of the htpasswd file is written from the username and password
# given at every start, so its password is the one in the project's .env; the other lines,
# users the administrator added, stay as they are.
command:
- /bin/sh
- -c
- |
node -e '
const fs = require("node:fs");
const bcrypt = require("/usr/local/lib/node_modules/verdaccio/node_modules/bcryptjs");
const file = "/verdaccio/storage/htpasswd";
const { ADMIN_USERNAME: name, ADMIN_PASSWORD: password } = process.env;
const lines = fs.existsSync(file) ? fs.readFileSync(file, "utf8").split("\n") : [];
const others = lines.filter((line) => line && !line.startsWith(name + ":"));
fs.writeFileSync(file, [...others, name + ":" + bcrypt.hashSync(password, 10)].join("\n") + "\n", { mode: 0o600 });
' || exit 1
unset ADMIN_PASSWORD
exec verdaccio --config /verdaccio/conf/config.yaml --listen http://0.0.0.0:4873
configs:
- source: config
target: /verdaccio/conf/config.yaml
volumes:
- storage:/verdaccio/storage
configs:
config:
content: |
storage: /verdaccio/storage/data
plugins: /verdaccio/plugins
web:
title: Verdaccio
auth:
htpasswd:
file: /verdaccio/storage/htpasswd
# Nobody signs up with npm adduser: users are lines of the file, which the administrator adds.
max_users: -1
uplinks:
npmjs:
url: https://registry.npmjs.org/
# Only users who signed in install or publish, so the registry is no open mirror of npm.
packages:
'@*/*':
access: $$authenticated
publish: $$authenticated
unpublish: $$authenticated
proxy: npmjs
'**':
access: $$authenticated
publish: $$authenticated
unpublish: $$authenticated
proxy: npmjs
server:
keepAliveTimeout: 60
middlewares:
audit:
enabled: true
log:
type: stdout
format: pretty
level: http
volumes:
storage:
More in Developer tools
- GiteaGit hosting with pull requests and issues
- code-serverVS Code in the browser
- KrokiDiagrams from text: PlantUML, Mermaid, Graphviz and more
- CoderRemote development environments from Terraform templates, opened in VS Code, JetBrains, a browser or over SSH
- HasuraInstant GraphQL and REST APIs over a Postgres database, with permissions, events and a web console
- InsForgeA backend for apps that coding agents build: Postgres, auth, storage and edge functions