How to configure separate databases for each add-ons project in a modular Jmix application?

I’m developing a modular Jmix application with the following requirements:

  1. Main Application: Uses its own primary database.
  2. Add-on Modules: Each should connect to its own separate database (e.g., ‘Addon1’ → ‘DB1’, ‘Addon2’ → ‘DB2’).

What I’ve tried/considered:

*Defining multiple datasources in application.properties, but unsure how to bind them to specific modules.

Hello,

as you know, Jmix application by default uses a database not just for the user data, but for the system internal data itself, like users, settings, also addons like reports and bpm add their own tables to use.

Now you want to make an addon, that will use its tables in a different database, but still use common system data form the primary database, is that correct?

If yes, first thing that comes to my mind is to use additional datastores pointing to different databases
https://docs.jmix.io/jmix/data-model/data-stores.html#additional
image

If more complex scenarios are involved you can look into
https://docs.jmix.io/jmix/rest-ds/index.html

Kind regards,
Mladen