# Subflow Templates

**URL:** https://discourse.nodered.org/t/subflow-templates/97296
**Category:** Feature Requests
**Created:** [27 May 2025 16:58 UTC](https://discourse.nodered.org/t/subflow-templates/97296 "2025-05-27T16:58:06Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)
#### Post date: [27 May 2025 16:58 UTC](https://discourse.nodered.org/t/subflow-templates/97296/1 "2025-05-27T16:58:06Z")

</div>

A subflow template is a type of subflow that has predetermined inputs, outputs, and maybe env variables too, defined as JSON Schemas, but has no implementation. The implementation is done by the developer who is going to use that subflow

Use case:

I have a flow that the main flow must follow this pattern

```bash
Node A -> Subflow B(1) -> Subflow B(2) ->... Subflow B(3) -> Node C

```

Subflows B are templates that I created and I need developers to implement them. The outputs and inputs of these subflows can't be changed by the developer. The developer must ensure the inputs and outputs conform to the described template pattern. At runtime Subflow Templates will throw exception if the input or output data doesn't comply with its specs.

Another use case is that it would be possible to create examples with subflow templates, and share those with my library of nodes.

When clicking on the deploy buttonn, a verification will run to validate if there are subflows templates with missing implementations.

Possible feature for the future:  
When/if node-red is rewritten in typescript, we could define subflow templates outputs and inputs with interfaces and types, and validate them at compile time. With ts the subflow template wrapper/node would accept generics for inputs and outputs. In the UI/Editor there would exist 2 new configs in the form where the author of the subflow can specify the Interface/Type for inputs and outputs.

---

<div class="post-metadata">

### Author: ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)
#### Post date: [27 May 2025 17:33 UTC](https://discourse.nodered.org/t/subflow-templates/97296/2 "2025-05-27T17:33:40Z")

</div>

> [@AllanOricil](#):
>
> When/if node-red is rewritten in typescript,

Never, there's a lot of work for an uncertain benefit. The typing I'm writing will already help.

I'm having trouble understanding your request 🤔

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [27 May 2025 19:35 UTC](https://discourse.nodered.org/t/subflow-templates/97296/3 "2025-05-27T19:35:20Z")

</div>

> [@GogoVega](#):
>
> Never, there's a lot of work for an uncertain benefit. The typing I'm writing will already help.

Agree there. I've just created my first proper typings - but not because I wrote them, I can barely read the horrid things. Nope, GitHub Copilot using Claude Sonnet 4 did it for me! 😃

JSDoc provides even more help, especially with VS Code. Many standard typings (e.g. HTML API's) are so broken, I often end up turning off TS checks.

---

<div class="post-metadata">

### Author: ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)
#### Post date: [27 May 2025 22:15 UTC](https://discourse.nodered.org/t/subflow-templates/97296/4 "2025-05-27T22:15:50Z")

</div>

Never mind. I found a way to do this

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [26 July 2025 22:15 UTC](https://discourse.nodered.org/t/subflow-templates/97296/5 "2025-07-26T22:15:53Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
