For your use case, although I am not sure of Modbus compatible yet, you should check out this thread
[https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor](https://MCU plugin)
With this you can run node-red on an ESP32