diff --git a/docs/user/custom-npm-packages.md b/docs/user/custom-npm-packages.md index fec7a5cc64..a590718132 100644 --- a/docs/user/custom-npm-packages.md +++ b/docs/user/custom-npm-packages.md @@ -16,6 +16,10 @@ catalogue file. FlowFuse has two solutions for this: 1. FlowFuse Hosted Nodes - Use the private NPM registry hosted by FlowFuse to store and manage your custom npm packages. 2. Third-Party NPM Registries - If you already have a private npm registry, you can enable access to these in your Instance's settings. +{% note %} +To package an existing Node-RED **subflow** as a node from the editor — without hand-authoring an npm package — see [Packaging Subflows](/docs/user/packaging-subflows.md). +{% endnote %} + ## FlowFuse Hosted Nodes If you want to create a Node-RED node for private use by Instances in your diff --git a/docs/user/images/subflow-catalogue.png b/docs/user/images/subflow-catalogue.png new file mode 100644 index 0000000000..6a0c85ffa9 Binary files /dev/null and b/docs/user/images/subflow-catalogue.png differ diff --git a/docs/user/images/subflow-export.png b/docs/user/images/subflow-export.png new file mode 100644 index 0000000000..cf50db1639 Binary files /dev/null and b/docs/user/images/subflow-export.png differ diff --git a/docs/user/packaging-subflows.md b/docs/user/packaging-subflows.md new file mode 100644 index 0000000000..66026f9bea --- /dev/null +++ b/docs/user/packaging-subflows.md @@ -0,0 +1,54 @@ +--- +navTitle: Packaging Subflows +meta: + description: Package a Node-RED subflow as an installable custom node and publish it to your Team's Custom Nodes library. +--- + +# Packaging Subflows as Custom Nodes + +FlowFuse can package a Node-RED [subflow](https://nodered.org/docs/user-guide/editor/workspace/subflows) as an installable Node-RED node and publish it to your Team's Custom Nodes library. This lets you maintain a reusable block of logic or UI in one place and pull it into other instances like any other node, instead of copying flows between projects. + +{% warning %} +**Packaging is Hosted Instances only.** You can only *export* a subflow from a **Hosted Instance's** Node-RED editor — not from a Remote Instance (device). Once published, the resulting custom node can be **installed and used on any instance type**, Hosted or Remote. +{% endwarning %} + +## Requirements + +- A **Hosted Instance** running the **latest Node-RED version** on **FlowFuse v2.21.0** or later +- The [Shared Team Library](/docs/user/shared-library.md) feature enabled for the Team + +## Packaging a subflow + +1. In the Hosted Instance's **Node-RED editor**, build your flow and **convert it to a subflow**. +2. Open the **Subflow exporter** sidebar and select that subflow. +3. **Fill out the package details** — the node's **name** and **version** — and hit **Publish**. + +![Node-RED editor with the Subflow export sidebar open](./images/subflow-export.png){data-zoomable} +_The Subflow export sidebar in the Node-RED editor_ + +FlowFuse builds the subflow into a Node-RED node and publishes it to your Team's Custom Nodes registry, alongside any nodes published as [Custom Node Packages](/docs/user/custom-npm-packages.md). + +### Name and version matter + +The package details you enter are what the Team installs and updates against, so they aren't throwaway: + +- **Name** — becomes the custom node's package name, scoped to your Team (e.g. `@flowfuse-/`; the correct prefix is shown in the FlowFuse application). Keep it stable — republishing under the **same name updates that node** everywhere it's installed, while a **different name creates a separate node**. +- **Version** — bump it every time you republish. Instances see the new version in the Team Library catalogue and can update to it. This is the low-code **version control** for your custom nodes — no npm or Git to manage yourself. + +## Installing the packaged node + +The packaged subflow is added to the catalogue generated by your [Shared Team Library](/docs/user/shared-library.md). To use it in any other Node-RED instance in the Team — **Hosted or Remote**: + +1. Open **Manage palette** in the Node-RED editor. +2. Find the packaged node in the catalogue and install it, just like any other node. + +![Node-RED Manage palette listing the packaged subflow modules](./images/subflow-catalogue.png){data-zoomable} +_Packaged subflows appear in Manage palette, ready to install_ + +Because every instance installs from the same catalogue, you update the subflow in one place and re-publish, rather than editing copies across projects. + +## Related + +- [Custom Node Packages](/docs/user/custom-npm-packages.md) — publishing custom npm nodes to your Team's registry +- [Shared Team Library](/docs/user/shared-library.md) — how the Team Library and its catalogue work +- [Subflows](https://nodered.org/docs/user-guide/editor/workspace/subflows) — the Node-RED concept