Node-RED Meets for Large Scale IoT

In this post I evaluate Node-RED for production deployments and show that it is not only for toy DIY projects. A combination of and Node-RED is a viable option for an IoT Hub.

Node-RED is a lightweight event processing engine developed on top of Nodejs. It has been developed by IBM emerging technologies group and currently attracts a large community that grows Node-RED with many plugins. It aims to make IoT development easy for non-tech savvy people. As you can read from their website, the installation is just one node.js call:

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

Then, over a browser, you can attach nodes (i.e., processing units such as MQTT pub/sub, read/trigger GPIO, parse messages, connect API …) to each other via flows. Normally, I don’t like visual programming tools, but this one works and extremely easy to learn. A rather complex screen shot from a home automation project looks like:

Node-RED example

Other details about Node-RED are:

  • Hardware – Rasperry Pi, BeagleBone Black, Arduino
  • Network – HTTP, TCP, UDP, MQTT, WebSocket
  • Parsers – CSV, JSON, XML
  • Transformations – JavaScript Functions, Mustache Templates
  • Social – Twitter, Twillio, Email, IRC, RSS, XMPP
  • Storage – Filesystem, MongoDB, MySQL, PostgreSQL, Redis
  • Analysis – Sentiment, Statistics

What else do you need in a corporate solution:

Automated testing is possible with normal nodejs testing tools. I am not a nodejs expert but I see that the node-red code base in Github uses Travis continuous integration tool for unit testing and code coverage ( for code coverage it uses the package “Istanbul” which is the city where I obtained my BS and MS degrees :) ). For functional tests, I couldn’t find anything. But I’m sure that a nodejs expert can show us many alternatives.

Versionning is also easy since the nodes and the flows are all in javascript and json format.

Ease of use/development is quite good. Visual tool makes it like kindergarden programming assignment but obviously security and mqtt connections definitely requires some background knowledge. Support is via the community, which is bad. But in the node-red website it is stated that there are 120 000 modules available \o/. So there are people working behind.

It should be lightweight. Yes, it is lightweight since it works on node.js and it is designed for RPi from the beginning.

Deployment is a little bit scary but solution exists. First of all, from deployment I mean over-the-air update of the platform at any time without manual intervention. Here comes the Docker Containers and

I was already running Node-RED in docker containers in my laptop and was thinking about whether we can run on a container on RPi. It turns out that current record for number of containers on an RPi is 500. In this website, you can read more about how. So if we can make an application which uploads containers remotely to a RPi and switch them, then we have an over-the-air update mechanism. And it has already been done by, which is also the point where you have to pay some money for your project (1000$ per month for 1000 devices). After you command “git push” to your repository, Resin compiles the code for a container and deploys it to your RPi. For run time configuration it provides the management of environmental variables and local storage based on container volumes. The reference architecture of Resin is as follows: stack

To conclude, creating IoT projects via RPi is easy with Node-RED and you can make massive deployments via containers and The only thing that I couldn’t find is that the real-life deployments via Node-RED that are not DIY PoC projects. This makes me worry whether there is a show-stopper in the performance. But the good thing is that you don’t have to bound yourself fully on node-red. We are able to embed Node-RED in other applications. For instance, zetta.js from APIGEE for IoT Hubs is based on node.js as well and we can easily embed Node-RED inside it as an event processing engine. And is ready for containerized deployment.