Forge monorepo apps

Maybe helpful for some, maybe not: you might not actually need to use a dev server and setup tunnelling and everything.

I can give some more details on my setup if anyone is interested, but I’m basically just having one “custom” directory in my project that has one subdirectory for each custom UI. All of that is just next to the other Forge code in the project, which makes it easy to reuse code on front- and back-end.

Then I’m just using a simple webpack config to build one JS bundle for each of those subdirectories and output those bundles to a “static” output directory along with one index.html each. If your manifest references these bundles in the “static” directory then forge will pick those up, even when they change while forge tunnel is running.

With that setup you can do both full builds and live-reloading (not hot-reload though) pretty easily:

  • Working on custom UI: webpack --watch & forge tunnel
  • Working on backend but have custom UI that needs to be built once: webpack | forge tunnel
  • Full deployment: webpack && forge deploy

There might be situations where this setup does not work, but so far I released multiple Forge apps on the marketplace and it always felt pretty simple and easy to run. :man_shrugging:

4 Likes