Package Exports
- verdaccio-auth-db
- verdaccio-auth-db/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (verdaccio-auth-db) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Verdaccio Plugin DB
A powerful SQLite-backed plugin to manage users, groups, and fine-grained package access in Verdaccio. This plugin includes a complete interactive CLI for all operations, making it easy to control who can access, publish, or unpublish packages in your private registry.
Features
- User & Group Management: Add, update, and remove users and groups.
- Fine-Grained Access Control: Assign package-level actions (
access
,publish
,unpublish
, etc.) to groups for any package scope. - Menu-Driven CLI: Navigate an interactive menu to manage users, groups, package scopes, and access permissions.
- Self-contained: All data is stored in a single SQLite file, no external DB server required.
- Easy Verdaccio Integration: Just configure the plugin and point it to your database file.
Table of Contents
Installation
Place this plugin in your Verdaccio
plugins
folder or clone this repository.Install dependencies:
npm install
(Optional) Build TypeScript:
npm run build
How It Works
This plugin manages all authentication, groups, and access permissions in an SQLite database. Every user, group, package scope, and access rule is stored and can be managed using the provided CLI.
Schema:
user
: User accounts with hashed passwords.group
: Named groups for organizing permissions.user_group
: Links users to groups.package_access
: Package scopes (supports wildcards like@*/*
,**
, etc.).package_action
: Actions available for packages.package_access_group
: Defines which group has which action on which package scope.
Usage - CLI
How to Start the CLI
You can use the CLI in two ways:
1. Running directly with Node
node cli.js <path-to-your-db-file>
Example:
node cli.js ./verdaccio-auth.db
2. Installing globally and using as a command
After publishing or linking the package globally, you can run:
npm install -g verdaccio-auth-db
verdaccio-auth-db <path-to-your-db-file>
Example:
verdaccio-auth-db ./verdaccio-auth.db
If the database file does not exist, it will be created and seeded with initial users, groups, and permissions.
Menu Structure
You will be greeted by the Main Menu:
==== MAIN MENU ====
1 - Manage users
2 - Manage groups
3 - Manage packages
4 - Recreate database (WARNING: This will delete all data)
5 - Show help
0 - Exit
Navigate using the menu numbers.
User Commands
Within "Manage users":
1
- List users2
- Add user3
- Update user password4
- Delete user0
- Back
Group Commands
Within "Manage groups":
1
- List groups2
- Add group3
- Update group4
- Delete group5
- Add user to group6
- Remove user from group0
- Back
Package Commands
Within "Manage packages":
1
- List package scopes2
- Add package scope3
- Update package scope4
- Delete package scope5
- Add group/action to package6
- Remove group/action from package0
- Back
Supported actions:
access
, publish
, unpublish
Database Management
Option
4
in the main menu: Recreate database (WARNING: This will delete all data)- This will drop and recreate the database with the default structure and initial data.
Integrating with Verdaccio
Build the plugin if necessary:
npm run build
Copy your SQLite database file and this plugin to your Verdaccio server or plugins folder.
Edit your
config.yaml
in Verdaccio:auth: auth-db: path: ./verdaccio-auth.db
- Replace
auth-db
with your plugin name if you changed it. - Make sure the path to your
.db
file is correct.
- Replace
Restart Verdaccio.
- The plugin will now control all authentication and access logic.
Configuration
- You do not need to set environment variables.
- Pass the database file location as an argument when running the CLI.
- If running as a plugin, Verdaccio will use the path you set in
config.yaml
.
Development
- Written in TypeScript.
- Uses
better-sqlite3
for SQLite access. - Modular code, easy to extend.
- PRs and contributions are welcome!
License
MIT
Have questions or need help? Open an issue or pull request on the repository!