Run This Ai
EN DE

Getting Started with Node-RED: Install via Docker and Build Your First Flow

Node-RED

Getting Started with Node-RED: Install via Docker and Build Your First Flow

This tutorial will walk you through deploying Node-RED with Docker and creating your first automation flow. By the end, you'll have a working Node-RED instance connected to a public API, processing data, and displaying results β€” all built visually without writing a single line of traditional code.

Prerequisites

  • Docker and Docker Compose installed on your machine
  • At least 512 MB of RAM (1 GB recommended)
  • A modern web browser (Chrome, Firefox, or Edge)

Step 1: Deploy Node-RED with Docker

Create a directory for your Node-RED data and start the container with a single command:

mkdir node-red-data
docker run -d --name node-red \
  -p 1880:1880 \
  -v ./node-red-data:/data \
  nodered/node-red:latest

This pulls the official Node-RED image from Docker Hub, maps port 1880 to your host, and persists your flows and configuration to the local node-red-data directory. Node-RED restarts automatically with your flows intact.

Alternatively, use Docker Compose for a more structured setup:

services:
  node-red:
    image: nodered/node-red:latest
    restart: unless-stopped
    ports:
      - 1880:1880
    volumes:
      - ./data/node-red:/data

Step 2: Access the Flow Editor

Open your browser and navigate to http://localhost:1880. You'll be greeted by the Node-RED flow editor β€” a clean canvas on the right and a palette of nodes on the left. Nodes are organized into categories: common (inject, debug, function), network (http, mqtt, websocket), and more.

Node-RED Flow Editor Interface

Step 3: Build Your First Flow β€” API Data Fetcher

Let's build a simple flow that fetches data from a public API and displays it:

  1. Drag an Inject node (from the "common" palette) onto the canvas. Double-click it, set the payload to a timestamp trigger, and click Done.
  2. Drag an HTTP Request node. Double-click it, set Method to GET, and URL to https://api.github.com/repos/node-red/node-red. Name it "Fetch GitHub Stats".
  3. Drag a Function node. Paste this code: msg.payload = {stars: msg.payload.stargazers_count, forks: msg.payload.forks_count, description: msg.payload.description}; return msg;
  4. Drag a Debug node. It automatically outputs to the sidebar debug panel.
  5. Wire the nodes together: Inject β†’ HTTP Request β†’ Function β†’ Debug.
  6. Click the red Deploy button (top-right), then click the inject button (left of the Inject node).

Check the debug panel (right sidebar) β€” you should see the repository's star count, fork count, and description displayed in real time.

Step 4: Add AI Capabilities

Want to add AI to your flow? The community-contributed node-red-contrib-openai package adds nodes for calling GPT models. Install it via the Manage Palette menu (top-right hamburger β†’ Manage Palette β†’ Install β†’ search for node-red-contrib-openai). Once installed, you can wire an OpenAI node into any flow β€” send it text, get back an AI-generated response, and pass it to the next node in your pipeline.

Conclusion

Node-RED's strength lies in its simplicity: a few drags and drops, a couple of clicks, and you've built an automation that would take dozens of lines of traditional code. Start with this tutorial, then explore the palette β€” you'll find nodes for MQTT, email, Slack, Twitter, file systems, and AI services. The only limit is your imagination.