DEV Community

Cover image for Open Source Project #141: Node-RED — Visual Programming for Wiring Hardware, APIs, and Online Services Together
WonderLab
WonderLab

Posted on

Open Source Project #141: Node-RED — Visual Programming for Wiring Hardware, APIs, and Online Services Together

Introduction

"You have a temperature sensor, an MQTT broker, and a Slack channel. How much code do you write to connect all three?"

This is article #141 in the "One Open Source Project a Day" series. Today's project is Node-RED — a visual, low-code programming tool maintained by the OpenJS Foundation, built specifically for "wiring things together": hardware sensors, industrial equipment, REST APIs, databases, message queues. Any data flow between two points comes together in Node-RED by dragging nodes and drawing connections.

The design premise is concrete: a factory has a PLC and you want its data in InfluxDB and displayed on Grafana; your home automation setup needs specific conditions to trigger specific actions; you have a collection of SaaS APIs that should communicate on certain events. For "event fires → process → forward" flows, Node-RED's visual editor is the tool built for exactly this.

23,500 Stars. Apache 2.0. OpenJS Foundation project. Node-RED 5 released in 2026.

What You'll Learn

  • What Node-RED does across four core use cases
  • Flow-based programming concepts: nodes, wires, messages, flows
  • Industrial IoT protocols: MQTT, OPC-UA, Modbus
  • Node-RED 5's new features: Explorer panel, dark theme, redesigned editor
  • How Node-RED, n8n, and Airflow differ in scope
  • Installation on Raspberry Pi and servers

Prerequisites

  • Familiarity with basic networking concepts (HTTP, WebSocket)
  • Awareness of MQTT or IoT is helpful but not required
  • No Node.js development experience needed — non-programmers are an explicit target audience

What Node-RED Does

Use Case 1: Industrial Equipment Data Collection and Monitoring

The prototypical industrial IoT scenario. A factory runs dozens of aging machines exposing sensor data over Modbus or OPC-UA, with no modern interfaces.

Node-RED's role:

PLC / sensors (OPC-UA)
    → Node-RED (read data → format conversion → threshold check)
        → InfluxDB (time-series storage)
        → Grafana (real-time dashboard)
        → Threshold exceeded → send alert (email / Slack / Teams)
Enter fullscreen mode Exit fullscreen mode

Node-RED acts as connector and processing middleware: polls OPC-UA nodes, converts units, writes to the database, fires alerts. The entire flow lives in the visual editor, with no custom service to write.

Industrial protocol support (via community node packages):

  • node-red-contrib-opcua — OPC-UA read/write
  • node-red-contrib-modbus — Modbus TCP/RTU
  • node-red-node-serialport — Serial port communication
  • node-red-contrib-s7 — Siemens S7 PLC

Use Case 2: IoT Device Automation (MQTT-Centered)

MQTT is the dominant messaging protocol for IoT devices. Node-RED ships built-in MQTT support:

Temperature/humidity sensor → MQTT broker → Node-RED
    → If temperature > 28°C
        → Turn on AC (HTTP command to smart plug)
        → Log entry (write CSV)
    → If humidity < 30%
        → Trigger humidifier (MQTT publish)
Enter fullscreen mode Exit fullscreen mode

Conditional logic uses node wiring: switch node for branching, function node for JavaScript when logic gets complex, mqtt-out node for publishing. The whole flow is readable at a glance.

Use Case 3: API Integration and Data Pipelines

Node-RED works equally well for purely software-side API integration:

  • Hourly pull from a third-party API, transform format, write to PostgreSQL
  • Form submission → validate → distribute to CRM and email service
  • GitHub webhook fires → Slack notification + Jira ticket creation
  • Aggregate multiple data sources → scheduled report generation

http in accepts webhooks, http request calls external APIs, json handles format conversion, change manipulates message fields — these nodes cover most API integration patterns.

Use Case 4: Edge Computing Preprocessing

Run Node-RED on an edge gateway to preprocess data before it goes to the cloud:

Raw sensor data (high frequency, high volume)
    → Node-RED (on edge gateway)
        → Aggregation (1000 readings/sec → 1 average/min)
        → Local anomaly detection (real-time response, no cloud dependency)
        → Upload only aggregated data (99% bandwidth savings)
Enter fullscreen mode Exit fullscreen mode

Node-RED runs on Raspberry Pi 4, industrial edge compute boxes, any device that runs Node.js, with minimal resource usage.


Core Concepts: Flow-Based Programming

Nodes

A node is Node-RED's atomic unit. Each node does one specific thing:

Node Purpose
inject Trigger: fires on a schedule or manually
debug Prints message content to the debug panel
function Processes messages with JavaScript
switch Conditional routing based on message properties
change Modify, delete, or move message fields
http in Receives HTTP requests
http request Makes HTTP requests (API calls)
mqtt in/out Subscribe to / publish MQTT messages
template Mustache template for text output
file Read/write local files
delay Rate limiting or deliberate delay

Wires and Messages

Nodes connect via wires, and data flows left to right as message objects:

// Every message is a JavaScript object; the core property is payload
{
    "payload": "sensor reading: 23.5°C",
    "topic": "sensor/temperature/room1",
    "timestamp": 1722700800000
}
Enter fullscreen mode Exit fullscreen mode

A function node writes JavaScript to process messages:

// Convert raw reading to structured object
const temp = parseFloat(msg.payload);
msg.payload = {
    value: temp,
    unit: "celsius",
    fahrenheit: (temp * 9/5) + 32,
    alert: temp > 28
};
return msg;
Enter fullscreen mode Exit fullscreen mode

Flows and Subflows

A flow is a canvas where nodes and wires form a complete logical unit. Large projects package related nodes into subflows — reusable modules, similar to functions.

Context Storage

Nodes store data at three scopes, sharing state within a flow:

// Node-private (only this node reads/writes)
context.set("count", 0);

// Flow-level (all nodes in this flow share it)
flow.set("lastValue", msg.payload);

// Global (all flows, all nodes share it)
global.set("config", { threshold: 28 });
Enter fullscreen mode Exit fullscreen mode

Node Ecosystem

Node-RED's community node library is one of its core assets. The official Flow Library hosts thousands of contributed packages, installed via npm install:

Databases

  • node-red-node-mongodb — MongoDB
  • node-red-node-influxdb — InfluxDB time-series
  • node-red-contrib-postgresql — PostgreSQL

Message brokers

  • node-red-contrib-kafka-manager — Apache Kafka
  • node-red-node-rabbitmq — RabbitMQ
  • Built-in MQTT nodes (no install needed)

Cloud platforms

  • node-red-contrib-aws — AWS S3, DynamoDB, Lambda
  • node-red-contrib-googlecloud — Google Cloud services
  • node-red-contrib-azure-iot-hub — Azure IoT Hub

AI / LLM (prominent at Node-RED Con 2026)

  • node-red-contrib-ollama — Local Ollama LLM
  • @democratize-ai/node-red-contrib-openai — OpenAI API
  • LLM + MCP integration was a featured topic at Node-RED Con 2026

Node-RED 5: What Changed

Node-RED 5, released in 2026, focuses on developer experience:

Explorer Panel

A new Explorer sidebar gives a structured view of all flows. Previously, large projects with dozens of tabs meant hunting through each one. Explorer provides tree-style navigation for quick access to any flow or node.

Redesigned Sidebars

Left and right sidebars now behave consistently, with controls grouped rather than scattered through menus. Sidebars support vertical splitting so two panels are visible at once.

Built-in Dark Theme

Node-RED 4 required third-party packages for a dark theme; 5.0 ships it natively. The default theme received an accessibility review, improving readability in industrial environments where control room lighting varies.

System Requirements Change

  • Requires Node.js 22.9+ (Node.js 24 recommended)
  • Drops 32-bit ARM support — Raspberry Pi 3B and earlier are no longer compatible (Pi 4 and Pi 5 are fine)

Installation and Quick Start

Fastest Install (Global npm)

# Install
sudo npm install -g --unsafe-perm node-red

# Start
node-red

# Open editor
# Browser: http://localhost:1880
Enter fullscreen mode Exit fullscreen mode

Raspberry Pi (Official Script)

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

# Set up as a system service (start on boot)
sudo systemctl enable nodered.service
sudo systemctl start nodered.service
Enter fullscreen mode Exit fullscreen mode

Docker

docker run -it -p 1880:1880 -v node_red_data:/data --name mynodered nodered/node-red
Enter fullscreen mode Exit fullscreen mode

First Flow: HTTP Request → Fetch Data → Return Result

In the editor:

  1. Drag in an http in node, method GET, path /weather
  2. Drag in an http request node, fill in the weather API URL
  3. Drag in a function node:
   const data = JSON.parse(msg.payload);
   msg.payload = {
       city: data.name,
       temp: data.main.temp,
       desc: data.weather[0].description
   };
   return msg;
Enter fullscreen mode Exit fullscreen mode
  1. Drag in an http response node
  2. Connect all four left to right with wires
  3. Click Deploy

Hit http://localhost:1880/weather and results come back. Under 5 minutes.


Node-RED vs n8n vs Airflow

The previous article (#177) covered Airflow. With n8n added to the mix, these three tools occupy distinct positions despite frequent comparisons:

Dimension Node-RED n8n Apache Airflow
Core domain IoT / industrial / edge computing Business process automation / SaaS Data pipelines / ETL / MLOps
Trigger model Event-driven (real-time) Triggers + schedule Schedule + data-ready
Programming model Visual drag-and-drop + minimal JS Visual + code hybrid Python code
Protocol support MQTT, OPC-UA, Modbus, serial HTTP, WebSocket, SaaS APIs Primarily HTTP / databases
Deployment target Edge devices / Raspberry Pi / gateways Servers / cloud Servers / clusters
Execution history Weak (no built-in task history) Moderate Strong (full execution audit)
Target users Engineers + hardware developers Technical ops / developers Data engineers

Decision guide:

  • Connecting hardware, running on Raspberry Pi, handling MQTT/OPC-UA → Node-RED
  • Connecting SaaS services, automating business processes, non-technical users involved → n8n
  • Managing dozens of interdependent data pipelines, needing full scheduling history → Airflow

Resources


Summary

Node-RED addresses a persistent pain point at the intersection of data engineering and IoT: two devices or services need a data flow between them, but building a dedicated service for that is over-engineered, and the work isn't business logic — it's glue code.

The design philosophy is clear: make the connection itself a first-class citizen. Each node encapsulates one connection capability. Each wire represents a data direction. The entire business logic becomes visible and editable on a canvas. This matters most in hardware and industrial contexts — a factory engineer may not write Python services, but can read a flow diagram.

Node-RED isn't a replacement for Airflow's complex batch pipeline management, and it's not trying to out-feature n8n on business process automation. Where it genuinely leads: real-time events, hardware protocols, edge nodes — the overlap of all three is Node-RED's home territory, and no other tool in the space matches its community maturity there.


Explore PrimeSkills — A marketplace for handpicked AI Agents and skills. Each is validated in real enterprise workflows, stripping away hype and keeping only what truly works.

Welcome to my Homepage for more useful insights and interesting products.

Top comments (0)