I checked the repo at GitHub - node-red/node-red: Low-code programming for event-driven applications and I am confused about the folder structure. Where is the source code of node red in this? Generally there would be an src folder containing the source but I don't see that.
Also, what is the purpose of the repo at GitHub - node-red/node-red.github.io: Node-RED Site?
Its in packages/node_modules
It is the src for the node-red website
We should be clear for future readers.
Typically, when node-red is ran for the first time via the command
node-red, a "userDir" is created. Often this "userDir" is
When a user adds node-red nodes to the node-red runtime, they get installed in this "userDir" under
~/.node-red/modules) and not in the src packages/node_modules )
NOTE: "userDir" can be spcified by a command line parameter of
-u path (see documentation for this an more)
To clarify what is happening here, this is a monorepo that contains the 7 separate npm modules that make up Node-RED.
By having them under a
node_modules directory in the src repo, it allows them to find each other when using
require - as it ensures they are on the node search path.
This blog post explains the structure and why its arranged that way: Moving Node-RED to a monorepo with multiple modules · knolleary
Thanks for clarifying that. Though by "node packages" I meant node.js/npm packages, common terms seem to be causing confusion here.
But that brings up one point in my mind though: are workflows and node-red nodes user specific? Why do we need a "userDir" directory to install node-red nodes? Ideally the nodes should be visible to all users so they can use them in their workflows, isn't it? By user I mean the end user who is creating the workflows to automate their work and not node-red developer who is using node-red to create a custom workflow framework.
Node-RED is a single tenant runtime. It only runs one set of flows. You can have multiple users collaborate on those flows, but ultimately it's the same set of flows they are working on.
You cannot have different nodes installed for different users.
the term userDir is from a linux server perspective... it is the user that the Node-RED server process is running under. You can run multiple instances of Node-RED on a server - each with it's own userDir, port number, and set of flows... but as Nick pointed out - each instance is separate from the others and runs one set of flows.
Just adding to that, you can, of course, run multiple Node-RED instances from the same Node-RED installed package with different
userDir folders so the naming does make sense anyway.