or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

common-nodes.mdfunction-nodes.mdindex.mdnetwork-nodes.mdparser-nodes.mdsequence-nodes.mdstorage-nodes.md
tile.json

tessl/npm-node-red--nodes

Core nodes collection for Node-RED runtime providing fundamental building blocks for visual programming flows

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@node-red/nodes@2.0.x

To install, run

npx @tessl/cli install tessl/npm-node-red--nodes@2.0.0

index.mddocs/

@node-red/nodes

The @node-red/nodes package provides the complete collection of core nodes for the Node-RED visual programming platform. These nodes serve as fundamental building blocks that developers use to create flows for event-driven applications, IoT automation, data integration, and industrial systems. Each node type provides specific functionality and can be connected together to build complex workflows without traditional coding.

Package Information

  • Package Name: @node-red/nodes
  • Package Type: npm
  • Language: JavaScript
  • Installation: npm install @node-red/nodes

Core Imports

Important: This package is designed to be loaded by the Node-RED runtime, not imported directly by applications. The main entry point exports false:

// This package is not intended for direct import
// const nodes = require('@node-red/nodes'); // exports false

// Instead, nodes are registered with Node-RED runtime:
module.exports = function(RED) {
    // Node definitions register themselves with RED
    RED.nodes.registerType("node-type", NodeConstructor);
};

Basic Usage

@node-red/nodes is consumed by the Node-RED runtime during startup. Users interact with these nodes through the Node-RED visual editor by dragging nodes from the palette and connecting them to create flows:

// Example of how Node-RED runtime loads this package
// (This happens automatically when Node-RED starts)

// Each node follows this registration pattern:
module.exports = function(RED) {
    function InjectNode(config) {
        RED.nodes.createNode(this, config);
        
        this.on("input", function(msg, send, done) {
            // Process incoming messages
            send(msg); // Forward to next node
            done();    // Signal completion
        });
    }
    
    RED.nodes.registerType("inject", InjectNode);
};

Architecture

The @node-red/nodes package is organized into six core categories:

  • Common Nodes: Basic flow control and debugging utilities
  • Function Nodes: Data processing, transformation, and custom logic execution
  • Network Nodes: Communication protocols (HTTP, MQTT, WebSocket, TCP/UDP)
  • Parser Nodes: Data format conversion (JSON, XML, CSV, HTML, YAML)
  • Sequence Nodes: Message flow control and batching operations
  • Storage Nodes: File system operations and monitoring

Each node is implemented as a factory function that receives the Node-RED runtime (RED) and registers itself with a specific node type name. The runtime manages node lifecycle, message routing, and configuration.

Capabilities

Common Flow Control

Essential nodes for flow control, debugging, and basic automation including manual triggers, error handling, and debugging output.

// Inject node - manual/scheduled triggers
function InjectNode(config) { /* ... */ }

// Debug node - output messages for debugging  
function DebugNode(config) { /* ... */ }

// Catch node - error handling
function CatchNode(config) { /* ... */ }

Common Nodes

Function and Logic

Data processing capabilities including custom JavaScript execution, conditional routing, data transformation, and templating.

// Function node - custom JavaScript execution
function FunctionNode(config) { /* ... */ }

// Switch node - conditional message routing
function SwitchNode(config) { /* ... */ }

// Change node - modify message properties
function ChangeNode(config) { /* ... */ }

Function Nodes

Network Communication

Comprehensive networking capabilities supporting HTTP servers and clients, MQTT messaging, WebSocket connections, and TCP/UDP communication.

// HTTP endpoints
function HTTPInNode(config) { /* ... */ }
function HTTPRequestNode(config) { /* ... */ }

// MQTT messaging  
function MqttInNode(config) { /* ... */ }
function MqttOutNode(config) { /* ... */ }

// WebSocket connections
function WebSocketInNode(config) { /* ... */ }

Network Nodes

Data Parsing

Data format conversion utilities for working with JSON, XML, CSV, HTML, and YAML formats with parsing and generation capabilities.

// JSON parse/stringify
function JSONNode(config) { /* ... */ }

// XML parse/generate
function XMLNode(config) { /* ... */ }

// CSV parse/generate  
function CSVNode(config) { /* ... */ }

Parser Nodes

Sequence Control

Message sequence manipulation including splitting, joining, sorting, and batching operations for handling arrays and message streams.

// Split messages into sequences
function SplitNode(config) { /* ... */ }

// Join sequences back together
function JoinNode(config) { /* ... */ }

// Sort message sequences
function SortNode(config) { /* ... */ }

Sequence Nodes

File Operations

File system interaction capabilities for reading, writing, and monitoring files and directories.

// File read/write operations
function FileNode(config) { /* ... */ }
function FileInNode(config) { /* ... */ }

// File system monitoring
function WatchNode(config) { /* ... */ }

Storage Nodes

HTTP Administration Endpoints

Several nodes expose HTTP endpoints for remote control and monitoring:

// Debug control endpoints
POST /debug/:state           // Global debug control
POST /debug/:id/:state       // Individual node control
GET  /debug/view/view.html   // Debug viewer interface

// Inject control endpoint  
POST /inject/:id             // Trigger inject nodes remotely

// UDP port information
GET  /udp-ports/:id          // Get UDP port details
GET  /debug/view/*           // Debug viewer static resources

Configuration Node Types

Configuration nodes provide shared settings for other nodes:

// MQTT broker configuration
function MqttBrokerNode(config) { /* ... */ }

// TLS/SSL configuration
function TLSConfigNode(config) { /* ... */ }

// HTTP proxy configuration  
function HttpProxyNode(config) { /* ... */ }

// WebSocket server configuration
function WebSocketListenerNode(config) { /* ... */ }

// WebSocket client configuration
function WebSocketClientNode(config) { /* ... */ }

Types

// Standard Node-RED message structure
interface NodeMessage {
    payload: any;           // Main message content
    topic?: string;         // Message topic/subject
    _msgid: string;         // Unique message identifier
    [key: string]: any;     // Additional properties
}

// Node configuration base
interface NodeConfig {
    id: string;             // Unique node ID
    type: string;           // Node type name
    name?: string;          // Optional display name
    [key: string]: any;     // Node-specific configuration
}

// Node constructor function signature  
type NodeRegistrationFunction = (RED: NodeREDRuntime) => void;

// Node instance methods
interface NodeInstance {
    on(event: string, handler: Function): void;
    send(msgs: NodeMessage | NodeMessage[]): void;
    error(error: string | Error, msg?: NodeMessage): void;
    warn(warning: string): void;
    log(message: string): void;
}