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-cloudflare-r2

v1.0.6

Published

NodeBB v4 upload provider for Cloudflare R2 (S3-compatible) using environment variables

Readme

nodebb-plugin-cloudflare-r2 (env)

Upload provider for NodeBB v4.x that stores uploads in Cloudflare R2 (S3-compatible).

This build is env-first (no ACP settings page). Configure using environment variables.

Environment variables

Required:

  • NODEBB_R2_ACCESS_KEY_ID
  • NODEBB_R2_SECRET_ACCESS_KEY
  • NODEBB_R2_BUCKET
  • NODEBB_R2_ENDPOINT (example: https://<ACCOUNT_ID>.r2.cloudflarestorage.com)

Optional:

  • NODEBB_R2_REGION (default: auto)
  • NODEBB_R2_UPLOAD_PATH (default: empty)
  • NODEBB_R2_HOST (public base URL returned to NodeBB; default: https://<bucket>)
  • NODEBB_R2_FORCE_PATH_STYLE (true|false, default: false)

Notes:

  • endpoint is the S3 API endpoint (cloudflarestorage.com)
  • host is the public URL base (custom domain / CDN / public bucket URL)

Install

cd /path/to/nodebb
npm i /path/to/nodebb-plugin-cloudflare-r2
./nodebb build
./nodebb restart

Enable plugin in ACP → Extend → Plugins.

Docker Compose example

environment:
  NODEBB_R2_ACCESS_KEY_ID: "xxx"
  NODEBB_R2_SECRET_ACCESS_KEY: "yyy"
  NODEBB_R2_BUCKET: "my-bucket"
  NODEBB_R2_ENDPOINT: "https://<ACCOUNT_ID>.r2.cloudflarestorage.com"
  NODEBB_R2_REGION: "auto"
  NODEBB_R2_UPLOAD_PATH: "uploads"
  NODEBB_R2_HOST: "https://cdn.example.com"
  NODEBB_R2_FORCE_PATH_STYLE: "false"

What it does

  • Hooks: filter:uploadImage, filter:uploadFile
  • Validates extensions using the original filename (fixes drag&drop tmp-path issues)
  • Streams uploads to R2 (does not read entire file into RAM)

Deleting objects when posts are deleted

By default, the plugin deletes objects only when a post is purged (permanent deletion). This avoids breaking restored posts.

If you really want to delete objects on normal (soft) delete too, set:

  • NODEBB_R2_DELETE_ON_SOFT_DELETE=true

Cleaning up objects on topic purge/delete and post edit

  • When a topic is purged (permanently deleted), the plugin will delete all R2 objects referenced by posts in that topic.
  • When a post is edited, the plugin will delete R2 objects that were referenced before the edit but are not referenced anymore after the edit (best-effort).

Soft delete is not permanent in NodeBB, so object deletion is disabled by default.

To also delete objects on soft topic delete, set:

  • NODEBB_R2_DELETE_ON_TOPIC_SOFT_DELETE=true

(For soft post delete, see NODEBB_R2_DELETE_ON_SOFT_DELETE.)

Cleaning up avatars (profile pictures)

When a user changes their avatar/profile picture, the plugin will attempt to delete the previously referenced R2 object (only if the old URL points to your NODEBB_R2_HOST/NODEBB_R2_UPLOAD_PATH). This is best-effort.

Multi-instance / cluster reliability

In multi-instance deployments, cleanup on post edit and avatar changes uses the shared NodeBB database to store a short-lived "before" snapshot (TTL). This keeps cleanup reliable even when different instances handle the before/after hooks.