node-red-plugin-subflow-exporter
v1.0.0
Published
Adds menu items to export all subflows as JSON
Readme
Subflow Exporter (Node-RED Editor Plugin)
Export exactly what you need — selected flows (tabs) and/or subflows — in one JSON file, straight from the editor. Adds a “Subflow exporter” sidebar with checkboxes, quick select actions, and an Export button.
What problem it solves
- No bulk export in UI. Node-RED lets you export nodes/flows one by one. That’s slow and error-prone for large workspaces.
- Subflow completeness. Copying only a
subflowdefinition (or only its instances) is not enough; you also need all inner nodes and often related config nodes. - Selective migration. You often want to move just some flows/subflows (e.g., a feature pack) without dumping the entire workspace.
This plugin:
- Lists all Flows (tabs) and all Subflows with checkboxes.
- Optionally includes referenced subflows and config nodes.
- Exports a clean, import-ready JSON you can drop into another Node-RED via Menu → Import.
How it works (high-level)
The sidebar uses the editor API to
GET /flows. It supports both API v1 (array) and API v2 ({rev, flows:[…]}).It builds the export from your selections:
- Flow (tab): adds the
tab+ all nodes withz == tab.id. - Subflow: adds the
subflowdefinition + all inner nodes withz == subflow.id.
- Flow (tab): adds the
Options:
- Auto-include referenced subflows: if selected items contain instances like
type: "subflow:<id>", the plugin also includes those subflow definitions and their inner nodes. - Include all config nodes: adds all config nodes (nodes with no
z, excludingtab/subflow), to avoid “missing config” on import.
- Auto-include referenced subflows: if selected items contain instances like
Packages the result into a single JSON and triggers a browser download.
Where to find it in the UI
Open the Node-RED editor → right sidebar → “Subflow exporter” tab.
Controls:
Export selected (button)
Refresh (reloads workspace list)
Options: Auto-include referenced subflows, Include all config nodes
Two lists with checkboxes:
- Flows (tab) — with Select all / None
- Subflows — with Select all / None
Installation
npm install node-red-plugin-subflow-exporter
Requirements
- Node-RED with editor plugins supported.
- Browser session already authenticated if
adminAuthis enabled. - No runtime nodes are installed — this is editor-only.
Usage
Open Subflow exporter in the sidebar.
Click Refresh to load workspace metadata.
Tick what you need:
- Flows (tabs)
- Subflows
Pick options:
- Auto-include referenced subflows (recommended)
- Include all config nodes (recommended when moving to a new instance)
Click Export selected → a file like
selected-flows-YYYYMMDD-HHMMSS.jsondownloads.In the target Node-RED: Menu → Import → paste/upload JSON → Import.
Data format
A flat JSON array of Node-RED nodes:
- Selected
taband/orsubflowobjects, - All their inner nodes (matching
z), - Optional config nodes (no
z), - Optional referenced subflows (definition + inner nodes).
- Selected
Ready for standard Import in Node-RED.
Notes & limitations
- Not a workspace backup. It exports only what you tick. For full backups, use your
flows.jsonand credentials strategy. - Credentials are not exported; manage them separately (env vars, secure storage, or re-enter on target).
- Config nodes: if you skip them and the target lacks the same configs, import may warn about missing references.
- Custom nodes: the target instance must have required node modules installed.
Troubleshooting
- “Nothing selected.” Tick at least one Flow or Subflow.
- “Load failed: …” Check that your editor session can reach
GET /flows(reverse proxy, auth, CORS). - “Unexpected /flows response shape.” You’re hitting a non-standard response; confirm Node-RED version and any proxies that might rewrite JSON.
- Import warnings about missing nodes/config: install the same contrib nodes on the target and/or enable Include all config nodes before exporting.
License
MIT.
