In the course of winter home automation experiments with MQTT and HomeAssistant I came across this tool. I think it can be a helpful tool for us web developers in certain cases, even if it looks a bit like a child's toy at first sight.
What is Node-Red?
Node-Red is a building block-like development environment that runs on Node.js. For us keyboard-oriented developers, this requires some getting used to, because Node-Red is built from individual "nodes" that can be arranged on an interface ("flow") by drag-and-drop. The nodes can then be connected to each other to achieve the desired result.
What can this be used for?
The fact that the whole thing is event-driven makes it ideal for iOT applications, of course. But such an event can also be an HTTP request, a websocket or a point in time, which makes Node-Red extremely versatile. Due to the large number of integrated or embeddable libraries, practically all doors are open. Theoretically, it would even be possible to run an entire backend with it. For us, however, it would probably be more interesting to use it as a small service or as middleware that can be quickly clicked together and used in a Docker container.
Ready-made libraries/integrations are available for example for:
- Parser for JSON, YAML, CSV etc.
"But I want to program properly."
Well, that's what you do there. The UI is just an abstraction layer on top of the actual code. Basically you always have the object
msg.payload which is passed through the nodes and manipulated or used by each node accordingly. In the built-in debugger you can then inspect the objects properly.
If this is not enough, you can also grab a
What about external libraries?
Works too, but is a bit cumbersome (see this example). It makes sense to search if someone has already written a wrapper for Node-Red for the library, like
Will have! How to do it.
Just clone this repo and do
Here you can find even more guides on setting up Node-Red.
- Node-Red website
- Someone builds a full stack application with Node-Red
- Adding Node-Red to an existing application
- Git versioning using Projects
Translated with www.DeepL.com/Translator (free version)