# What do you think about bundling flows?

**URL:** <https://discourse.nodered.org/t/what-do-you-think-about-bundling-flows/91081>\
**Category:** General\
**Created:** [18 September 2024 18:29 UTC](https://discourse.nodered.org/t/what-do-you-think-about-bundling-flows/91081 "2024-09-18T18:29:01Z")\
**Posts on this page:** 6\
**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:** [18 September 2024 18:29 UTC](https://discourse.nodered.org/t/what-do-you-think-about-bundling-flows/91081/1 "2024-09-18T18:29:02Z")

</div>

I've been thinking about it for a week now. What if I scan a flow.json, get all node types, find their nodes, and then build a single bundled dependency which has all nodes required to run that flow? It is going to feel like Im building an application.

Because I will be bundling all nodes that are part of a flow, all the code from node dependencies that are not used is going to be removed (tree shaking), and there will be a single minified javascript in both server and client. I believe the flow startup will load so much faster, dockerized flows will be smaller, and there will be no longer thousands of duplicate dependencies!

Has anyone tried it?

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [18 September 2024 18:33 UTC](https://discourse.nodered.org/t/what-do-you-think-about-bundling-flows/91081/2 "2024-09-18T18:33:00Z")

</div>

Hi @AllanOricil

This might interest you - its a framework that I built to create "Single File Executables"  
the READ-ME has all the gory bits.

> **[GitHub - marcus-j-davies/Node-RED-SFE: A Single File Executable framework for Node-RED](https://github.com/marcus-j-davies/Node-RED-SFE)**
>
> A Single File Executable framework for Node-RED

It basically compiles Node RED with embedded flows/modules to an S.F.E  
Not sure it's related - but maybe useful for you

its based on Node RED v4 + `ESBuild` + `PKG`

EDIT  
See original post : [Node RED v4 : Single File Executable](https://discourse.nodered.org/t/node-red-v4-single-file-executable/89323)  
and lets not forget @dceejay also had fun here : [GitHub - dceejay/electron-node-red: Electron Node-RED template](https://github.com/dceejay/electron-node-red)

---

<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:** [18 September 2024 20:27 UTC](https://discourse.nodered.org/t/what-do-you-think-about-bundling-flows/91081/3 "2024-09-18T20:27:39Z")

</div>

Will check that out. Thanks @marcus-j-davies

---

<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:** [18 September 2024 20:48 UTC](https://discourse.nodered.org/t/what-do-you-think-about-bundling-flows/91081/4 "2024-09-18T20:48:52Z")

</div>

I read the `build.js` and what I have in mind is different. Im not packing a flow into a standalone app, I'm just optmizing the flow by bundling all its depndencies, and not copying them over to the packaged app. This would result in 1 single dependency, like a huge node package. All code that isn't used would he gone. In node\_modules there would exist only a single package, with a single huge minified index.js. The same for index.html, locales, icons, examples assets.

After bundling the flow, I could use your `build.js` to pack it. There would exist 1 dependency in node\_modules.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [18 September 2024 20:50 UTC](https://discourse.nodered.org/t/what-do-you-think-about-bundling-flows/91081/5 "2024-09-18T20:50:49Z")

</div>

Worth a try to see how it goes

---

<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:** [17 December 2024 20:51 UTC](https://discourse.nodered.org/t/what-do-you-think-about-bundling-flows/91081/6 "2024-12-17T20:51:09Z")

</div>

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