Motivation
I put this plugin together as a proof of concept because I struggled to develop a Custom UI-based app based on the current Forge tooling.
Atlassian Forge is a platform that simplifies Atlassian app development and hosting. Unfortunately, configuring an app with one or more Custom UIs can be a challenge because the Forge app project layout requires Custom UI projects to live within the app project, or you would have to write some custom scripts to integrate Custom UI build artifacts into the app project before deploying to the Forge platform.
Additionally, as you are building an app with Custom UI you are likely to build an API that allows your Custom UI to retrieve information from the backend (via Custom UI bridge). Setting up your project to share this code between frontend and backend provides a setup effort, again likely by crafting some custom scripts.
Finally, as you are developing a Forge app with multiple Custom UI dependencies you would likely want to have a command to quickly start all CustomUIs and the Forge app in dev mode. Without any additional tooling, this means you would go into each Custom UI project, start a dev server, and then tunnel the Forge app, or write yet another custom script.
All of this should not be that hard and many of the described challenges are actually already solved by Nx. However, because Forge has its own tooling/CLI and opinions, I have created an Nx plugin that allows Forge developers to quickly scaffold a Forge app and easily develop Custom UIs.
Goals
The Nx plugin aims to assist in efficient, scalable app development and to remove the mental overhead of how to set up a Forge project. Building on top of Nx means shared code can easily be extracted into libraries, and Custom UI can be integrated into the app and dev workflow without having to break with the monorepo project structure that Nx provides.
Current plugin state
The current plugin is a minimal and rather naive approach in trying to achieve the set goals. It currently has scripts to generate a Forge app project, build it (including Custom UI dependencies) and deploy it to the Forge platform (exclusive initial setup). See the plugin usage guide for more details.
At this stage, the plugin is missing a configuration that allows starting all Custom UI projects on a local dev server while tunneling the Forge app. Additionally, there are likely many refinements and configuration tweaks to be made on the generated plugin configurations and build scripts to cater to various use cases.
Forge app generation could potentially be improved to automatically trigger the initial registration with the Forge platform.
To circumvent challenges and limitations with Forge’s Typescript support the plugin compiles Typescript to Javascript before deploying the plugin code. This approach seems to be working for now but the actual requirements are not quite clear to me at this stage.
The Forge app generator currently does not generate any unit or E2E test configuration.
The plugin has not been tested with Forge UI. Adding support is likely a matter of minor tweaks in the generated config files.
Apart from the existing forge deploy command, additional Forge CLI commands may be exposed via Nx executors.
What now?
I have published the plugin on Github together with the demo app. I would be interested to hear from the community and Atlassian what they think of this and if this is something people would be interested in developing further. Or, maybe someone sees a bigger blocker on the horizon with this approach. I know other partners have come up with their own solutions.
If there is broader interest in developing this further, I would be happy to discuss and potentially move the project to a shared location.