# Is there a node-red backend engine?

**URL:** <https://discourse.nodered.org/t/is-there-a-node-red-backend-engine/41403>\
**Category:** General\
**Created:** [22 February 2021 07:46 UTC](https://discourse.nodered.org/t/is-there-a-node-red-backend-engine/41403 "2021-02-22T07:46:54Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddk](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@ddk](https://discourse.nodered.org/u/ddk)\
**Post date:** [22 February 2021 07:46 UTC](https://discourse.nodered.org/t/is-there-a-node-red-backend-engine/41403/1 "2021-02-22T07:46:54Z")

</div>

Hi  
I just started using node-red recently.  
Is there such a back-end engine that can directly parse the node-red workflow? In this way, workflow design and debugging can be done in the cloud, and then directly deployed to the device side, and finally executed on the device side using the engine?  
Thanks!

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 February 2021 07:52 UTC](https://discourse.nodered.org/t/is-there-a-node-red-backend-engine/41403/2 "2021-02-22T07:52:08Z")

</div>

In a sense, that's what you have.

You run node-red on device1 then open a web page on device2 (via the internet if you wish) and program it (by simply entering the URL of device1)

Unless I misunderstand you?

---

<div class="post-metadata">

**Author:** ![ddk](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@ddk](https://discourse.nodered.org/u/ddk)\
**Post date:** [22 February 2021 09:16 UTC](https://discourse.nodered.org/t/is-there-a-node-red-backend-engine/41403/3 "2021-02-22T09:16:11Z")

</div>

Thanks for you reply.

node-red is run on cloud such as device1.After build your own workflow on cloud, you can package your config and js files or something else and deploy them to device2, devices2 has a lightweight backend engine that can translate and execute the corresponding files. This is what I'm looking for, the lightweight backend engine.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 February 2021 09:27 UTC](https://discourse.nodered.org/t/is-there-a-node-red-backend-engine/41403/4 "2021-02-22T09:27:18Z")

</div>

I personally dont understand why you would want to when you can simply access the editor of device2 from a web page anywhere in the world but you obviously have your reasons and since you ask...

it is possible to disable the editor (see docs and look in settings.js file) on `device2` (making it a runtime only instance). You would need another instance of node-red (on `device1`) to do your flows. Once you are happy with the work, copy the flow files to `device2` and restart it.

The disadvantage of this is what you deploy on `device1`, while you are preparing flows for `device2` will actually be executed on `device1`.

A work around for that is that you **dont deploy** to `device1` but simply do your flow design then export (CTRL+E) all flows to file. Then you can copy the export to `device2` and restart it.

In short, what you are looking for is not something specifically handled (but I believe similar topics have been discussed on the forum before about splitting runtime from editor). As it stands, this is not a thing.

---

<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:** [22 February 2021 13:28 UTC](https://discourse.nodered.org/t/is-there-a-node-red-backend-engine/41403/5 "2021-02-22T13:28:19Z")

</div>

> [@ddk](#):
>
> node-red is run on cloud such as device1.After build your own workflow on cloud, you can package your config and js files or something else and deploy them to device2, devices2 has a lightweight backend engine that can translate and execute the corresponding files. This is what I'm looking for, the lightweight backend engine.

Yes, you need to configure your "lite" version to use just the runtime and not the editor, this can be set in the settings.js file.

Node-RED itself is already the "back end" as Steve has indicated, all you are doing is telling the runtime not to bother presenting the Editor which is the admin front-end.

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [22 February 2021 19:22 UTC](https://discourse.nodered.org/t/is-there-a-node-red-backend-engine/41403/6 "2021-02-22T19:22:40Z")

</div>

The node-red runtime (a.k.a. back-end server) directly interprets the flows.json file, which is normally picked up from the file system when the runtime engine starts up. But there is nothing specifically tied to the back-end server host -- the flows JSON structure can be generated by anything, even a bash script, database query, or another node-red flow.

A couple years ago I was using one "admin" node-red instance to pull device records from a database query, build a (flows) JSON string with all of those devices in their own flows, and finally push this dynamically created "flow" file to multiple "worker" node-red servers (raspberry pis). This is possible because the node-red runtime server has its own [Admin API](https://nodered.org/docs/api/admin/methods/post/flows/) that you can "POST" the new flow.json -- which causes the updated runtime to start running immediately.

---

<div class="post-metadata">

**Author:** ![ddk](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@ddk](https://discourse.nodered.org/u/ddk)\
**Post date:** [23 February 2021 01:45 UTC](https://discourse.nodered.org/t/is-there-a-node-red-backend-engine/41403/7 "2021-02-23T01:45:44Z")

</div>

I will try your solution.Thanks!

---

<div class="post-metadata">

**Author:** ![ddk](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@ddk](https://discourse.nodered.org/u/ddk)\
**Post date:** [23 February 2021 01:48 UTC](https://discourse.nodered.org/t/is-there-a-node-red-backend-engine/41403/8 "2021-02-23T01:48:58Z")

</div>

Do you have plans to implement a function similar to the bridge mode so that two node-reds can communicate and deploy directly.

---

<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:** [23 February 2021 01:55 UTC](https://discourse.nodered.org/t/is-there-a-node-red-backend-engine/41403/9 "2021-02-23T01:55:45Z")

</div>

As shrickus has already indicated, this should already be possible using Node-RED's existing API's.

---

<div class="post-metadata">

**Author:** ![ddk](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@ddk](https://discourse.nodered.org/u/ddk)\
**Post date:** [23 February 2021 15:32 UTC](https://discourse.nodered.org/t/is-there-a-node-red-backend-engine/41403/10 "2021-02-23T15:32:32Z")

</div>

I have made a simple master flow that can deploy other flows to the salve machine through MQTT and node-red admin api, but there are two small problems:

1. Can the module node on the master side be pushed to the salve side through MQTT
2. How to package a custom flow in a node-red docker and execute it automatically

The following is my flow config:

```auto
[{"id":"3af82246.3634ae","type":"tab","label":"master","disabled":false,"info":""},{"id":"59a119b9.5b4d28","type":"tab","label":"deploy","disabled":false,"info":""},{"id":"8ea86eb7.94cb","type":"inject","z":"3af82246.3634ae","name":"deploy","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"name","v":"deploy","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"flows","payload":"","payloadType":"str","x":320,"y":280,"wires":[["d310add0.24f6c8"]]},{"id":"7b0e0595.3ddd54","type":"http request","z":"3af82246.3634ae","name":"get deploy info","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://localhost:1880/flow/{{{topic}}}","tls":"","persist":false,"proxy":"","authType":"","x":1000,"y":120,"wires":[["fd2b36f7.5a3c5"]]},{"id":"d310add0.24f6c8","type":"http request","z":"3af82246.3634ae","name":"get deploy","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://localhost:1880/{{{topic}}}","tls":"","persist":false,"proxy":"","authType":"","x":470,"y":380,"wires":[["ace56037.2b55a"]]},{"id":"35604dc8.b5fc1a","type":"change","z":"3af82246.3634ae","name":"filter deploy msg","rules":[{"t":"set","p":"filter","pt":"msg","to":"total[type = 'tab']","tot":"jsonata"},{"t":"set","p":"filter","pt":"msg","to":"total[label = $$.name]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":380,"wires":[["b0ae266a.77a718"]]},{"id":"fd2b36f7.5a3c5","type":"mqtt out","z":"3af82246.3634ae","name":"deploy","topic":"deploy","qos":"2","retain":"","broker":"","x":1430,"y":260,"wires":[]},{"id":"c47ec783.69ae48","type":"mqtt in","z":"3af82246.3634ae","name":"","topic":"deploy","qos":"2","datatype":"auto","broker":"","x":310,"y":560,"wires":[["26be6a1.26b6e96"]]},{"id":"7de1adb.f3b4f54","type":"http request","z":"3af82246.3634ae","name":"","method":"POST","ret":"obj","paytoqs":"ignore","url":"http://localhost:1880/flow","tls":"","persist":false,"proxy":"","authType":"","x":710,"y":480,"wires":[["cd2bb124.f5ab08"]]},{"id":"cd2bb124.f5ab08","type":"debug","z":"3af82246.3634ae","name":"slave","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":910,"y":480,"wires":[]},{"id":"9e530af5.38944","type":"debug","z":"3af82246.3634ae","name":"payload","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1020,"y":560,"wires":[]},{"id":"db5b4a4.4b6c5b8","type":"debug","z":"3af82246.3634ae","name":"filter","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"filter","targetType":"msg","statusVal":"","statusType":"auto","x":1370,"y":400,"wires":[]},{"id":"864e4392.0a9f38","type":"debug","z":"3af82246.3634ae","name":"topic","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"topic","targetType":"msg","statusVal":"","statusType":"auto","x":1070,"y":440,"wires":[]},{"id":"4bfd2433.b7be7c","type":"debug","z":"3af82246.3634ae","name":"total","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"total","targetType":"msg","statusVal":"","statusType":"auto","x":1370,"y":460,"wires":[]},{"id":"ace56037.2b55a","type":"change","z":"3af82246.3634ae","name":"convert payload to total","rules":[{"t":"move","p":"payload","pt":"msg","to":"total","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":240,"wires":[["35604dc8.b5fc1a"]]},{"id":"b0ae266a.77a718","type":"change","z":"3af82246.3634ae","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$append(total[id = $$.filter.id], total[z = $$.filter.id])","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":380,"wires":[["fd2b36f7.5a3c5"]]},{"id":"eae158d5.449298","type":"debug","z":"3af82246.3634ae","name":"deploy","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"deploy","targetType":"msg","statusVal":"","statusType":"auto","x":1370,"y":520,"wires":[]},{"id":"f8f32f9c.1b146","type":"change","z":"3af82246.3634ae","name":"set topic to flow id","rules":[{"t":"set","p":"topic","pt":"msg","to":"filter.id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":280,"wires":[["7b0e0595.3ddd54"]]},{"id":"26be6a1.26b6e96","type":"change","z":"3af82246.3634ae","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"nodes\": $$.payload}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":560,"wires":[["9e530af5.38944","7de1adb.f3b4f54"]]},{"id":"f887bd50.0b63c","type":"inject","z":"59a119b9.5b4d28","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"hello, world!","payloadType":"str","x":320,"y":220,"wires":[["8549fb9c.7ff1c8"]]},{"id":"8549fb9c.7ff1c8","type":"debug","z":"59a119b9.5b4d28","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":220,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [23 February 2021 17:28 UTC](https://discourse.nodered.org/t/is-there-a-node-red-backend-engine/41403/11 "2021-02-23T17:28:46Z")

</div>

1. If you mean that you installed a new node on the master flow, and want to push it to the slave, then "no"... you would have to log in to each slave and either use the Manage Palette to install the new node, or go into the userdir and use `npm install` after pushing a new package.json file.

Sadly, I cannot help with Docker, as I've not used it yet... but there is a #docker channel on slack that could probably help you.

---

<div class="post-metadata">

**Author:** ![ddk](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@ddk](https://discourse.nodered.org/u/ddk)\
**Post date:** [24 February 2021 07:37 UTC](https://discourse.nodered.org/t/is-there-a-node-red-backend-engine/41403/12 "2021-02-24T07:37:40Z")

</div>

I use the combination of admin api and exec / file node to package and load the node on the master and send it to the salve to install via mqtt. It is ready for simple use. node-red is really amazing!!

```auto
[{"id":"3af82246.3634ae","type":"tab","label":"master","disabled":false,"info":""},{"id":"78737b35.44b774","type":"tab","label":"deploy","disabled":false,"info":""},{"id":"8ea86eb7.94cb","type":"inject","z":"3af82246.3634ae","name":"deploy","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"name","v":"deploy","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"flows","payload":"","payloadType":"str","x":250,"y":380,"wires":[["d310add0.24f6c8"]]},{"id":"7b0e0595.3ddd54","type":"http request","z":"3af82246.3634ae","name":"get deploy info","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://localhost:1880/flow/{{{topic}}}","tls":"","persist":false,"proxy":"","authType":"","x":1000,"y":120,"wires":[["fd2b36f7.5a3c5"]]},{"id":"d310add0.24f6c8","type":"http request","z":"3af82246.3634ae","name":"get deploy","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://localhost:1880/{{{topic}}}","tls":"","persist":false,"proxy":"","authType":"","x":470,"y":380,"wires":[["ace56037.2b55a"]]},{"id":"35604dc8.b5fc1a","type":"change","z":"3af82246.3634ae","name":"filter deploy info","rules":[{"t":"set","p":"filter","pt":"msg","to":"total[type = 'tab']","tot":"jsonata"},{"t":"set","p":"filter","pt":"msg","to":"total[label = $$.name]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":380,"wires":[["f8f32f9c.1b146"]]},{"id":"fd2b36f7.5a3c5","type":"mqtt out","z":"3af82246.3634ae","name":"deploy","topic":"deploy","qos":"2","retain":"","broker":"","x":1430,"y":260,"wires":[]},{"id":"db5b4a4.4b6c5b8","type":"debug","z":"3af82246.3634ae","name":"filter","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"filter","targetType":"msg","statusVal":"","statusType":"auto","x":1210,"y":460,"wires":[]},{"id":"864e4392.0a9f38","type":"debug","z":"3af82246.3634ae","name":"topic","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"topic","targetType":"msg","statusVal":"","statusType":"auto","x":630,"y":520,"wires":[]},{"id":"4bfd2433.b7be7c","type":"debug","z":"3af82246.3634ae","name":"total","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"total","targetType":"msg","statusVal":"","statusType":"auto","x":810,"y":480,"wires":[]},{"id":"ace56037.2b55a","type":"change","z":"3af82246.3634ae","name":"convert payload to total","rules":[{"t":"move","p":"payload","pt":"msg","to":"total","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":260,"wires":[["35604dc8.b5fc1a"]]},{"id":"b0ae266a.77a718","type":"change","z":"3af82246.3634ae","name":"package deploy msg","rules":[{"t":"set","p":"payload","pt":"msg","to":"$append(total[id = $$.filter.id], total[z = $$.filter.id])","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1110,"y":380,"wires":[["fd2b36f7.5a3c5"]]},{"id":"eae158d5.449298","type":"debug","z":"3af82246.3634ae","name":"deploy","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"deploy","targetType":"msg","statusVal":"","statusType":"auto","x":790,"y":520,"wires":[]},{"id":"f8f32f9c.1b146","type":"change","z":"3af82246.3634ae","name":"set topic to flow id","rules":[{"t":"set","p":"topic","pt":"msg","to":"filter.id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":280,"wires":[["7b0e0595.3ddd54"]]},{"id":"cd2bb124.f5ab08","type":"debug","z":"3af82246.3634ae","name":"slave","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":630,"y":480,"wires":[]},{"id":"9e530af5.38944","type":"debug","z":"3af82246.3634ae","name":"payload","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1100,"y":600,"wires":[]},{"id":"e15d6afa.0c0898","type":"inject","z":"78737b35.44b774","name":"","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"hello","x":220,"y":200,"wires":[["e07ffc81.80f088"]]},{"id":"d42eb3cf.207058","type":"debug","z":"78737b35.44b774","name":"deploy","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":480,"y":200,"wires":[]},{"id":"5cf3530e.5ab3dc","type":"inject","z":"3af82246.3634ae","name":"module","props":[{"p":"topic","vt":"str"},{"p":"name","v":"node-red-node-random","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"nodes","x":230,"y":720,"wires":[["29592674.93748a"]]},{"id":"29592674.93748a","type":"http request","z":"3af82246.3634ae","name":"get","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://localhost:1880/nodes/{{{name}}}","tls":"","persist":false,"proxy":"","authType":"","x":370,"y":640,"wires":[["19c96a73.36234e"]]},{"id":"7f8ddf5f.71a688","type":"mqtt out","z":"3af82246.3634ae","name":"deploy module","topic":"module","qos":"1","retain":"","broker":"","x":1080,"y":780,"wires":[]},{"id":"208544bc.406fb4","type":"exec","z":"3af82246.3634ae","command":"tar cvf","addpay":true,"append":"","useSpawn":"false","timer":"30","oldrc":false,"name":"package","x":560,"y":620,"wires":[[],[],["1f1fe240.cc6ece"]]},{"id":"19c96a73.36234e","type":"function","z":"3af82246.3634ae","name":"prepare","func":"msg.path = msg.payload.path\nmsg.payload = \"/data/package.tar.gz \" + msg.path\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":460,"y":820,"wires":[["208544bc.406fb4"]]},{"id":"1f1fe240.cc6ece","type":"file in","z":"3af82246.3634ae","name":"load","filename":"/data/package.tar.gz","format":"","chunk":false,"sendError":false,"encoding":"none","x":690,"y":780,"wires":[["40780bea.f2f9e4"]]},{"id":"40780bea.f2f9e4","type":"change","z":"3af82246.3634ae","name":"append info","rules":[{"t":"move","p":"payload","pt":"msg","to":"filter","tot":"msg"},{"t":"set","p":"payload.name","pt":"msg","to":"$$.name","tot":"jsonata"},{"t":"set","p":"payload.timestamp","pt":"msg","to":"","tot":"date"},{"t":"set","p":"payload.data","pt":"msg","to":"filter","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":620,"wires":[["9e530af5.38944","7f8ddf5f.71a688"]]},{"id":"e07ffc81.80f088","type":"random","z":"78737b35.44b774","name":"","low":1,"high":10,"inte":"true","property":"payload","x":390,"y":300,"wires":[["d42eb3cf.207058"]]}]

```

---

<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:** [10 March 2021 07:37 UTC](https://discourse.nodered.org/t/is-there-a-node-red-backend-engine/41403/13 "2021-03-10T07:37:57Z")

</div>

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