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

node-red-node-defaults

v1.0.0

Published

Node-RED editor plugin that injects default values into node instances when dropped onto the canvas

Downloads

122

Readme

node-red-node-defaults

A Node-RED editor plugin that automatically injects default values into node instances when they are dropped onto the canvas.

Defaults are defined once in settings.js and apply to every new node of the configured type — no flow-by-flow setup required.

How it works

The plugin has two parts:

| Part | File | Role | |---|---|---| | Server | index.js | Reads nodeDefaults from settings.js, exposes it via a lightweight HTTP endpoint | | Editor | index.html | Fetches the config on load, listens for nodes:add, and injects defaults into each new node instance |

Injection rules (per field)

For each configured field the editor applies these rules in order:

  1. Field is empty (null, undefined, '') → inject
  2. Field matches the node type's built-in default → inject (user never changed it)
  3. Field differs from the built-in default → leave (user set it intentionally)

Credential fields (userid, password, etc.) use rule 1 only — inject if empty, leave if already set.

Existing saved nodes in a flow are never overwritten — injection only applies to nodes added to the canvas after the plugin loads.

Installation

# In your Node-RED user directory (typically ~/.node-red)
npm install node-red-node-defaults

Or during development, link it:

# In this package directory
yarn link

# In your Node-RED user directory
yarn link node-red-node-defaults

Configuration

Add a nodeDefaults object to your Node-RED settings.js. The top-level keys are node type names exactly as registered (e.g. 'e-mail', not the package name).

// settings.js
module.exports = {
  // ... other settings ...

  nodeDefaults: {
    // Outbound SMTP (node-red-node-email)
    'e-mail': {
      server: 'smtp.example.com',
      port: '587',
      secure: false,       // false = STARTTLS on 587; true = TLS on 465
      tls: false,
      authtype: 'BASIC',
      userid: '[email protected]',   // credential field
      password: 'yourpassword'          // credential field
    },

    // Inbound IMAP/POP3 (node-red-node-email)
    'e-mail in': {
      protocol: 'IMAP',
      server: 'imap.example.com',
      port: '993',
      useSSL: true,
      autotls: 'never',    // 'never' | 'required' | 'always'
      box: 'INBOX',
      disposition: 'Read', // 'None' | 'Read' | 'Delete'
      criteria: 'UNSEEN',
      repeat: '300'
    }
  }
}

Finding the correct field names

Field names must match what the node type declares in its defaults or credentials block. The easiest way to find them:

  1. Open the Node-RED editor
  2. Drop the node onto the canvas
  3. Open Browser DevTools → Network → /nodes
  4. Find the node's HTML file and look at RED.nodes.registerType('type-name', { defaults: { ... }, credentials: { ... } })

Security note

Credential values (e.g. userid, password) set in settings.js are returned in plaintext from the /node-defaults/config endpoint to any authenticated browser session that can reach the Node-RED editor. Ensure your Node-RED instance is not publicly accessible when using credential defaults.

Contact

  • Author: William Shostak (https://github.com/wshostak)

License

This project is licensed under the ISC License — see the LICENSE file for more details.

Copyright (c) 2026 William Shostak