shared-foundation
0.0.38indexedShared business logic and API contracts for backend and client applications, enabling code reuse, consistent data models, and centralized domain rules across service boundaries.
Shared business logic and API contracts for backend and client applications, enabling code reuse, consistent data models, and centralized domain rules across service boundaries.
A shared contracts library providing REST/WS API contracts, JSON DTOs, Zod schemas, WebSocket envelopes, error codes, permissions, and domain models for Backend (JVM), Web (TypeScript/NPM), Mobile, and Desktop applications.
iosArm64, iosSimulatorArm64)Use the BOM and add only the modules you need:
// build.gradle.kts
dependencies {
implementation(platform("io.github.mudrichenkoevgeny:shared-foundation-bom:<version>"))
implementation("io.github.mudrichenkoevgeny:shared-foundation-core")
implementation("io.github.mudrichenkoevgeny:shared-foundation-feature-user")
// For unit, integration, and UI preview tests:
testImplementation("io.github.mudrichenkoevgeny:shared-foundation-testing")
// For enforcing shared architectural Detekt lint rules (NoFullyQualifiedName, NoInlineComment, PreferValueOverName, ProhibitNonSafeAssertion, ProhibitPrintln):
detektPlugins("io.github.mudrichenkoevgeny:shared-foundation-detekt-rules")
}
With a version catalog: declare BOM and module aliases in gradle/libs.versions.toml, then use implementation(platform(libs.shared.foundation.bom)) and testImplementation(libs.shared.foundation.fixtures).
Consumer projects (backend-platform-sdk, kmp-platform-sdk) can also apply shared convention plugins to automatically configure Ktlint, Detekt with custom rules, compiler options, publishing, and agent rules synchronization:
// build.gradle.kts (Consumer Projects)
plugins {
id("io.github.mudrichenkoevgeny.shared-foundation-agent-sync") version "<version>"
id("io.github.mudrichenkoevgeny.shared-foundation-quality") version "<version>"
id("io.github.mudrichenkoevgeny.shared-foundation-kotlin") version "<version>"
id("io.github.mudrichenkoevgeny.shared-foundation-publish") version "<version>"
id("io.github.mudrichenkoevgeny.shared-foundation-localization") version "<version>"
}
For TypeScript and React applications, install the generated Zod schemas, routes, branded types, and test fixtures from npm:
pnpm add @mudrichenkoevgeny/shared-foundation
Scaffold a new, production-ready downstream Kotlin Multiplatform contracts repository on disk:
./gradlew initProject -Pname=sample -Pgroup=com.sample -PnpmScope=@sample
This creates sample-shared configured with shared-foundation Gradle convention plugins, version catalog, BOM, core, testing, tools/npm-generator-runner, and agent rules.
Published artifacts (versions aligned via the BOM):
The library provides ready-to-use test data builders (createTest*), deterministic constants, value class factories, screen parameter fixtures, and in-memory mocks.
You can include :testing in your testImplementation / commonTest.dependencies (or import from @mudrichenkoevgeny/shared-foundation in npm) to use these pre-built fixtures in unit and integration tests instead of writing custom mocks.
For JVM test suites (jvmTest), the module also provides FoundationArchitectureAssertions — a reusable Konsist-based validation object that downstream repositories can call to enforce architectural rules (e.g. strict DTO boundaries, API route KDoc structures, and snake_case JSON localization keys).
Note on Gradle Version Catalog (
libs.versions.toml): When defining an alias for the testing module, it is recommended to use the suffix-fixtures(e.g.shared-foundation-fixtures = { ... name = "shared-foundation-testing" }) instead of-testingto prevent naming conflicts with the built-in GradleProject.testingextension in JVM modules. See the for details.
Check out these projects to see the library in action:
@mudrichenkoevgeny/shared-foundation for Zod schema validation, API routes, and security policies.This project is licensed under the Apache License 2.0 — see the LICENSE file for details.
CommonNetworkRoutes, BaseSettingsNetworkRoutes), WebSocket envelopes, common DTOs, navigation contracts, root navigation, parameter parsers, core localization infrastructure, security policies, MFA, global settings, S3 presigned storage contracts, entity projections, and audit events (module README).UserModuleStrings) (module README).createTest*), screen parameter fixtures, deterministic constants, value class factories, and in-memory mocks for unit, integration, and UI preview tests (module README).DesignTokensParser, ComposeTokensGenerator, WebTokensGenerator, PenpotTokensGenerator, DesignTokensFontExtractor, DesignSystemIconExtractor) supporting multi-target generation for Jetpack Compose, Web (CSS/TS), and Penpot (module README).NoFullyQualifiedName, NoInlineComment, PreferValueOverName, ProhibitNonSafeAssertion, ProhibitPrintln) for enforcing shared library architectural standards across consumer applications (module README).shared-foundation-agent-sync, shared-foundation-quality, shared-foundation-kotlin, shared-foundation-publish, shared-foundation-localization, shared-foundation-design-system) for auto-configuring quality checks, compiler options, publishing, localization generation, design token generation, and agent rule synchronization across consumer applications (module README).@mudrichenkoevgeny/shared-foundation (module README)../gradlew initProject for scaffolding clean downstream contract repositories (<name>-shared) on disk (module README).Open vs Management), WebSocket wire contract, error handling taxonomy, navigation, and localization architecture../gradlew projectHealth), and Maven Central publishing guidelines.LocalizedStringResolver, LocalizationFormatter), and platform integration examples.FoundationArchitectureAssertions).@mudrichenkoevgeny/code-review) for code review packing and prompt management.agent-sync, quality, publish, localization, design-system) and Detekt quality checks.Surfaced from shared tags and platforms — no rankings paid for.