# Where can I store subflow nodes with Broker / DB configuration except for \`/data/flows.json\` so that they show up in the Pallete?

**URL:** https://discourse.nodered.org/t/where-can-i-store-subflow-nodes-with-broker-db-configuration-except-for-data-flows-json-so-that-they-show-up-in-the-pallete/64838
**Category:** General
**Tags:** docker
**Created:** [8 July 2022 13:12 UTC](https://discourse.nodered.org/t/where-can-i-store-subflow-nodes-with-broker-db-configuration-except-for-data-flows-json-so-that-they-show-up-in-the-pallete/64838 "2022-07-08T13:12:32Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://discourse.nodered.org/u/Shan)
#### Post date: [8 July 2022 13:12 UTC](https://discourse.nodered.org/t/where-can-i-store-subflow-nodes-with-broker-db-configuration-except-for-data-flows-json-so-that-they-show-up-in-the-pallete/64838/1 "2022-07-08T13:12:32Z")

</div>

I am packing some _pre-configured_ nodes within subflows and currently building a container image where these subflows are stored in `/data/flows.json` file. This works great for a fresh spun up container an I am able to see my _custom_ nodes in the pallete.

I have to resort to this method because AFAIK current node-RED subflow implementation does not support configuration of brokers / databases within them if I decide to package them according to the documentation.

My personal research on the forum also backs me up:

- [Packaging a Subflow as a module, missing broker configuration](https://discourse.nodered.org/t/packaging-a-subflow-as-a-module-missing-broker-configuration/55485)
- My Hack around the solution : [MQTT configuration nodes are not recognized when packaged in a subflow module - #2 by Shan](https://discourse.nodered.org/t/mqtt-configuration-nodes-are-not-recognized-when-packaged-in-a-subflow-module/61767/2)
- [My feature request/wishlist/suggestions for 3.0](https://discourse.nodered.org/t/my-feature-request-wishlist-suggestions-for-3-0/59606#config-nodes-in-subflow-modules-1)

## Problem

since `flows.json` is a _standard_ file and there is a higher chance that it pre-exists within a host machine in a volume and may overwrite my subflow nodes hence losing my nodes within the container

### Solution / Workaround

> <https://github.com/shantanoo-desai/node-red-subflows-mqtt/issues/1>
>
> Upon deploying the stack with the custom node-red instance which has all the ded…icates subflows in them, the logs will provide the logs stating that one cannot connect to respective (external, internal) brokers since their configuration is not available.
> 
> \## Bug Reports
> 
> \- \[Packaging a Subflow as a module, missing broker configuration\]\[1\]
> \- \[My Post on the discourse forum for node-red\]\[2\]
> \- \[Feature Request for Config nodes in Subflows\]\[3\]
> 
> \[1\]: https://discourse.nodered.org/t/packaging-a-subflow-as-a-module-missing-broker-configuration/55485
> \[2\]: https://discourse.nodered.org/t/mqtt-configuration-nodes-are-not-recognized-when-packaged-in-a-subflow-module/61767
> \[3\]: https://discourse.nodered.org/t/my-feature-request-wishlist-suggestions-for-3-0/59606#config-nodes-in-subflow-modules-1
> 
> \## Solution / Workaround
> 
> Since there currently no config node support within subflows, the only possible way to achieve the subflow as nodes is to:
> 
> 1. export them all to a JSON
> 2. pack them into a \`flows.json\`
> 3. Generate a node-red image with where the \`flows.json\` file is \`/data/flows.json\` in the image

I tried a possible solution of copying the `flow.json` (which has the subflow nodes) to `/data/lib/flows.json` which will NOT display them in the pallete (but will be accessible via the file-system search menu)

### Repo

My Repository where I tried a lot of things with subflow nodes [GitHub - shantanoo-desai/node-red-subflows-mqtt: Create Custom Nodes in node-red using subflows for MQTT Broker](https://github.com/shantanoo-desai/node-red-subflows-mqtt)  
for reproduction purposes

## Query

Is there some other file within the `/data` directory where I can pack these subflow nodes and they will be available to me in the pallete without having to worry about being written by existing `flows.json` file from some volumes that can be mounted to the container?

---

<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: [6 September 2022 13:12 UTC](https://discourse.nodered.org/t/where-can-i-store-subflow-nodes-with-broker-db-configuration-except-for-data-flows-json-so-that-they-show-up-in-the-pallete/64838/2 "2022-09-06T13:12:35Z")

</div>

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