During a recent trip to NodeJS Interactive in Vancouver last October, Zach (Chief Product Officer) and Eli (Principal Engineer) spoke to multiple people who suggested they look into Node-RED, especially since they built an IoT database. The guys came back home, did some quick research, thought “this looks pretty cool,” then threw it on the backlog…where it sat for a while. Whoops. In the last few months we finally got around to diving into Node-RED and, wow, is it powerful!
What is Node-RED?
The name isn’t exactly intuitive. I cannot, for the life of me, figure out what “RED” stands for, Rapid Engineering Development is my best guess and I’m 100% sure I’m wrong. Node is in the name purely because it is written in Node.js. The project is open source and maintained by with primary contributors coming from IBM and Hitachi. According to the Github project README, Node-RED is “a visual tool for wiring the Internet of Things.” Getting warmer, but I’m still not sure that fully describes the power of this tool. At this point, I’ve come to the conclusion that Node-RED is not just for IoT, but any kind of application involving workflows and/or event processing. Developers can integrate data sources, APIs, and services with ease. Node-RED “code” is created in a flow, which is easily visualized by both expert and beginner developers alike. Just like HarperDB, Node-RED is incredibly lightweight and can run on pretty much anything with an operating system, from a Raspberry Pi to a full-scale server.
This method of programming essentially treats each piece of functionality, big or small, as a black box. Flows are created by joining black boxes together to solve a larger problem. Typically the black box categories can be separated into data, processes, and connectivity. You can read all about the design and history on the creator’s website: http://www.jpaulmorrison.com/fbp/.
In Node-RED, flows are visual, so you can effectively draw your code as a flow. Each black box is referred to as a node. Yes, a Node-RED node. Node-RED nodes are connected together to create a Node-RED flow. There are plenty of nodes prepackaged into Node-RED as well as tons of additional nodes available on , such as the .
Introduction from the Developers
I can write about it all day, but I highly recommend watching an introduction video created by one of the two original developers of Node-RED, Nick O’Leary. https://youtu.be/vYreeoCoQPI
One of the biggest benefits of Node-RED is how widely adopted and supported it is within the IoT and Node.js communities. Because of this, there are tons of examples available online. The Node-RED website features both a and .
Here at HarperDB we’ve been using Node-RED for proof of concepts and implementations regarding our IoT database. Tasks like edge analytics, data ingestion, and server-side data migration can be handled with ease with a relatively simple flow. Look for more blog posts coming soon that dive into these solutions and walk you through how to handle these cases.
Getting Started with Node-RED
At this point I hope I’ve convinced you that Node-RED is worth a look. A basic installation is pretty straightforward. The only pre-requisite is that you have Node.js installed. I had my first flow up and running in minutes.
Install Node.js: https://nodejs.org/en/download/
Install Node-RED: https://nodered.org/docs/getting-started/installation
Getting started is fairly simple, but there is so much you can do to improve and customize Node-RED to your needs. So much so that you can even . Once you get the hang of it I think you’ll be sold just like us!