# Project mode - information on how setting.js, package.json and depenendencies are handled

**URL:** <https://discourse.nodered.org/t/project-mode-information-on-how-setting-js-package-json-and-depenendencies-are-handled/41552>\
**Category:** Core Development\
**Created:** [24 February 2021 13:46 UTC](https://discourse.nodered.org/t/project-mode-information-on-how-setting-js-package-json-and-depenendencies-are-handled/41552 "2021-02-24T13:46:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rogerjames99](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rogerjames99/32/25201_2.png) [@rogerjames99](https://discourse.nodered.org/u/rogerjames99)\
**Post date:** [24 February 2021 13:46 UTC](https://discourse.nodered.org/t/project-mode-information-on-how-setting-js-package-json-and-depenendencies-are-handled/41552/1 "2021-02-24T13:46:11Z")

</div>

Is there any documentation anywhere on how this works. I can see there are;

- A number of hidden files in the node red home directory.

- A package.json file in the individual project directories.

- A package.json file and a settings.js file in the node red home directory.

But how does this play together. Especially how are project specific settings and dependencies handled.

Any help, pointers or design documents would be great.

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [24 February 2021 13:57 UTC](https://discourse.nodered.org/t/project-mode-information-on-how-setting-js-package-json-and-depenendencies-are-handled/41552/2 "2021-02-24T13:57:42Z")

</div>

> [@rogerjames99](#):
>
> A number of hidden files in the node red home directory.

> <https://github.com/node-red/node-red/pull/2704>
>
> \- \[x\] New feature (non-breaking change which adds functionality)
> 
> \## Proposed …changes
> 
> The runtime settings are currently stored in \`~/.node-red/.config.json\`. This contains:
> - the list of nodes discovered by the runtime
> - user settings (eg editor settings such as 'show grid' etc)
> - project settings (active project, list of available projects etc)
> - other things - notable \`\_credentialSecret\`.
> 
> Putting all of these things in one place is not ideal - a consequence of the Storage API only having a simple read/write API for the whole settings object.
> 
> This PR changes the default LocalFileSystem storage plugin to split the settings into 4 files:
> 
> - \`.config.nodes.json\` - the node registry
> - \`.config.users.json\` - user specific settings (eg editor settings)
> - \`.config.projects.json\` - project settings, including the active project
> - \`.config.runtime.json\` - everything else - most notable \_credentialSecret
> 
> This reduces the blast radius if any one of the files is lost for some reason.
> 
> It also means:
> - a user can be more selective over what they backup. For example, they can backup the \`users\` file to save their editor settings, without also pulling in the \`\_credentialSecret\` from the \`runtime\` file.
> - when updating a setting, only the relevant file needs to be updated - we don't have to rewrite the whole file every time.
> 
> With this change, we will \*leave\* the existing \`.config.json\` in place. The logic is:
> 
> - if \`.config.json\` exists and \`.config.nodes.json\` does not exist
> - migrate \`.config.json\` to the four new files
> - if \`.config.json\` and \`.config.nodes.json\` both exist
> - check modification time of both files
> - if \`.config.json\` is newer, migrate it to the four new files
> - if \`.config.nodes.json\` is newer, don't do any migration - use the four new files that already exist
> 
> We will leave the old \`.config.json\` in place because it eases the path if a user chooses to downgrade to pre 1.2 - they won't be left with no projects/\_credentialSecret etc in place. This is more likely during the initial beta period of 1.2. We will begin to remove the old \`.config.json\` file in 1.3 or 2.0.

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [24 February 2021 14:01 UTC](https://discourse.nodered.org/t/project-mode-information-on-how-setting-js-package-json-and-depenendencies-are-handled/41552/3 "2021-02-24T14:01:16Z")

</div>

> [@rogerjames99](#):
>
> - A package.json file in the individual project directories.
> - A package.json file and a settings.js file in the node red home directory.

[https://nodered.org/docs/user-guide/projects/](https://nodered.org/docs/user-guide/projects/)

---

<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:** [24 February 2021 14:54 UTC](https://discourse.nodered.org/t/project-mode-information-on-how-setting-js-package-json-and-depenendencies-are-handled/41552/4 "2021-02-24T14:54:34Z")

</div>

Hi @rogerjames99

There isn't a singular doc that describes how they all relate, but I'll try to describe it.

I will say up front there are areas here I know we need to improve, so what follows is how it works today.

To begin with, lets ignore projects and focus on the runtime files.

- `~/.node-red/package.json` - this lists the npm dependencies currently installed in the runtime - ie. nodes.
- `~/.node-red/settings.js` - this is the main runtime settings file. This is the file the runtime loads when it starts to get its configuration.
- `~/.node-red/.config.*.js` - there are a number of hidden files where the runtime stores its own internal settings. These are not files the user is ever expected to edit manually

When it comes to the projects feature, a project justs consists of:

- `package.json` - listing the dependencies of the project.
- the flow/credential files

The `package.json` file contains some project metadata, such as the names of the flows files. It also lists the dependencies - but the runtime does _not_ use that list to install anything automatically. The Project Settings tab in the editor lets you manage the project's list of dependencies - but that only relates to trying to make sure it reflects the nodes the project is actually using.

A project does _not_ have its own independent settings file.

There are a number of areas to improve here - but we don't have a concrete plan for it yet.

1. **Better management of project dependencies.**  
At the moment the runtime won't automatically install dependencies when opening a project. The editor will point you at the Project Settings dialog where it will highlight what's missing and let you install them.

2. **Project settings file**  
One of the concepts around projects is you ought to be able to git clone a project and just run it as a standalone node-red application. For that to work, the project needs a settings file and some other bits and pieces added. I wrote a blog post on what that involves a while ago: [Creating a Node-RED deployment pipeline to IBM Cloud · knolleary](https://knolleary.net/2018/06/01/creating-a-node-red-deployment-pipeline-to-ibm-cloud/)

Having said all of that, I know there are teams using the projects feature in their own way - and have other ideas for how this can all be improved. It's certainly a topic I hope we can make progress on this year.

---

<div class="post-metadata">

**Author:** ![rogerjames99](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rogerjames99/32/25201_2.png) [@rogerjames99](https://discourse.nodered.org/u/rogerjames99)\
**Post date:** [25 February 2021 08:48 UTC](https://discourse.nodered.org/t/project-mode-information-on-how-setting-js-package-json-and-depenendencies-are-handled/41552/5 "2021-02-25T08:48:29Z")

</div>

Thanks for the excellent info. That is a lot clearer now.

---

<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:** [26 April 2021 08:49 UTC](https://discourse.nodered.org/t/project-mode-information-on-how-setting-js-package-json-and-depenendencies-are-handled/41552/6 "2021-04-26T08:49:15Z")

</div>

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