# Need to clarify confusion on the nodered github repo

**URL:** <https://discourse.nodered.org/t/need-to-clarify-confusion-on-the-nodered-github-repo/63874>\
**Category:** Core Development\
**Created:** [13 June 2022 19:24 UTC](https://discourse.nodered.org/t/need-to-clarify-confusion-on-the-nodered-github-repo/63874 "2022-06-13T19:24:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Atul-Lohiya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/atul-lohiya/32/63181_2.png) [@Atul-Lohiya](https://discourse.nodered.org/u/Atul-Lohiya)\
**Post date:** [13 June 2022 19:24 UTC](https://discourse.nodered.org/t/need-to-clarify-confusion-on-the-nodered-github-repo/63874/1 "2022-06-13T19:24:04Z")

</div>

I checked the repo at [GitHub - node-red/node-red: Low-code programming for event-driven applications](https://github.com/node-red/node-red) 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.

There are folders under packages/node\_modules/@node-red folder. Is that the source code? isn't that where the compiled javascript "packages" are placed? If that is the source code, does anything change to compile it and produce compiled code into output directory?

Also, what is the purpose of the repo at [GitHub - node-red/node-red.github.io: Node-RED Site](https://github.com/node-red/node-red.github.io)?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [13 June 2022 20:20 UTC](https://discourse.nodered.org/t/need-to-clarify-confusion-on-the-nodered-github-repo/63874/2 "2022-06-13T20:20:17Z")

</div>

> [@Atul-Lohiya](#):
>
> Where is the source code of node red in this

Its in [packages/node\_modules](https://github.com/node-red/node-red/tree/master/packages/node_modules)

> [@Atul-Lohiya](#):
>
> There are folders under packages/node\_modules/@node-red folder. Is that the source code? isn't that where the compiled javascript "packages" are placed? If that is the source code, does anything change to compile it and produce compiled code into output directory?

The code is not compiled (it is JavaScript) however it is "concatenated" / "arranged" / "minified" by the `grunt.js` task

> [@Atul-Lohiya](#):
>
> Also, what is the purpose of the repo at [GitHub - node-red/node-red.github.io: Node-RED Site](https://github.com/node-red/node-red.github.io)

It is the src for the node-red website `https://nodered.org/`

---

<div class="post-metadata">

**Author:** ![Atul-Lohiya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/atul-lohiya/32/63181_2.png) [@Atul-Lohiya](https://discourse.nodered.org/u/Atul-Lohiya)\
**Post date:** [14 June 2022 12:36 UTC](https://discourse.nodered.org/t/need-to-clarify-confusion-on-the-nodered-github-repo/63874/3 "2022-06-14T12:36:29Z")

</div>

Thanks for the response. This seems to be done differently as much as I understand. When node based code packages are installed, they go into node\_modules directory. But here that is being used for source code. About the compiling thing, I underdstand it is javascript, I was more thinking in terms of TS which is used mostly for bigger stuff for better organization which needs compiling/transpiling. I made a mistake in saying that the output goes to node\_modules folder, it is the node packages that go into that folder when installed.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 June 2022 12:42 UTC](https://discourse.nodered.org/t/need-to-clarify-confusion-on-the-nodered-github-repo/63874/4 "2022-06-14T12:42:59Z")

</div>

> [@Atul-Lohiya](#):
>
> When node based code packages are installed, they go into node\_modules directory

> [@Atul-Lohiya](#):
>
> I made a mistake in saying that the output goes to node\_modules folder, it is the node packages that go into that folder when installed.

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 `~/.node-red` or `c:\user\.node-red`  
When a user adds node-red nodes to the node-red runtime, they get installed in this "userDir" under `node_modules` (e.g. `~/.node-red/modules`) and not in the src [packages/node\_modules](https://github.com/node-red/node-red/tree/master/packages/node_modules) )

NOTE: "userDir" can be spcified by a command line parameter of `-u path` (see documentation for this an more)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [14 June 2022 12:58 UTC](https://discourse.nodered.org/t/need-to-clarify-confusion-on-the-nodered-github-repo/63874/5 "2022-06-14T12:58:39Z")

</div>

> [@Atul-Lohiya](#):
>
> There are folders under packages/node\_modules/@node-red folder. Is that the source code? isn't that where the compiled javascript "packages" are placed? If that is the source code, does anything change to compile it and produce compiled code into output directory?

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](https://knolleary.net/2019/03/21/moving-node-red-to-a-monorepo/)

---

<div class="post-metadata">

**Author:** ![Atul-Lohiya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/atul-lohiya/32/63181_2.png) [@Atul-Lohiya](https://discourse.nodered.org/u/Atul-Lohiya)\
**Post date:** [14 June 2022 13:00 UTC](https://discourse.nodered.org/t/need-to-clarify-confusion-on-the-nodered-github-repo/63874/6 "2022-06-14T13:00:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [14 June 2022 13:05 UTC](https://discourse.nodered.org/t/need-to-clarify-confusion-on-the-nodered-github-repo/63874/7 "2022-06-14T13:05:15Z")

</div>

> [@Atul-Lohiya](#):
>
> 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?

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.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [14 June 2022 13:10 UTC](https://discourse.nodered.org/t/need-to-clarify-confusion-on-the-nodered-github-repo/63874/8 "2022-06-14T13:10:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [14 June 2022 15:45 UTC](https://discourse.nodered.org/t/need-to-clarify-confusion-on-the-nodered-github-repo/63874/9 "2022-06-14T15:45:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [13 August 2022 15:45 UTC](https://discourse.nodered.org/t/need-to-clarify-confusion-on-the-nodered-github-repo/63874/10 "2022-08-13T15:45:57Z")

</div>

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