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:0.0.3"))
implementation("io.github.mudrichenkoevgeny:kmp-platform-sdk-core-common")
implementation("io.github.mudrichenkoevgeny:kmp-platform-sdk-core-settings")
implementation("io.github.mudrichenkoevgeny:kmp-platform-sdk-core-security")
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.common).
Published artifacts (versions aligned via the BOM):
AppType, , state machine, ), and detailed sequence diagrams for runtime flows (SDK bootstrap, token refresh, error parsing, WebSockets, TOTP/security, account management).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,
deviceInfo = deviceInfo,
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, platform metadata, error modeling, Chain of Responsibility error parser, and listing/pagination infrastructure (module README).AuthStorage), session auto-refresh, TOTP 2FA, session management, identifier linking, and account deletion (module README).UserRoleUserAccountStatusUserSessioncore/common/src/commonMain/kotlin/io/github/mudrichenkoevgeny/kmp/core/common/ui/theme/tokens/GeneratedDesignTokens.ktcore/common/src/commonMain/composeResources/font/ (copied from assets/fonts/ttf/*.ttf in platform-design-system).generated/compose/GeneratedDesignTokens.kt) and manually copied alongside font files to the SDK target paths above. Manual edits to GeneratedDesignTokens.kt are strictly forbidden.CoreTheme maps colors (Color.kt), dimensions (Dimens.kt), shapes (Shapes.kt), and typography (Typography.kt) directly from the GeneratedDesignTokens object.Typography.kt loads custom fonts via Compose Multiplatform resources (Res.font.*). The physical font files (.ttf / .otf) synced from the design system reside in core/common/src/commonMain/composeResources/font/.Surfaced from shared tags and platforms — no rankings paid for.