Using Capacitor with Nx Monorepo

I have been experimenting with using Capacitor in an Nx monorepo and I am close to getting things working well, but have just a couple of issues. First of all, I would like to have an app in my Nx workspace dedicated to Capacitor for another given app. Directory-wise, it looks like this:


Due to the monorepo nature of Nx, I would like my capacitor.config.json to be located within mobile-app-cap/ so I could have multiple Capacitor apps in a given workspace. The problem is that when I try to do npx cap add from the root of the project then it doesn’t find my capacitor.config.json, and then I run that command from the mobile-app-cap/ folder it says that it cannot find the package.json and should be ran from the root.

That being said, the Ionic CLI has some multi-app support with the ionic.config.json ( so it seems like Capacitor should be able to handle this structure.

Is there a parameter that can be passed into the capacitor commands that can specify the project directory where capacitor.config.json lives and where I want the native project folders to be generated? I ideally would like to run these commands from the root project directory without having to rely on the Ionic CLI.

Thanks in advance!