How do I manually version control my Red-Node work in year 2025?

Hello,
I want to know how to manually version control my Red-Node work.

Can someone list the files that need to be version controlled to preserve a Node-Red flow?

We use both git and svn for different parts of the development process so we prefer to know which files are needed so that they can version controlled manually.

Also, what actions result in new files that should be added to the repository and is there documentation that describes the Node-Red file structure?

If you only want to track your flow development changes, just save your flow file (<flow-file>.json> and its respective credentials file <flow-file>_cred.json as well as the settings.js and config.runtime.json files.
if you use the 'projects' option, you get built-in integration to a git repository from within the Node-red editor.
If you want full restorable snapshots (including the specific community node versions), backup the whole node-red directory tree (assuming you installed the nodes from the editor).

Here is the .gitignore file that I use to control the .node-red folder

*.backup
node_modules
context
.config.users.json

To clarify my post, everything else in the .node-red folder is under version control. It is not necessary to control the node_modules folder as the contents is defined by package.json and package-lock.json. package.json describes the installed nodes and package-lock.json defines which versions of the nodes and all dependencies are installed. If it is necessary to restore from the git repository then running
npm install
will restore the node_modules folder with all the nodes at the appropriate versions.

Thanks for the help. The "npm install" command was the missing step. Now I can restore my .node-red folder from version control, run "npm install" and my flow runs.

The other trick I use is to make ~/.node-red a symbolic link into where I have all my project files checked out. This makes it convenient to have all the project files in a single repository. Node-Red is just another piece of the project.

1 Like

Are you sure this is needed? I'm not seeing why. BTW, it has a "." in front to make it hidden which is why I never noticed it before.

I believe that you need that file to decrypt the credentials file if you are using an automatically generated key. If you are providing the credentialSecret explicitly then you may not need that file.

Hi Colin, thanks for this info. Do you know if the above npm install will know to restore the nodes back to their previous scope (local or global), or will just install all per the -g switch?
I see that the .config.nodes.json file has this node scope specification: is it taken into account?

.config.runtime.json contains the encrypting key so yes must be kept
.config.nodes.json and .config.modules.json are not important and will be regenerated when NR starts.
.config.users.json contains user settings so not keeping it is like being a new user.

My advice is:

  • flows.json
  • flows_cred.json
  • settings.json
  • package.json
  • .config.runtime.json
  • .config.users.json
  • other files handled by third party nodes

npm install will only install local nodes. Information on globally installed nodes is not stored in the .node-red folder. Generally one should not install nodes globally.
For locally installed nodes it will install the same version as was previously installed.

I don't know what npm install -g would do.

The problem with putting .config.users.json under version control is that it changes often. For example it records whether the sidebar is open or not.