# Share flows between instances

**URL:** <https://discourse.nodered.org/t/share-flows-between-instances/51607>\
**Category:** General\
**Created:** [28 September 2021 09:04 UTC](https://discourse.nodered.org/t/share-flows-between-instances/51607 "2021-09-28T09:04:05Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dunken](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@Dunken](https://discourse.nodered.org/u/Dunken)\
**Post date:** [28 September 2021 09:04 UTC](https://discourse.nodered.org/t/share-flows-between-instances/51607/1 "2021-09-28T09:04:05Z")

</div>

I have independent Node-RED instances deployed and running. I would like to add something like a library to share flows among NR instances.

Can anyone help me get started with plugging in my own filesystem (e.g. S3 or EFS)? The instances should not be able to overwrite each other's library elements (flows) but to create new ones.

Important: the sharing of any flow should be optional. This means that the default location of a Node-RED instance must only be accessible by the owning instance.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [28 September 2021 11:08 UTC](https://discourse.nodered.org/t/share-flows-between-instances/51607/2 "2021-09-28T11:08:43Z")

</div>

Currently there is the ability to save flows using the `export` option othe hamburger tab (top right)

 ![Screen Shot 2021-09-28 at 6.51.15 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/1/91489c88921339ff61dcd6d9af62cc7962499ddd.png)  
 ![Screen Shot 2021-09-28 at 6.46.33 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/5/15d2871c7195512c68b5580da818570e794454d9.png)

One 'idea' is that you create a folder in `.node-red/lib/flows` called 'shareFlow' so you end up with `.node-red/lib/flows/shareFlow`. Then, in a seperate tab on each NR instance, you have a flow that contains a `watch` node that would watch the `.node-red/lib/flows/shareFlow` folder and when a new file appears, it would write it to an actual shared folder somewhere on your on your system.

You would have another flow that watches that folder and when a new entry arrives, it would copy it to that devices `.node-red/lib/flows/shareFlow` and it would now appear in the import options for that version of Node-RED.

This is an `untested idea` and others might (probably) come up with something better but it gives you a way to start experimenting.

I'll be looking forward to reports of your progress.

---

<div class="post-metadata">

**Author:** ![Dunken](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@Dunken](https://discourse.nodered.org/u/Dunken)\
**Post date:** [28 September 2021 11:44 UTC](https://discourse.nodered.org/t/share-flows-between-instances/51607/3 "2021-09-28T11:44:10Z")

</div>

Thanks for the inputs! I would like to avoid any business logic in this regard in any flow, that's why I would deploy the file-watchers rather in the backend directly.

In addition to the general approach I also have been looking for how to best inject a new storage layer (S3, EFS or even a database).

---

<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:** [28 September 2021 11:54 UTC](https://discourse.nodered.org/t/share-flows-between-instances/51607/4 "2021-09-28T11:54:29Z")

</div>

> [@zenofmud](#):
>
> One 'idea' is that you create a folder in `.node-red/lib/flows` called 'shareFlow' so you end up with `.node-red/lib/flows/shareFlow` . Then, in a seperate tab on each NR instance, you have a flow that contains a `watch` node that would watch the `.node-red/lib/flows/shareFlow` folder and when a new file appears, it would write it to an actual shared folder somewhere on your on your system.

If all the instances are on the same device or use a shared filing system, you could simple use filing system links rather than having to mess with some kind of watch process.

> [@Dunken](#):
>
> In addition to the general approach I also have been looking for how to best inject a new storage layer (S3, EFS or even a database).

For flows? Not sure that the pluggable flow system is ready for use yet is it? I know that some events have been added in preparation.

---

<div class="post-metadata">

**Author:** ![Dunken](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@Dunken](https://discourse.nodered.org/u/Dunken)\
**Post date:** [28 September 2021 12:03 UTC](https://discourse.nodered.org/t/share-flows-between-instances/51607/5 "2021-09-28T12:03:01Z")

</div>

> [@TotallyInformation](#):
>
> For flows? Not sure that the pluggable flow system is ready for use yet is it? I know that some events have been added in preparation.

Yes, for flows. I'm wondering if I have to use [storageModule](https://nodered.org/docs/api/storage/)

---

<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:** [28 September 2021 12:08 UTC](https://discourse.nodered.org/t/share-flows-between-instances/51607/6 "2021-09-28T12:08:40Z")

</div>

> [@Dunken](#):
>
> Yes, for flows. I'm wondering if I have to use [storageModule](https://nodered.org/docs/api/storage/)

Ah, yes, that's it. I'd forgotten that was there.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [28 September 2021 12:34 UTC](https://discourse.nodered.org/t/share-flows-between-instances/51607/7 "2021-09-28T12:34:45Z")

</div>

When you say you want to share flows between instances, if you mean you want two instances of Node-RED to load the same flows, then you can use a custom storage plugin as others have pointed you at.  
For example, the IBM Cloud instance uses a Cloudant based storage layer for storing flows etc. [node-red-app/cloudantStorage.js at master · IBM/node-red-app · GitHub](https://github.com/IBM/node-red-app/blob/master/cloudantStorage.js)

If by sharing you mean you'd like two separate instances of Node-RED to easily share flows and allow the users to import/export flows that are shared, you can use the pluggable library system that was more recently introduced. This will show up in the `import/export` dialog as a new library source - alongside the 'local' and 'examples' libraries that are there.

Details of that plugin api are here: [designs/pluggable-library.md at master · node-red/designs · GitHub](https://github.com/node-red/designs/blob/master/designs/pluggable-library.md)

---

<div class="post-metadata">

**Author:** ![Dunken](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@Dunken](https://discourse.nodered.org/u/Dunken)\
**Post date:** [28 September 2021 13:25 UTC](https://discourse.nodered.org/t/share-flows-between-instances/51607/8 "2021-09-28T13:25:19Z")

</div>

That's a good question... I guess I tried to solve the latter use-case with a storage plugin...

It's definitively separate instances. I also believe the assets should show up in the import/export dialog. Is it now a new source or is it part of 'local' I don't care too much to be honest (if it's under 'local' I would have imagined something like a 'mySharedAssets' folder (writable - will be shared with others) and a 'readSharedAssets' folder (read-only - contains assets of other NR instances 'mySharedAssets' folder).

I definitively don't need an Editor plugin as I would configure the plugin during the deployment. However, just from looking at the [referenced example](https://github.com/node-red/designs/blob/master/designs/pluggable-library.md) it's unclear to me how I would have to to expose the different libraries... (e.g. does this Admin API now contain something like a /library endpoint?)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [28 September 2021 13:34 UTC](https://discourse.nodered.org/t/share-flows-between-instances/51607/9 "2021-09-28T13:34:19Z")

</div>

1. if you want to do everything under the 'local' library, then that is part of the core Storage API.

2. If you want to add custom library sources beyond the 'local' entry, then yes, you need a library plugin.

The design note I linked you to was possibly a bit lower level detail than what you need.

A better example is the Library File Store plugin here: [GitHub - node-red/node-red-library-file-store](https://github.com/node-red/node-red-library-file-store)

That plugin can be used to add additional library sources that are backed by the local file system.

If you wanted the library to be backed by some other storage, then you'd need to create a plugin that does the work to talk to that storage. The file store plugin is the only one that exists, as far as I know, but the concept was always to create plugins for other common types of storage.

---

<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:** [12 October 2021 13:34 UTC](https://discourse.nodered.org/t/share-flows-between-instances/51607/10 "2021-10-12T13:34:51Z")

</div>

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