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

@stfi/node-red-dashboard-2-ui-qrcode-scanner

v1.0.4

Published

A QR-Code / Barcode scanner widget for Node-RED Dashboard 2.0, based on the popular html5-qrcode lib.

Readme

node-red-dashboard-2-ui-qrcode-scanner

A QR-code / barcode scanner widget for Node-RED Dashboard 2.0, based on the popular html5-qrcode lib. The widget renders a live camera preview inside a Dashboard 2.0 group and emits a Node-RED message every time a code is decoded.

type:ui-qrcode-scanner

Demo

Please note:

  • HTTPS (or http://localhost like in the example) is required for camera access. Mobile browsers do not enable the camera when using plain HTTP.
  • There is a workaround available via Chrome Flags (chrome://flags/#unsafely-treat-insecure-origin-as-secure) or Edge Flags (edge://flags/#unsafely-treat-insecure-origin-as-secure). These flags allow you to declare insecure URLs as secure, thereby enabling camera access.
  • However, this approach is recommended only during the development phase. In a production environment, Node-RED should be operated in HTTPS mode. This requires an appropriate HTTPS certificate, which is typically provided by the IT department.

Features

  • Works with QR codes plus every other format supported by html5-qrcode (Aztec, Code 39 / 93 / 128, Data Matrix, EAN-13 / 8, ITF, PDF-417, UPC-A / E, ...).
  • Responsive camera preview — fills the widget width at a configurable aspect ratio.
  • Front or rear camera selection, or facing-mode auto-detect.
  • Cookie-based camera memory — when controls are visible the last selected camera is stored in a browser cookie (nrdb-qrs-cam) and restored automatically on the next page load.
  • Fixed camera by index — when controls are hidden, a specific camera can be pre-selected by its OS-assigned index (Camera 1, Camera 2, …).
  • Configurable FPS, scan-box size and aspect ratio. The scan box scales with the widget size automatically.
  • Auto-start, stop-on-scan, and torch toggle (where the device supports it).
  • Optional suppression of the "Last scan" result display.
  • Programmatic control via msg.action = 'start' | 'stop' | 'toggle' | 'torchOn' | 'torchOff'.
  • Runtime overrides of every option via msg.ui_update.

Installation

From your Node-RED user directory (usually ~/.node-red):

npm install node-red-dashboard-2-ui-qrcode-scanner

Then restart Node-RED. A new node qr-code scanner appears in the dashboard 2 category.

Installing from source

cd ~/.node-red
npm install /path/to/checkout-of-node-red-contrib-html5-qrcode-scanner

This puts an entry in ~/.node-red/package.json whose key is node-red-dashboard-2-ui-qrcode-scanner, which is what Dashboard 2 scans for. If you previously installed the package under the node-red-contrib-html5-qrcode-scanner name, uninstall it first (npm uninstall node-red-contrib-html5-qrcode-scanner) or the widget will continue to fall back to ui-template.

Outputs

| Property | Type | Description | | ------------- | ------ | ------------------------------------------------------ | | msg.payload | string | The decoded text. | | msg.topic | string | qrcode for scans, qrcode/error for runtime errors. | | msg.qrcode | object | { text, format, result } – the raw decoder result. | | msg.error | string | Present when topic === 'qrcode/error'. |

Inputs

Send a message in to control the scanner at runtime.

// Start / stop / toggle the scanner
msg = { action: 'start' }
msg = { action: 'stop' }
msg = { action: 'toggle' }

// Torch (where supported by the device + browser)
msg = { action: 'torchOn' }
msg = { action: 'torchOff' }

// Change configuration on the fly
msg = { ui_update: { fps: 15, cameraFacingMode: 'user', stopOnScan: true } }

Demo

Configuration

| Option | Default | Description | | ------------------ | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | fps | 10 | Frames per second the scanner samples at. | | qrboxWidth | 250 | Width (px) of the scanning region inside the preview. | | qrboxHeight | 250 | Height (px) of the scanning region inside the preview. | | aspectRatio | (auto) | e.g. 1.7778 for 16:9. Leave blank to let the browser decide. | | cameraFacingMode | environment | environment (rear) or user (front). Used as fallback when no cookie or camera index is set. | | cameraIndex | 0 (auto) | Force a specific camera by its OS-assigned index (1 = first, 2 = second, …). Only shown in the node editor when Hide start/stop controls is enabled. The camera sequence is determined by the operating system. | | autoStart | true | Start the scanner as soon as the widget loads. | | stopOnScan | false | Stop the scanner after each successful scan. | | hideControls | false | Hide the start/stop/camera/torch buttons. | | showTorch | false | Show a torch toggle while scanning (if the camera supports it). | | disableFlip | false | Disable the mirrored-image scanning attempt (slightly faster). | | hideLastResult | false | Hide the "Last scan" result box below the video area. | | startLabel | Start scanning | Label of the start button. | | stopLabel | Stop scanning | Label of the stop button. |

Camera selection priority

When the widget mounts it picks the initial camera in this order:

  1. Cookie (nrdb-qrs-cam) — the camera the user last selected manually, if it is still present in the device's camera list. Only consulted when controls are visible.
  2. Camera index — if cameraIndex is set to a value > 0.
  3. Facing-mode label matching — searches camera labels for back/rear/environment or front/user/face keywords, depending on cameraFacingMode.
  4. First available camera — fallback.

Example flow

An example flow is included in examples/qrcode-scanner.json. Import it through Menu → Import → Examples → node-red-contrib-html5-qrcode-scanner after installation.

Building from source

git clone https://github.com/boehand/node-red-contrib-html5-qrcode-scanner
cd node-red-contrib-html5-qrcode-scanner
npm install
npm run build

The build emits resources/ui-qrcode-scanner.umd.js, which Dashboard 2.0 loads automatically.

Author

Created by boehand using Claude Sonnet 4.6

License

Apache-2.0 – see LICENSE.

Built on top of html5-qrcode by Minhaz (also Apache-2.0).