03.08.2026

Como Instalar o Node-RED em uma VPS na Serverspace

Node-RED is a low-code development platform for building automations, integrations, and event-driven applications through visual flows. Instead of implementing every connection in a traditional backend, users combine reusable nodes that receive data, transform messages, call APIs, interact with databases, and deliver results to other services.

The platform runs on Node.js and is widely used for integrating cloud applications, IoT devices, messaging systems, web services, databases, and internal business tools.

Node-RED can run on a local computer, inside a container, on a single-board device, or on a virtual private server. A VPS is a practical choice for workflows that must operate continuously because the automation remains available even when the administrator’s computer is turned off.

This guide explains how to deploy Node-RED through the Serverspace control panel, access the new VPS, open the visual editor, create a first flow, build an HTTP endpoint, configure authentication, connect a domain, enable HTTPS, protect credentials, back up the environment, and troubleshoot common problems.

What Is Node-RED?

Node-RED uses a flow-based programming model in which an application is assembled from individual functional blocks called nodes.

Each node performs a specific operation, for example:

Nodes are placed in the visual editor and connected with wires. The resulting automation is called a flow.

After changing the flow, the user clicks Deploy. Node-RED then applies the configuration and starts running the updated logic.

Common Node-RED Use Cases

Node-RED is useful when several systems need to exchange data or react to events without requiring a complete custom application.

Typical use cases include:

The visual editor makes Node-RED especially convenient for rapid prototyping. A developer can verify an integration idea before investing time in a larger production application.

Node-RED vs Traditional Application Development

In a conventional backend project, a developer usually needs to:

Node-RED represents many of these operations as configurable nodes.

For example, a small HTTP service can be assembled from three components:

HTTP In → Function → HTTP Response

A flow that receives an MQTT event and sends a notification might look like this:

MQTT In → Condition → Notification Node

The visual approach does not eliminate programming completely. The Function node allows developers to write JavaScript when the built-in nodes are not sufficient.

Core Node-RED Concepts

The editor uses several important concepts:

Most nodes receive a JavaScript object named msg, modify it, and pass it to the next node.

The main data is commonly stored in:

msg.payload

A message can also contain other properties:

msg.topic
msg.headers
msg.statusCode
msg.filename

Why Run Node-RED on a VPS?

A local installation is suitable for learning and development, but production automations require an environment that remains online.

A VPS provides:

Running Node-RED on a separate server also prevents automation workloads from interfering with the administrator’s personal computer.

Recommended Server Resources

Node-RED itself is relatively lightweight. Actual requirements depend on the number of flows, message frequency, payload size, installed modules, and external services.

A small test environment can start with:

For several persistent integrations, consider:

Additional resources may be required when:

Network Ports

A basic Node-RED deployment may use the following ports:

Port Purpose Recommendation
22/TCP SSH administration Use SSH keys and restrict access where possible
1880/TCP Node-RED editor and HTTP endpoints Do not expose publicly without authentication
80/TCP HTTP Used by a reverse proxy and certificate validation
443/TCP HTTPS Recommended for remote browser access
1883/TCP MQTT without TLS Required only when a local MQTT broker is used
8883/TCP MQTT over TLS Preferred for public MQTT connections

Do not open all ports automatically. The required firewall rules depend on the integrations enabled in the environment.

Deploying Node-RED Through the Serverspace Control Panel

Node-RED is available in the Serverspace application catalog.

Using a prepared application removes the need to manually install Node.js, npm, Node-RED, and the initial dependencies. Serverspace creates the virtual machine and prepares the service for the first connection.

Step 1. Start Creating a Server

Sign in to the Serverspace control panel, open the vStack cloud section, and click Create server.

The server creation wizard will open.

Step 2. Select Node-RED

Open the Applications or 1-Click Apps tab.

Find Node-RED in the catalog and select it.

The prepared image reduces the number of installation steps and allows you to start creating flows sooner.

Step 3. Choose the Data Center

Select the region in which the virtual machine will be deployed.

Consider:

When Node-RED frequently communicates with another server, placing both systems close to each other can reduce network latency.

Step 4. Configure the VPS

Select:

For several lightweight automations, you can start with:

Example server names:

node-red-automation-01

or:

integration-gateway

Step 5. Configure SSH Access

Choose an authentication method:

SSH key authentication is recommended for a production server.

Never:

Step 6. Deploy the Server

Review the selected parameters and start the deployment.

Serverspace will automatically:

Wait until the instance status changes to Active.

Why Deploy Node-RED in Serverspace?

This deployment model separates infrastructure management from automation design.

Serverspace is used to manage:

Node-RED is used to manage:

The administrator can change VPS resources without rebuilding the flows.

Isolate Automation Workloads

A separate VPS is recommended when Node-RED connects to important services.

Isolation helps:

Separate Production and Testing

Production and experimental flows can run on different servers:

Server Purpose Example Resources
node-red-production Production integrations 2 vCPUs, 4 GB RAM
node-red-staging Testing changes and new nodes 1–2 vCPUs, 2 GB RAM
node-red-iot IoT and MQTT workloads 2 vCPUs, 2–4 GB RAM

Do not install an untested node directly on the production server.

Connecting to the VPS via SSH

Copy the public IP address from the Serverspace control panel.

Connect to the server:

ssh root@YOUR_SERVER_IP

Replace YOUR_SERVER_IP with the actual public address.

During the first connection, SSH will display the host fingerprint. Review it and confirm:

yes

Enter the root password or use the private key associated with the selected public key.

Checking the Node-RED Installation

Display the Node.js version:

node --version

Check npm:

npm --version

Check Node-RED:

node-red --version

List running processes:

ps aux | grep node-red

Confirm that port 1880 is listening:

sudo ss -lntp | grep 1880

Opening the Node-RED Editor

Open the following address in a browser:

http://YOUR_SERVER_IP:1880

Replace YOUR_SERVER_IP with the public IP of the VPS.

The Node-RED editor should appear.

The main interface areas are:

The editor may initially be accessible without a login. Do not leave port 1880 publicly exposed after completing the initial test.

Creating the First Flow

Create a simple flow that sends a message to the debug sidebar.

Step 1. Add an Inject Node

Drag the Inject node from the palette to the workspace.

The node can trigger the flow manually when its button is pressed.

Step 2. Add a Function Node

Drag a Function node to the workspace and connect it to Inject.

Open the Function node and add:

msg.payload = "Node-RED is running on the VPS";
return msg;

Save the node.

Step 3. Add a Debug Node

Drag a Debug node into the workspace and connect it to Function.

The complete flow should look like this:

Inject → Function → Debug

Step 4. Deploy the Flow

Click Deploy.

Press the button on the left side of the Inject node.

The debug sidebar should display:

Node-RED is running on the VPS

Creating a Simple HTTP Endpoint

Node-RED can expose lightweight HTTP APIs.

Add the following nodes:

Connect them:

HTTP In → Function → HTTP Response

Configure HTTP In:

Add the following code to Function:

msg.payload = {
status: "ok",
service: "node-red"
};

msg.headers = {
"Content-Type": "application/json"
};

return msg;

Click Deploy.

Test the endpoint:

curl http://127.0.0.1:1880/api/status

Expected response:

{"status":"ok","service":"node-red"}

How the msg Object Works

Nodes exchange a JavaScript object named msg.

Example:

{
"payload": "temperature",
"topic": "sensor/room1",
"value": 24.5
}

A Function node can update its properties:

msg.payload = msg.value * 1.8 + 32;
msg.unit = "F";
return msg;

If the Function node does not return a message, the flow will not continue.

To stop processing deliberately, use:

return null;

Installing Additional Nodes

Extra integrations can be installed directly from the editor.

Open:

  1. the main menu;
  2. Manage palette;
  3. the Install tab;
  4. search for the required package;
  5. review its details and install it.

Third-party packages can add support for:

Before installing a package, review:

Where Node-RED Stores Its Data

In a standard user installation, Node-RED data is commonly stored in:

~/.node-red

The directory may contain:

The exact location depends on the system user, installation method, and configured userDir.

The active user directory is normally displayed in the Node-RED startup log.

Configuring settings.js

The main runtime configuration is stored in:

~/.node-red/settings.js

Create a backup before editing:

cp ~/.node-red/settings.js ~/.node-red/settings.js.backup

The file can be used to configure:

Restart Node-RED after changing the file.

Why the Editor Must Be Protected

The Node-RED editor allows users to:

An unauthorized user who reaches the editor may be able to change production automation or abuse stored service connections.

Public access without authentication should only be considered inside a trusted isolated network.

Generating a Password Hash

Node-RED editor authentication uses a password hash.

Install the administration CLI if it is not already available:

sudo npm install -g --unsafe-perm node-red-admin

Generate the hash:

node-red-admin hash-pw

Enter the desired password.

The tool will return a string similar to:

$2b$08$EXAMPLE_HASH

Copy the hash for the adminAuth configuration.

Enabling Editor Authentication

Open settings.js:

nano ~/.node-red/settings.js

Find or add:

adminAuth: {
type: "credentials",
users: [{
username: "admin",
password: "$2b$08$EXAMPLE_HASH",
permissions: "*"
}]
},

Replace the example hash with the generated value.

Save the file and restart Node-RED.

The editor will now require a username and password.

Protecting HTTP Endpoints

Editor authentication and HTTP In routes are configured separately.

Basic authentication for HTTP endpoints can be enabled with httpNodeAuth:

httpNodeAuth: {
user: "apiuser",
pass: "$2b$08$EXAMPLE_HASH"
},

After restarting Node-RED, send authenticated requests:

curl -u apiuser:PASSWORD http://127.0.0.1:1880/api/status

For public APIs, a token-based mechanism, reverse proxy, or dedicated API gateway may be more appropriate.

Configuring credentialSecret

Node-RED stores node credentials in an encrypted file.

To use a persistent encryption key, add the following setting:

credentialSecret: "LONG_RANDOM_SECRET",

Use a long random value.

The secret must be included in the backup strategy. If the credentials file is restored without the correct key, Node-RED cannot decrypt stored passwords and tokens.

Secure Access Through an SSH Tunnel

If only administrators require the editor, port 1880 does not need to be exposed publicly.

Create an SSH tunnel:

ssh -L 1880:127.0.0.1:1880 root@YOUR_SERVER_IP

Then open locally:

[http://127.0.0.1:1880

(http://127.0.0.1:1880[/code)]

Advantages:

Connecting a Domain

For regular browser access, create a dedicated subdomain:

node-red.example.com

Add an A record:

Type Name Value
A node-red YOUR_SERVER_IP

Verify DNS resolution:

dig +short node-red.example.com

The command should return the VPS public IP address.

Configuring Nginx as a Reverse Proxy

Install Nginx:

sudo apt update
sudo apt install nginx -y

Create a new virtual host:

sudo nano /etc/nginx/sites-available/node-red

Add:

server {
listen 80;
server_name node-red.example.com;

```
location / {
proxy_pass http://127.0.0.1:1880;
proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
```

}

Enable the configuration:

sudo ln -s /etc/nginx/sites-available/node-red /etc/nginx/sites-enabled/node-red

Test Nginx:

sudo nginx -t

Reload the service:

sudo systemctl reload nginx

Obtaining an SSL Certificate

Install Certbot:

sudo apt install certbot python3-certbot-nginx -y

Request a certificate:

sudo certbot --nginx -d node-red.example.com

After the certificate is installed, open:

[https://node-red.example.com

(https://node-red.example.com[/code)]

HTTPS encrypts the connection but does not replace editor authentication. Keep adminAuth enabled.

Configuring the Firewall

Allow SSH:

sudo ufw allow OpenSSH

For a reverse proxy, allow HTTP and HTTPS:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

Enable UFW:

sudo ufw enable

Review the rules:

sudo ufw status verbose

Once Nginx is configured, port 1880 does not need to be publicly accessible.

Before enabling the firewall, open a second SSH session and verify that the server remains reachable.

Running Node-RED as a System Service

Node-RED should start automatically after a VPS reboot.

Search for the installed service:

systemctl list-units --type=service | grep -i node-red

Check the status:

sudo systemctl status nodered

or:

sudo systemctl status node-red

Restart the service:

sudo systemctl restart nodered

Enable automatic startup:

sudo systemctl enable nodered

The exact service name depends on how the prepared application was built.

Viewing Node-RED Logs

For a systemd service, use:

sudo journalctl -u nodered

Follow new entries:

sudo journalctl -u nodered -f

Display the last 100 records:

sudo journalctl -u nodered -n 100

Replace nodered if the service uses another name.

The startup logs can reveal:

Using Environment Variables

Avoid storing tokens and passwords directly in Function nodes.

Define a variable such as:

API_TOKEN=example-secret

Read it in a Function node:

const token = env.get("API_TOKEN");

msg.headers = {
Authorization: "Bearer " + token
};

return msg;

Environment variables simplify:

Node-RED Context Storage

Node-RED supports three context scopes:

Store a value:

flow.set("counter", 10);

Read it:

const counter = flow.get("counter") || 0;

By default, context may be stored in memory and lost after a restart.

For persistent values, configure filesystem-based context storage.

Enabling Persistent Context

Add the following to settings.js:

contextStorage: {
default: {
module: "localfilesystem"
}
},

After restarting Node-RED, context values will be periodically written to disk.

Filesystem context is appropriate for small state values but should not replace a database for large datasets or transactional information.

Handling Errors in Flows

Node-RED includes several nodes for operational visibility:

An error notification flow might look like this:

Main Flow → Error → Catch → Format Message → Telegram

Production automations should handle:

Preventing Infinite Loops

Incorrectly connected nodes can create a loop that continuously generates messages.

Possible consequences:

For repeating operations, use:

Backing Up Node-RED

A backup should include:

Create an archive of the user directory:

tar -czf node-red-backup.tar.gz ~/.node-red

Do not keep the only copy on the same VPS.

The archive may contain sensitive information. Therefore:

Exporting and Importing Flows

To export a flow:

  1. select the required nodes;
  2. open the main menu;
  3. choose Export;
  4. copy the generated JSON.

To import:

  1. open the menu;
  2. choose Import;
  3. paste the JSON;
  4. place the nodes in the workspace;
  5. review the configuration;
  6. click Deploy.

Exported JSON may reveal the structure of integrations. Review it before sharing publicly.

Node-RED Security Checklist

Useful Commands

Action Command
Check Node.js node --version
Check npm npm --version
Check Node-RED node-red --version
Check port 1880 sudo ss -lntp | grep 1880
Check the service sudo systemctl status nodered
Restart the service sudo systemctl restart nodered
Follow the logs sudo journalctl -u nodered -f
Check memory free -h
Check disk usage df -h

Common Node-RED Problems

The Editor Does Not Open

Check the listening port:

sudo ss -lntp | grep 1880

Check the process:

ps aux | grep node-red

Review the firewall:

sudo ufw status verbose

Test locally:

curl -I [http://127.0.0.1:1880

(http://127.0.0.1:1880[/code)]

If the local request succeeds, investigate the firewall, reverse proxy, or cloud networking rules.

Port 1880 Is Already in Use

Find the process:

sudo lsof -i :1880

or:

sudo ss -lntp | grep 1880

Stop the conflicting service or change the Node-RED port in settings.js.

Node-RED Does Not Start After Editing settings.js

A syntax error is a common cause.

Check the journal:

sudo journalctl -u nodered -n 100

Restore the backup:

cp ~/.node-red/settings.js.backup ~/.node-red/settings.js

Restart the service.

Some Nodes Appear as Unknown

The imported flow depends on a package that is not installed.

Check:

Install the required module and restart Node-RED.

Stored Credentials Cannot Be Decrypted

The environment may be using the wrong credentialSecret.

Verify that:

Without the correct secret, passwords and tokens must be entered again.

A Flow Does Not Run After Deployment

Check:

Add Debug nodes after important stages to locate where processing stops.

Node-RED Uses Too Much CPU

Possible causes:

Check system load:

top

Disable suspicious flows temporarily and add rate limiting.

The VPS Runs Out of Memory

Check memory:

free -h

List the largest processes:

ps aux --sort=-%mem | head

If memory pressure is persistent:

When Node-RED Is a Good Choice

Requirement Is Node-RED Suitable?
Connect several APIs Yes
Process MQTT and IoT events Yes
Create a webhook handler Yes
Build an automation prototype quickly Yes
Build a high-load application with complex business logic A dedicated backend may be more appropriate
Publish the editor without authentication No

Frequently Asked Questions

What is Node-RED?

Node-RED is a Node.js-based low-code platform for building automations and integrations from visually connected nodes.

Can I deploy Node-RED through the Serverspace control panel?

Yes. Select Node-RED from the 1-Click Apps catalog while creating a cloud server. Serverspace will prepare the virtual machine and application automatically.

How many resources does Node-RED require?

A small test project can run with 1 vCPU, 1–2 GB of RAM, and 10–20 GB of storage. Several persistent flows may require at least 2 GB of RAM.

Which port does Node-RED use?

The editor and HTTP endpoints use TCP port 1880 by default.

Is it safe to expose port 1880 to the Internet?

Not without authentication. Use an SSH tunnel or a reverse proxy with HTTPS, and enable adminAuth for the editor.

Can Node-RED be used to create an API?

Yes. HTTP In, Function, and HTTP Response nodes can be used to create custom routes that return JSON or other content.

Where are Node-RED flows stored?

In a standard installation, user data is often stored in ~/.node-red. The exact location depends on the userDir setting and installation method.

Can Node-RED connect to MQTT?

Yes. Built-in MQTT nodes can subscribe to topics and publish messages through an MQTT broker.

How should passwords be stored in flows?

Use node credentials, a persistent credentialSecret, and environment variables. Do not place API tokens directly in Function nodes.

Can I install additional Node-RED nodes?

Yes. Packages can be installed through Manage palette or npm. Review the source, maintenance status, and compatibility before installing third-party modules.

Does Node-RED need backups?

Yes. Back up flows, credentials, settings.js, package files, custom nodes, and credentialSecret. Keep at least one copy outside the VPS.

Can Node-RED be used in production?

Yes, provided that authentication, HTTPS, backups, monitoring, error handling, and restricted editor access are configured.

Deploy Node-RED with Serverspace

The Node-RED application in Serverspace allows you to create an automation server without manually installing Node.js, npm, and the platform.

After deployment, you receive:

This environment is suitable for:

The administrator retains control over firewall rules, updates, logs, domains, certificates, and backups.

Conclusion

Node-RED simplifies automation development by providing visual flows and reusable nodes for APIs, MQTT, databases, files, messaging platforms, and other services.

The platform is useful for developers, system administrators, IoT engineers, and organizations that need to connect different applications quickly.

Deploying Node-RED through Serverspace reduces the amount of initial server preparation. Select Node-RED from the application catalog, configure the VPS resources, and deploy the virtual machine.

After the first login, protect the editor, configure HTTPS or an SSH tunnel, restrict network access, preserve credentialSecret, and organize external backups.