As someone with experience in compiling elm tools to JavaScript using GHCJS, I’d like to offer the following advice:
Try running it on a server first. Heroku is free and easy. GHCJS is very difficult to set up and use, and the code files it generates are enormous. You’ll also have to write a custom entrypoint to replace the command line interface. Lastly, there’s no guarantee that the Haskell codebase for elm-format will remain compatible with JavaScript compiler backends. This is for sure the hardest and least straightforward way to integrate elm-format into a web-based UI. I had to learn this hard way, and I hope at least that can be so you don’t have to!