Comment

What's the Comment node in Node-RED used for?

When maintaining flows over longer periods of time it can save you time and interpretation errors if you add the comment node to your flows.

There's 4 core benefits to adding the Comment node to your Node-RED flows:

  1. Improved readability: Comments can help to make flows easier to understand, especially when adding easy to miss context and explanation like implicit requirements of the flow. This can be especially helpful for complex flows with link nodes, or when you're editing in many tabs.
  2. Enhanced maintainability: Comments can help to make flows easier to maintain by providing a record of the flows purpose and functionality. This can be helpful when making changes to the flow or when troubleshooting problems, particularly if you collaborate with multiple team members.
  3. Improved debugging: Comments can help to make debugging easier by providing information about the expected behavior. This can be helpful when tracking down errors and identifying the source of problems, or reasoning errors when previously developing the flow.
  4. Increased documentation: Comments can be used to document the code, providing additional information about the code's purpose, functionality, and usage. Beyond what the flow or nodes do in the sequence, business logic and requirements documented next to the flow increased developer effeciency.

The comment node can be added to any open space in the editor, and it's advised to add a comment to all flow groups.

As the comment node will not take up more space if your write a larger comment, Node-RED allows you to be more explicit and elaborate further in your comments. ASCII diagrams or so do not distract from your flow, and as such you're encouraged to add these.

Examples

When you double click the node, the full text is revealed:

Comment node editor

Node Documentation

A node you can use to add comments to your flows.

Details

The edit panel will accept Markdown syntax. The text will be rendered into the information side panel.