Deciding on a mono repository or a shared library
In this section, we're going to reason about the pros and cons of the following two repository setups:
- Mono Repository: This is where the shared code is just a module/submodule. This is the choice of most KMM/KMP example projects.
- Multiple Repositories: This is where the shared code is like a library that's consumed by the different platforms; that is, Android and iOS. Most production apps will likely see this option as more attractive.
Let's start by looking at mono repositories.
Mono repository
In a mono repository structure, your shared code, the Android app, and the iOS app are all contained in the same repository, as shown in the following diagram:
Some of the KMP examples out there, such as the ones where code is shared not just between the different frontend applications but in a server-client/backend-frontend mode, could inspire...