Multi tenant codebase support?

Given this major philosophical difference between cordova and capacitor: https://capacitor.ionicframework.com/docs/cordova#native-project-management

What are the implications for single codebases that are used to generate multiple apps?

Generally speaking, the apps are different in only a small number of ways. App ID, Name, icon/splash screens, etc…

Is that something that should still be possible with capacitor?

Yes, it should be possible with Capacitor with some light custom scripting.

Capacitor generates native project artifacts that you hold onto (you don’t wipe them like with Cordova). Here’s how this could work:

  • Maintain your core, single web-based project (ideally Ionic)
  • Create each new Capacitor native app (npx cap init [appName] [appId]) as needed (manually or could be scripted)
  • If (when) the core web app is updated, you’d want to update the native apps too. So, write a script that builds the web app, then copies the web bits into each Capacitor project (using npx cap copy)

Thanks Matt!

That seems like this plan just brings us back to the cordova way of doing things. If I go that far, it probably makes sense to just .gitignore the platforms directory just like a cordova project and rebuild the native code bases when necessary (plugin changes, emulating, build/release, etc…) - it doesn’t necessary to “hold onto them” as you suggest.

Am I missing something?

There isn’t a Platforms directory in Capacitor - there are “top level” iOS and Android folders. It’s hard to represent directories in text, but I’ll try as a means to explain my answer better.

MyApp folder
    /core-web (this is your web based ionic app)
    capApp1 (separate Capacitor app)
       /src - web app code
       /ios - the native iOS project
      /android - the native Android project
    capApp2 (separate Capacitor app)
      /src - the web app code
      /ios - the native iOS project
      /android - the native Android project
    build.sh (build script)

The Build script builds the Ionic app (in “core-web” folder), then copies that compiled code into capApp1 and capApp2 “src” folders, then run Capacitor commands (npx cap copy) to move that into the native projects (ios and android folders), and onward. There’s more details to figure out of course, but that’s my general idea.