Node-RED: Store Data on the Filesystem

This documentation is part of the Getting Started guide. You can view the complete guide here: How to Get Started with Node-RED.

👋 Welcome to the Stackhero documentation!

Stackhero offers a ready-to-use Node-RED cloud solution that provides a host of benefits, including:

  • MQTT server included (Mosquitto).
  • Full access to Node-RED admin UI.
  • Node-RED Dashboard included.
  • Unlimited and dedicated SMTP email server included.
  • Effortless updates with just a click.
  • Customisable domain name secured with HTTPS (for example, https://node-red.your-company.com).
  • Optimal performance and robust security powered by a private and dedicated VM.

Save time and simplify your life: it only takes 5 minutes to try Stackhero's Node-RED cloud hosting solution!

Stackhero for Node-RED offers local storage where your nodes can store files. This storage is located in the /persistent/storage/ directory.

Never use another destination for your local storage than a subdirectory of /persistent/storage/. If you use another directory, you will lose your data when you apply a Node-RED update!

In this example, we will use the node-red-node-sqlite node. This node requires a directory to store its data.

You will need to define a file in the directory /persistent/storage/, for example, /persistent/storage/myDatabase.sqlite.

Example of SQLite configuration on Node-REDExample of SQLite configuration on Node-RED

If you need to store data locally, you can write files to the /persistent/storage/ directory. Some Node-RED data might already be present in this directory. To avoid conflicts, it is recommended to use subdirectories, for example, /persistent/storage/myFlowData, to store your files.

To create this directory using Node.js, run the following code in your node:

fs.mkdirSync('/persistent/storage/myFlowData', { recursive: true });

notice If you plan to store more than a few files, we recommend using an object storage server. Object storage servers make it easier to manage, share, and access files via an API, like with the S3 protocol. Consider the MinIO service available on Stackhero for this purpose, which gives you an S3 compatible object storage server in just 2 minutes.