Ameen
05/15/2026, 3:26 AMshared.
• I want these modules to live in a common place and be accessible without wiring everything through MainApplication.
• The DI setup currently lives inside shared.
• I don’t want those modules to depend directly on shared, since that would create a circular dependency.
What’s the best way to structure this? Would creating a separate DI/core module be the right approach?
Something like this
app
└── depends on di
di
├── depends on shared
├── depends on featureA
└── depends on featureB
featureA
└── depends on shared
featureB
└── depends on sharedDmitry Stakhov
05/15/2026, 5:16 AMMohamed Darwish
05/15/2026, 4:25 PMshared you mean the usual umbrella module of KMP, you need to review your current structure
The code these modules depend on should be extracted to a new module in the bottom of the hierarchy e.g., :data or :core module.
If the code depends on something like Android context, you can use DI to provide them.
As a last resort, you can use interfaces in the new module and implement them in shared, yet it is usually not needed.
For DI module, each Gradle module should provide its part of the graph (e.g. Koin Module), then compose them in the shared module. No need for a separate one