kmp-platform-sdk
0.0.1indexedModular client SDK: unified networking, encrypted settings, security policies and MFA, multi-method identity and session management, WebSocket lifecycles, pluggable error parsers, composable UI and navigation.
Modular client SDK: unified networking, encrypted settings, security policies and MFA, multi-method identity and session management, WebSocket lifecycles, pluggable error parsers, composable UI and navigation.
A modular Kotlin Multiplatform (KMP) client SDK for Android and Web (Wasm). It provides a unified foundation for building multiplatform applications with shared logic for networking, encrypted storage, security policies, and identity management. By bundling Compose Multiplatform UI and Decompose navigation, it allows host apps to integrate complex auth flows and system settings with minimal boilerplate.
Add the BOM and the required modules to your commonMain dependencies:
kotlin {
sourceSets {
commonMain.dependencies {
implementation(platform("io.github.mudrichenkoevgeny:kmp-platform-sdk-bom:<version>"))
implementation("io.github.mudrichenkoevgeny:kmp-platform-sdk-core")
implementation("io.github.mudrichenkoevgeny:kmp-platform-sdk-feature-clientuser")
// Add other kmp-platform-sdk modules as required
}
}
}
With a Version Catalog (gradle/libs.versions.toml), declare the BOM and module aliases, then use implementation(platform(libs.kmp.platform.sdk.bom)) and implementation(libs.kmp.platform.sdk.core).
Published artifacts (versions aligned via the BOM):
Visual design decisions across the SDK are driven by design tokens:
Initialize the EncryptedSettingsComponent and the root CommonComponent using platform-specific context.
val encryptedSettingsComponent = EncryptedSettingsComponent(platformContext)
val commonComponent = CommonComponent(
encryptedSettings = encryptedSettingsComponent.encryptedSettings,
clientDeviceInfo = clientDeviceInfo,
baseUrl = "https://api.example.com",
accessTokenProvider = authStorage,
appScope = appScope,
platformContext = platformContext
)
Construct domain components by sharing the core HttpClient and WebSocketService.
val securityComponent = SecurityComponent(
webSocketService = commonComponent.webSocketService,
httpClient = commonComponent.httpClient,
encryptedSettings = commonComponent.encryptedSettings,
parentScope = appScope
)
val settingsComponent = SettingsComponent(
webSocketService = commonComponent.webSocketService,
httpClient = commonComponent.httpClient,
encryptedSettings = commonComponent.encryptedSettings,
parentScope = appScope
)
Wire the ClientUserComponent with its core collaborators and platform-specific authentication services.
val clientUserComponent = ClientUserComponent(
commonComponent = commonComponent,
settingsComponent = settingsComponent,
securityComponent = securityComponent,
authStorage = encryptedAuthStorage,
authServices = platformAuthServices,
parentScope = appScope
)
Register auth interceptors, domain error parsers, and WebSocket message handlers during the application startup sequence.
fun init() {
commonComponent.httpClientConfigPlugins.add(clientUserComponent.authHttpClientConfigPlugin)
commonComponent.init(
appErrorParserSpecificParsers = listOf(
SecurityErrorParser,
UserErrorParser
)
)
commonComponent.webSocketService.updateWebSocketMessageHandlers(
listOf(
commonComponent.commonWebSocketMessageHandler,
settingsComponent.settingsWebSocketMessageHandler,
securityComponent.securityWebSocketMessageHandler,
clientUserComponent.userWebSocketMessageHandler
)
)
}
Inject the SDK graph into your Compose Multiplatform tree using CompositionLocalProvider.
@Composable
fun App(clientAppComponent: ClientAppComponent) {
val isInitialized by clientAppComponent.isInitialized.collectAsState()
if (isInitialized) {
CompositionLocalProvider(
LocalCommonComponent provides clientAppComponent.commonComponent,
LocalErrorParser provides clientAppComponent.commonComponent.appErrorParser,
LocalClientAppComponent provides clientAppComponent
) {
// Embed feature UI or launch LoginRootComponent navigation
}
} else {
SplashScreen()
}
}
For full wiring examples, refer to the sampleclient and samplemanagement reference applications.
This project is licensed under the Apache License 2.0 — see the LICENSE file for details.
EncryptedSettings abstraction, global settings, password policy & MFA, file storage infrastructure, error modeling, listing/pagination, and deep link navigation contracts (module README).AuthStorage), session auto-refresh, TOTP 2FA, session management, identifier linking, and account deletion (module README).AppTypeUserRoleUserAccountStatusUserSession*Paramsshared-foundation and are generated/extracted automatically at build time via the shared-foundation-design-system Gradle plugin.PlatformDesignTokens.kt) are placed automatically into build/generated/sources/designTokens/... during build.pt_sans_*.ttf) and vector drawables are extracted directly into Compose Multiplatform resources during build per module's iconModules configuration.CoreTheme maps colors (Color.kt), dimensions (CoreDimens.kt), shapes (Shapes.kt), and typography (Typography.kt) directly from generated PlatformDesignTokens.Typography.kt loads custom fonts via Compose Multiplatform resources (Res.font.*), and components consume extracted icons via Compose resources (Res.drawable.*).Surfaced from shared tags and platforms — no rankings paid for.