🎬

Video tutorial coming soon.

🔴 Setup Node-RED — Flow-Based IoT & Automation

Deploy Node-RED on Ubuntu with Docker — an open-source, flow-based programming tool for wiring hardware devices, APIs, and online services. Purpose-built for IoT automation, MQTT messaging, and real-time data pipelines with a browser-based visual editor.

⚠️ This script is provided for demo and testing purposes only. Not intended for production use.

📦 Resources & Setup Scripts

Grab the automated bash script from GitHub to follow along with the video.

Automated install — Node-RED with persistent flows storage in one command.
View on GitHub

Quick Install:

wget https://raw.githubusercontent.com/mhmdali94/Docker/main/automation/node-red/node-red-ubuntu.sh
chmod +x node-red-ubuntu.sh
sudo bash node-red-ubuntu.sh

Tutorial Steps

1 Download the Script

Fetch the Node-RED install script from the Prisma Docker library:

wget https://raw.githubusercontent.com/mhmdali94/Docker/main/automation/node-red/node-red-ubuntu.sh

2 Make it Executable

Grant execute permission before running:

chmod +x node-red-ubuntu.sh

3 Run the Installer

The script installs Docker if needed, pulls the Node-RED image, and starts the service with a persistent data volume for your flows.

sudo bash node-red-ubuntu.sh

4 Access the Flow Editor

Open your browser and navigate to your server IP on port 1880. The visual flow editor loads immediately — drag nodes from the palette, wire them together, and click Deploy to run your first flow.

http://<your-server-ip>:1880

Ports Used

PortPurpose
1880Node-RED Web UI & HTTP-in Endpoints
1883MQTT Broker (if Mosquitto is added)

Overview

Node-RED is an open-source, flow-based programming tool originally developed by IBM and now maintained by the OpenJS Foundation. It provides a browser-based visual editor where you connect 'nodes' — small processing units representing inputs, outputs, transformations, and actions — by drawing wires between them. A finished flow is deployed to a lightweight Node.js runtime and runs continuously. Node-RED has a massive community library of over 4,000 contributed node packages covering MQTT brokers, Raspberry Pi GPIO, industrial protocols (Modbus, OPC-UA), databases, APIs, cloud services, and AI integrations. It is the dominant choice for IoT edge computing, home automation, and industrial data pipelines.

Why Use It

Node-RED sits at the intersection of simplicity and power for IoT and event-driven automation. The visual wiring metaphor maps naturally to how data flows through a system — an engineer who has never written code can understand a Node-RED flow in minutes. At the same time, the Function node lets you drop into full JavaScript for any logic the built-in nodes don't cover. With 4,000+ community nodes, almost any protocol, device, or service already has a ready-made integration. Being lightweight (runs on a Raspberry Pi) yet cloud-deployable makes it the most versatile IoT tool in the self-hosted ecosystem.

When You Need It

    Who Should Use It

      Real Use Cases

        Main Features

          How to Use After Installation

            Security Best Practices

              Ports and Firewall Notes

              Node-RED uses port 1880 for its web editor and HTTP-in webhook endpoints. Only expose this port through a reverse proxy with TLS. If you add a Mosquitto MQTT broker, it uses port 1883 (unencrypted) or 8883 (TLS) — restrict broker access to trusted devices and clients only. For IoT edge deployments, firewall all ports except those explicitly needed for device communication.

              Backup and Maintenance

                Common Mistakes

                  Troubleshooting

                    Alternatives

                    For SaaS/API automation, n8n and ActivePieces are more appropriate — they have far more prebuilt SaaS integrations and a gentler learning curve than Node-RED. For dedicated home automation, Home Assistant has a massive ecosystem of device integrations and is purpose-built for smart home control. For industrial-grade IoT data pipelines, Apache NiFi offers enterprise-level flow management with provenance tracking. For serverless event processing, AWS IoT Core or Azure IoT Hub are managed alternatives. For lightweight scripting without a visual editor, simple Python scripts with the paho-mqtt library can replace Node-RED for straightforward sensor→action flows.

                    When Not to Use It

                    If you are automating SaaS applications (Gmail, Slack, Salesforce) rather than hardware or protocols, n8n or ActivePieces will be more productive — they have hundreds of prebuilt SaaS connectors that Node-RED lacks. If your team is non-technical and needs a no-code experience with human approval steps, ActivePieces is better suited. If you are building complex AI agent pipelines, n8n's native LangChain integration is superior. For mission-critical industrial control (not just monitoring), a certified SCADA/PLC system is more appropriate than Node-RED — it is a prototyping and integration tool, not a safety-rated control system.

                    Need Help Setting Up Node-RED?

                    PrismaTechWork provides end-to-end infrastructure services — from initial deployment and security hardening to ongoing monitoring, automated backups, and dedicated support. Whether you need a single-server setup or a multi-site network, our team ensures your infrastructure is built right, secured properly, and maintained reliably.

                      Contact Us

                      Frequently Asked Questions

                      Is Node-RED free to use?

                      Yes — Node-RED is fully open-source under the Apache 2.0 license. There are no paid tiers, no execution limits, and no feature restrictions. It is maintained by the OpenJS Foundation (the same organisation that stewards Node.js and jQuery). You can self-host it indefinitely at no cost. The only cost is the server it runs on.

                      How do I connect Node-RED to an MQTT broker?

                      Drag an 'mqtt in' or 'mqtt out' node onto the canvas. Double-click it and click the pencil icon next to 'Add new mqtt-broker'. Enter your broker's IP address, port (usually 1883), and credentials if required. Click Add, then Done, then Deploy. Node-RED will connect to the broker and subscribe to or publish on the specified topic. You can also run Mosquitto as a sidecar container alongside Node-RED for a self-contained MQTT setup.

                      Can Node-RED run on a Raspberry Pi?

                      Yes — Node-RED was originally designed for Raspberry Pi and runs excellently on even the oldest Pi models. The official Node-RED install script for Raspberry Pi OS is the recommended method for bare-metal installs: `bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)`. For Docker-based installs on Pi, use the `nodered/node-red:latest` image which is built for ARM. GPIO access requires the node-red-node-pi-gpio package and running with elevated permissions.

                      How do I install additional nodes from the community library?

                      In the Node-RED editor, click the hamburger menu (top right) → Manage palette → Install tab. Search for the node package name (e.g., 'node-red-contrib-influxdb') and click Install. Alternatively, exec into the Node-RED container and run `npm install <package-name>` in the /data directory, then restart the container. The Flows library at flows.nodered.org lists thousands of community nodes with descriptions and install counts.

                      What is a subflow and when should I use one?

                      A subflow is a reusable group of nodes that you create once and use as a single node anywhere in your flows. Create one via Menu → Subflows → Create subflow. Think of it like a function — you give it inputs and outputs, and the logic inside is encapsulated. Use subflows when the same logic appears in multiple flows (e.g., a standardised MQTT message parser, an error logging routine, or an API authentication step). They keep flows clean and changes propagate automatically everywhere the subflow is used.

                      How do I secure the Node-RED editor with a password?

                      Edit the settings.js file in your Node-RED data directory and uncomment the `adminAuth` block. Set the username and use `node-red admin hash-pw` to generate a bcrypt hash of your password. Restart the container. From that point, the editor will require login before allowing any access. For production, also add HTTPS via a reverse proxy — password authentication over plain HTTP is not sufficient.

                      How does Node-RED store data and can flows survive container restarts?

                      Node-RED stores all flow definitions in a flows.json file and credentials in a flows_cred.json file, both in the /data directory. As long as this directory is mounted as a Docker volume (which the install script does), all flows, credentials, and settings survive container restarts and image updates. The context storage (global/flow variables) can also be configured to persist to disk via the contextStorage setting in settings.js.

                      Can Node-RED communicate with industrial protocols like Modbus or OPC-UA?

                      Yes — this is one of Node-RED's strongest capabilities. Install `node-red-contrib-modbus` for Modbus TCP/RTU communication with PLCs and sensors. Install `node-red-contrib-opcua` for OPC-UA server/client functionality. Both packages allow reading and writing registers, tags, and data points from industrial equipment, then routing that data to databases, dashboards, cloud platforms, or other systems — all without writing low-level protocol code.