Core nodes collection for Node-RED runtime providing fundamental building blocks for visual programming flows
npx @tessl/cli install tessl/npm-node-red--nodes@2.0.0The @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.
npm install @node-red/nodesImportant: 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);
};@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);
};The @node-red/nodes package is organized into six core categories:
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.
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) { /* ... */ }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) { /* ... */ }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) { /* ... */ }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) { /* ... */ }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) { /* ... */ }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) { /* ... */ }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 resourcesConfiguration 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) { /* ... */ }// 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;
}