Deploying a Node-red App
Introduction
Node-RED is an open-source flow-based development tool built on Node.js for wiring APIs, devices, and services. Deploying Node-RED with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage for flows and credentials—all managed from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, sample API usage, and production tips.
Prerequisites
- A Klutch.sh account (sign up)
- A GitHub repository containing your Node-RED Dockerfile (GitHub is the only supported git source)
- Optional credentials for external services you wire into your flows
For onboarding, see the Quick Start.
Architecture and ports
- Node-RED serves HTTP on internal port
1880; choose HTTP traffic. - Persistent storage is required for flows, settings, and credentials.
Repository layout
node-red/├── Dockerfile # Must be at repo root for auto-detection└── README.mdKeep secrets out of Git; store them in Klutch.sh environment variables.
Installation (local) and starter commands
Validate locally before pushing to GitHub:
docker build -t node-red-local .docker run -p 1880:1880 node-red-localDockerfile for Node-RED (production-ready)
Place this Dockerfile at the repo root; Klutch.sh auto-detects it (no Docker selection in the UI):
FROM nodered/node-red:3.1
ENV PORT=1880
EXPOSE 1880CMD ["npm", "start", "--", "--userDir", "/data"]Notes:
- Pin the image tag (e.g.,
3.1.x) for stability; update intentionally. - Add extra nodes or custom packages by extending the image and running
npm installfor your dependencies.
Environment variables (Klutch.sh)
Set these in Klutch.sh before deploying:
PORT=1880- Optional security:
NODE_RED_USERNAME,NODE_RED_PASSWORD(configure insettings.js), or useNODE_RED_CREDENTIAL_SECRETfor encrypted credentials. - Optional external service keys used by your flows.
If you deploy without the Dockerfile and need Nixpacks overrides:
NIXPACKS_BUILD_CMD=npm installNIXPACKS_START_CMD=npm start -- --userDir /dataNIXPACKS_NODE_VERSION=18
Attach persistent volumes
In Klutch.sh storage settings, add mount paths and sizes (no names required):
/data— flows.json, creds, and installed nodes.
Ensure this path is writable inside the container.
Deploy Node-RED on Klutch.sh (Dockerfile workflow)
- Push your repository—with the Dockerfile at the root—to GitHub.
- Open klutch.sh/app, create a project, and add an app.
- Select HTTP traffic and set the internal port to
1880. - Add the environment variables above, including any credential secrets and service keys.
- Attach a persistent volume for
/datasized for your flows and installed nodes. - Deploy. Access Node-RED at
https://example-app.klutch.shand start building flows.
Sample API usage
Hit the admin API (read-only example):
curl -X GET "https://example-app.klutch.sh/flows" \ -H "Node-RED-API-Version: v2"Import a flow (requires admin auth if enabled):
curl -X POST "https://example-app.klutch.sh/flows" \ -H "Content-Type: application/json" \ -d '{"flows":[{"id":"1","type":"tab","label":"Demo"}]}'Health checks and production tips
- Add an HTTP probe to
/or/healthzif you expose one. - Enforce HTTPS at the edge; forward internally to port
1880. - Secure the editor with user/password or an auth strategy; keep credential secrets in Klutch.sh.
- Monitor
/datausage; resize before it fills. - Pin image versions and test upgrades in staging; back up
/databefore updates.
Node-RED on Klutch.sh combines reproducible Docker builds with managed secrets, persistent storage, and flexible HTTP/TCP routing. With the Dockerfile at the repo root, port 1880 configured, and flows persisted, you can deliver reliable automation without extra YAML or workflow overhead.