The project
settings.gradle.kts includes every module:
Pick the primary server
Both:api and :admin are Ktor servers at the same depth. Without a setting, :admin would get the bare host, because it comes first in alphabetical order. Put :api there instead, in gradle.properties:
Tell the web app where the API is
The web app is static: it learns the API URL when it is built. Set a build-only variable:composeApp/build.gradle.kts and turn it into a constant, for example with a small generated source:
Deploy
PARTIAL.
Previews with their own API
When you link the repository, every pull request gets a preview with its own hosts. Point the preview web app at a preview-safe API by settingAPI_URL for the preview environment:
Add your domains
API_URL to the new API domain and deploy again. See Custom domains.