Node-Red flow organisation

Hi Everyone,

I have a node-red application with four tabs containing almost similar code. But, I want four users to use individual tabs as all four tabs might be used simultaneously. I will be using sub-flows to minimize duplication of flows. Also, I want each user to be able to access a single tab only.

Can I please get a solution, on how to organize the flows appropriately?

Thanks in advance.

That is not how Node-RED works. The Editor and its flows are not multi-user.

There are potentially various ways to work around the issue but we probably need to understand just how much control you want to apply.

For example, at a simple level, you could simply get users to hide the tabs they shouldn't be using (that IS a per-client setting).

At the other extreme, you could have multiple Node-RED instances, one per user, with common functions accessible as API's from a central Instance.

I'm not too familiar with node -red. With the second solution you provided can you explain a bit in detail of accessing common functions/nodes through APIs.

Thanks.

Is the important part

There are a few ways to get around this but none that really allow practical, shared, editing use of one NR instance

Node-RED has excellent communications capabilities using a number of different standards. So a central instance can be used to create external interfaces using HTTP, TCP or websocket connections (and more). These can be referred to as Application Program Interfaces (API's), they are designed for two IT services to talk to each other in a standardised way.

So rather than putting all of your flows in one basket so to speak, you have a set of common flows. And instead of those common flows directly communicating with flows on other tabs in a single instance, they have an edge point which is the API. Your user instances then have standard connections to those API's.

For example, a common API might allow the lookup of some standard reference data, maybe a product or a customer for example. The user flow would have a standard method for requesting a product using the central API. The central instance would send the JSON data back over that API. So it is the same principle of message flow but with a break in the middle.

Similarly, a user flow that needed, for example, to register a new product sale, would send the data to the central instance using another API connection.

This has a number of advantages of course since it forces you to think more carefully about the interfaces and their security. Not just who can connect but what data can be sent - particularly inbound to the central service, you would make sure that data coming into the API is well formed and safe before doing anything with it - something that is easily missed when trying to do everything in a single set of flows.

There are, of course, a number of overheads to this approach which you need to take into account:

  • possibly some additional network traffic and some resulting latency between API calls and responses.
  • some additional complexity to the design
  • some additional resource utilisation due to having multiple instances of Node-RED running. This is actually the biggest overhead and may need some thought depending on the number of users you have and the complexity of the processing.
3 Likes

Creating four instances of the node-red application by running them on four different ports. In each instance hide the tabs which I don't want to allow the user to use.

Is this a good option for implementation?

Only if you don't care that the users can still get into and use them if they wanted to.

It's only the user interface they will have access to. So, if I'm not wrong, I don't think they will have access to enable the hidden tabs. Does that sound right?

Thanks.

No, they can absolutely re-enable the tabs themselves. There is nothing to stop them I don't believe.

Ahh, I didn't know that. I will work on the solution you provided earlier. Thank you! :slight_smile:

This can be maybe interest You:

Note: mdashboard does NOT provide any isolation between users - they are all updating the same flow so they can all reach the same tabs if they know how to.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.