npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nodebb-plugin-safe-updater

v2.0.3

Published

Safe NodeBB updater plugin with a one-click update endpoint and CLI fallback.

Readme

NodeBB Safe Updater

A conservative utility that keeps a NodeBB forum up to date safely.

This repository includes a CLI update tool and a NodeBB admin plugin with a one-click update action.

Features

  • Verifies the target directory using Git itself (including linked worktrees).
  • Refuses to run on a dirty working tree unless explicitly allowed.
  • Creates a backup outside the target repository before updating.
  • Fetches the selected branch and only fast-forwards it; existing local commits are not reset.
  • Runs npm install, yarn install, or pnpm install when the project has a package.json.
  • Restricts the NodeBB update endpoint to administrators and prevents overlapping updates.

Install as a NodeBB plugin

  1. Copy the repository into your NodeBB plugin directory, for example plugins/nodebb-safe-updater/.

  2. Configure the environment variables for the NodeBB server as needed:

    export NODEBB_DIRECTORY=/srv/nodebb
    export NODEBB_BRANCH=main
    export NODEBB_REMOTE=origin
    export NODEBB_ALLOW_DIRTY=false
    export NODEBB_SKIP_INSTALL=false
    # Optional; must be outside NODEBB_DIRECTORY
    export NODEBB_BACKUP_ROOT=/var/backups/nodebb-safe-updater
  3. Restart NodeBB, then open Admin → Plugins → NodeBB Safe Updater.

The admin page is /admin/plugins/nodebb-safe-updater; its update endpoint is /api/v3/plugins/nodebb-safe-updater/update. Both are protected by NodeBB's admin middleware.

Standalone web updater

Run npm start to start the optional standalone updater. It binds to 127.0.0.1 by default, serves the UI at /, and accepts updates at /api/update. The UI uses a per-process token and cross-origin requests are rejected. Do not expose this service publicly; use a trusted reverse proxy and appropriate access controls if remote access is required.

Configuration:

export NODEBB_DIRECTORY=/srv/nodebb
export NODEBB_UPDATER_PORT=3000
export NODEBB_UPDATER_HOST=127.0.0.1
# Optional; an ephemeral token is generated when omitted
export NODEBB_UPDATER_TOKEN='use-a-long-random-secret'

CLI usage

Update the current directory:

node src/index.js

Update a specific installation:

node src/index.js --directory /srv/nodebb --branch main --remote origin

Allow a dirty working tree or skip dependency installation:

node src/index.js --directory /srv/nodebb --allow-dirty
node src/index.js --directory /srv/nodebb --skip-install

Safety notes

The updater aborts on a dirty repository by default, creates a backup before updating, and uses git pull --ff-only. --allow-dirty permits the update to proceed with local changes; review the backup and working tree carefully before using it. Backup folders must be outside the target repository.

Example result

{
  "ok": true,
  "directory": "/srv/nodebb",
  "branch": "main",
  "remote": "origin",
  "backupDir": "/tmp/nodebb-safe-updater/nodebb-backup-2026-10-24T12-00-00-000Z",
  "statusBefore": "",
  "statusAfter": "",
  "packageManager": "npm"
}