Building a compiler & uploader into a desktop app

I'm working on an IOT platform with a standalone device that uses ESP8266 with the Arduino environment. For regular use, I have a mobile app that is the primary interface to the device. But I'd also like to build a desktop app that provides more granular control of the device and acts as the hub from which the app on the device can be updated.

It seems to me that using Arduino Builder with an instance of AVRdude might do the trick. Has anyone ever done this, and are there any examples out there to look at? I'm anticipating building this in NodeJS and using Electron to build it as a desktop app. One thing I'm not clear about is whether it'd be best to transfer source code remotely, such as from a GitHub repo, and then compile on the local machine, or host a compiled app on a server and simply upload to the device from the local machine. Thanks for any advice and examples.

I have written a Python program to compile and upload code using the Arduino command line. I use the Geany editor and I can call the Python program from Geany. But it can also be used at the command line.

It may give you some ideas.

...R