Node-RED

On this page 7

Node-RED is an open-source, flow-based programming tool built on Node.js that lets users connect hardware devices, APIs and online services by wiring nodes together in a browser-based visual editor. Among automation platforms, it stands out for its roots in the Internet of Things: it runs equally well on a Raspberry Pi, an industrial gateway, a server or a container, and it handles protocols such as MQTT, Modbus and serial ports alongside HTTP.

Originally created at IBM and later contributed to the OpenJS Foundation, Node-RED is distributed under the Apache 2.0 license and is usually self-hosted. Its typical users range from home automation enthusiasts to engineers building edge and industrial integration for factories and building systems.

How Node-RED flows work

A Node-RED application is a set of flows: directed graphs of nodes connected by wires. Each node performs one function, such as receiving an MQTT message, transforming data or calling an HTTP endpoint, and passes a message object to the next node through its output wire.

The message object, conventionally named msg, is a JavaScript object whose main field msg.payload carries the data. Nodes read and modify msg, and the runtime delivers messages asynchronously and event-driven on the Node.js event loop, so a single process can handle many concurrent flows without threads.

Flows are stored as a JSON file on the host and can be exported and imported as JSON snippets. When a user presses Deploy in the editor, the runtime reloads the changed nodes and the new logic is live within seconds, which makes iteration very fast on development and edge devices alike.

Building blocks and node types

Node-RED ships with a core palette of nodes, and thousands of additional nodes are available as community packages installed through the palette manager. The table groups the most important node categories.

CategoryExample nodesPurpose
Input and triggerinject, mqtt in, http in, tcp inStart a flow on a schedule, message or request
Functionfunction, change, switch, templateTransform data and route messages
Sequencesplit, join, sort, batchWork with arrays and message groups
Networkhttp request, mqtt out, websocketCall or publish to external systems
Storagefile, file in, watchRead and write files
Dashboardgauge, chart, buttonBuild simple operator interfaces
SubflowUser-defined reusable groupPackage repeated logic
Main categories of Node-RED nodes

The function node accepts arbitrary JavaScript, which gives Node-RED much of its flexibility. It is also a common source of complexity: flows that hide most of their logic inside large function nodes lose the readability that makes visual programming valuable.

Deployment and state management

Node-RED runs as a single Node.js process that serves both the editor and the runtime. Common deployment targets include single-board computers, Docker containers, virtual machines and industrial edge devices from several hardware vendors.

Short-term data can be kept in context storage at three scopes: node, flow and global. By default, context lives in memory and is lost on restart, unless a file-based or custom context store is configured. Durable business data therefore belongs in a database or external system, not in context variables.

Security is the deployer’s responsibility. A fresh installation exposes the editor without authentication, so production systems must enable admin authentication, serve the editor over HTTPS and restrict network access. Projects mode adds Git-based version control for flows, which supports code review and rollback.

Node-RED compared with other automation platforms

Node-RED shares the visual, node-based approach of several automation platforms but differs in hosting model, target users and protocol focus. The comparison below places it among neighboring tools.

PlatformHostingPrimary focusDurable long-running workflows
Node-REDSelf-hosted, edge to cloudIoT, protocols, event wiringLimited without extra design
n8nSelf-hosted or cloudBusiness app integrationPartial, with execution storage
ZapierCloud onlySaaS trigger-action automationLimited
Apache AirflowSelf-hosted or managedScheduled data pipelinesYes, batch-oriented
TemporalSelf-hosted or cloudDurable code-defined workflowsYes, core design
Node-RED and related automation platforms

The key distinction is that Node-RED is a stream and event wiring tool rather than a durable workflow engine. It excels at reacting to messages in real time, but it does not natively persist each step of a multi-day process, so approval chains and long transactions are usually better served by a dedicated engine.

Choosing Node-RED and avoiding common pitfalls

Node-RED is a strong choice when automation must run close to devices, speak industrial or IoT protocols, or operate without cloud dependency. It is a weaker choice for complex business processes that require audit trails and guaranteed completion.

SituationFitReason
Sensor data to a dashboard or databaseStrongNative MQTT and Modbus support
Home or building automationStrongRuns on small devices, large community palette
Quick API glue and prototypesGoodFast visual iteration
Multi-day approval workflowsWeakNo built-in durable state per step
High-volume data pipelinesModerateSingle process limits throughput
When Node-RED fits
  • Unsecured editor: an exposed editor allows anyone to run arbitrary code on the host.
  • Spaghetti flows: very large tabs without subflows or link nodes become hard to maintain.
  • Unpinned community nodes: unmaintained packages can break on Node.js upgrades.
  • Relying on in-memory context: values vanish after a restart unless persistence is configured.

Put simply

Node-RED is like a set of building blocks for automation that you connect with lines on a screen. One block listens to a temperature sensor, another checks whether the value is too high, and a third sends an alert. You draw the connections instead of writing a full program.

Because it is free and small enough to run on a tiny computer, Node-RED is popular for connecting machines, sensors and online services in homes, workshops and factories.

In practice

A small plastics manufacturer wants to monitor twelve injection molding machines that expose data through Modbus TCP. A maintenance engineer installs Node-RED on an industrial edge computer in the hall and builds a flow that polls each machine every five seconds, normalizes temperatures and cycle counts, and publishes them over MQTT to the company’s monitoring server.

A second flow watches for barrel temperatures outside the allowed range and sends a message to the shift leader’s phone. The engineer enables admin authentication and Git-based projects so changes are reviewed. Within weeks, the team spots a heater fault before it scraps a production batch, and the whole setup runs without any cloud subscription.