Low-code with Node-Red: More than just IoT and children's toys

Try it!

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:

  • WebSocket
  • SQL/SQLite
  • GrapQL
  • MongoDB
  • Telegram
  • Moment.js
  • 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 or 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 function node and write a normal JavaScript into it.

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 node-red-contrib-moment for moment.js.

Will have! How to do it.

Just clone this repo and do docker-compose up.

Here you can find even more guides on setting up Node-Red.

Translated with www.DeepL.com/Translator (free version)