Verdaccio In-Memory Authentication Plugin

10.3.2 · active · verified Wed Apr 22

verdaccio-auth-memory is an authentication plugin for Verdaccio, a lightweight private npm proxy registry. It is designed to store user credentials and session data exclusively in runtime memory. This crucial design choice means that all user information, including registered users and active sessions, will be lost upon any restart of the Verdaccio server. The current stable version is 10.3.2. As part of the Verdaccio monorepo, it follows a coordinated release schedule with the main Verdaccio project and other associated plugins. Its primary differentiator is its ephemeral nature, making it explicitly unsuitable for production environments that require persistent user management. Instead, it is primarily intended for development, testing (e.g., unit tests, CI environments), or transient demonstration purposes where data loss on restart is acceptable and even desired for a clean state.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to install Verdaccio and the `verdaccio-auth-memory` plugin, then configure a basic `config.yaml` to enable in-memory authentication with predefined users. It then shows how to start Verdaccio and use `npm adduser` to interact with the in-memory registry.

# 1. Install Verdaccio globally (if not already installed)
npm install -g verdaccio

# 2. Install the in-memory authentication plugin
npm install -g verdaccio-auth-memory

# 3. Configure Verdaccio to use the plugin.
#    Create or edit your Verdaccio config.yaml (usually in ~/.config/verdaccio/config.yaml)
#    Ensure you remove or comment out any other 'auth' plugin, like 'htpasswd'.
#    For example, a minimal config.yaml might look like this:

# config.yaml
# ===============================
store:
  memory:
    limit: 1000 # Max number of packages in memory

auth:
  auth-memory:
    users:
      devuser:
        name: devuser
        password: password123
      testuser:
        name: testuser
        password: securepass

uplinks:
  npmjs:
    url: https://registry.npmjs.org/

packages:
  '@*/*':
    access: $all
    publish: $authenticated
    proxy: npmjs

  '**':
    access: $all
    publish: $authenticated
    proxy: npmjs
# ===============================

# 4. Start Verdaccio
verdaccio

# Now, you can log in using the configured users:
npm adduser --registry http://localhost:4873
# When prompted, use 'devuser' and 'password123'

view raw JSON →