kosi-libs/Kodein
61.5
Adequate · 14 November 2026
10.9k
lines of production code
Kotlin
primary language
5
measurements over time
What this system is
Features
Add Android-specific ViewModel retrieval for Jetpack Compose
The \framework/compose/kodein-di-framework-compose\ module now includes \rememberViewModel\ functions for Android, allowing Compose UI code to retrieve Android \ViewModel\ instances directly from the Kodein DI container. This enables seamless integration of Kodein-managed dependencies with the standard Android \ViewModel\ lifecycle within Jetpack Compose applications.
framework/compose/kodein-di-framework-compose/src/androidMain · high confidence
Add Compose Multiplatform ViewModel support with rememberViewModel
The Compose Multiplatform integration now includes support for AndroidX ViewModels via the new \rememberViewModel\ composable function. This feature allows developers to retrieve ViewModel instances directly from the Kodein DI container within Compose trees, supporting both singleton-scoped ViewModels and those requiring constructor arguments. The implementation introduces \KodeinViewModelScopedFactory\ and \KodeinViewModelScopedSingleton\ to bridge Kodein's dependency resolution with the \ViewModelProvider.Factory\ interface, while deprecating the previous \KodeinViewModelScopedFactory\ and \KodeinViewModelScopedSingleton\ functions in favor of this new API.
framework/compose/kodein-di-framework-compose/src/commonMain · high confidence
Add Ktor 2.x DI plugin integration
Introduces a new Ktor server plugin that allows installing a global Kodein DI container within a Ktor application. Users can now use the \di {}\ extension function on the \Application\ instance to configure dependency bindings, making the DI container accessible throughout the Ktor pipeline via \Application.attributes\.
kodein-di-framework-ktor-server-jvm · high confidence
Add ViewModel extension with SavedStateHandle support for AndroidX
The \kodein-di-framework-android-x-viewmodel-savedstate\ module now provides \viewModelWithSavedStateHandle()\ extension functions for \AppCompatActivity\ and \Fragment\. This allows developers to inject ViewModels that require a \SavedStateHandle\ argument directly from the Kodein DI container, enabling seamless integration of saved state management with dependency injection in Android components.
framework/android/kodein-di-framework-android-x-viewmodel-savedstate · high confidence
Add WeakContextScope and SubTypes binding support
The library now includes a WeakContextScope that uses weak references to allow scope registries to be garbage collected when their contexts are no longer in use, helping to prevent memory leaks. Additionally, a new SubTypes binding mechanism is introduced, enabling users to bind multiple implementations for a common base type using a set-based syntax (e.g., \bind\<Type\>().inSet() with binding\), which facilitates managing collections of related bindings.
kodein-di/src/jvmMain/kotlin/org/kodein/di/bindings · high confidence
Added DirectDI implementations for JS and Native targets
The library now provides concrete implementations of the DirectDI interface for JavaScript and Native platforms. This includes the DirectDI interface definitions, internal implementation classes (DirectDIImpl), factory functions (createDirectDI), and platform-specific collection utilities (concurrent maps and linked lists) for both the jsBasedMain and nativeMain source sets, enabling direct dependency injection capabilities on these targets.
kodein-di/src/jsBasedMain, kodein-di/src/nativeMain · high confidence
Introduction of KSP-based compile-time DI resolver and Ktor 2.0 plugin support
This release introduces a new KSP-based compile-time resolver (DIResolverGenerator) that generates type-safe, checkable DI resolver implementations to validate binding consistency at compile time. It also adds a new Ktor 2.0 server plugin (DIPlugin) that installs a global DI container accessible via Application.di, and updates the core DI framework to use kotlinx.atomicfu for synchronization, swap to the TypeToken from Kodein-Type for better multiplatform support, and deprecate ScopeCloseable in favor of Kotlin's standard AutoCloseable. Also in this area: Replaced synchronization with kotlinx-atomicfu and added delayed initialization support.
kodein-di/src/commonMain/kotlin/org/kodein/di/bindings, kodein-di/src/commonMain/kotlin/org/kodein/di/internal · high confidence
New Android DI API with closestDI and retained scopes
The Android core module introduces a new dependency injection API centered around the \closestDI()\ property delegate, which automatically resolves the nearest available DI container by walking up the Android context hierarchy (supporting Context, Activity, Fragment, View, Dialog, and other Android components). It also adds \retainedDI()\ for creating DI instances that survive activity configuration changes via a retained Fragment, and \subDI()\ / \retainedSubDI()\ for creating child DI containers. The module provides \androidCoreModule\ which binds numerous Android system services (like AudioManager, WifiManager, etc.) and context resources (assets, resources, shared preferences) as providers, along with \androidCoreContextTranslators\ to enable context-based resolution for Fragments, Views, and other Android types.
framework/android/kodein-di-framework-android-core · high confidence
New AndroidX Support module with lifecycle-aware scopes and closestDI helpers
The android-support framework module has been migrated to AndroidX, introducing new capabilities for dependency injection in Android components. It provides \closestDI()\ extension functions for Fragment, Loader, and AndroidViewModel to easily access the nearest dependency injection context. Additionally, it includes \androidSupportContextTranslators\ and \androidSupportModule\ to handle context translation for these components, and implements \AndroidLifecycleScope\ which automatically manages scope registries tied to LifecycleOwner destruction, ensuring resources are cleaned up when components are destroyed.
framework/android/kodein-di-framework-android-support, framework/android/kodein-di-framework-android-x · high confidence
New Compose DI integration APIs and CompositionLocal support
The Compose runtime module now provides a suite of new APIs for integrating Kodein DI with Jetpack Compose. Users can attach DI containers to the Composable tree using \withDI\ and create scoped child containers with \subDI\. Retrieval of dependencies is handled via \rememberDI\, \rememberInstance\, \rememberNamedInstance\, \rememberFactory\, and \rememberProvider\, which leverage a new \LocalDI\ CompositionLocal to access the current container. On Android, \androidContextDI\ allows accessing the DI container attached to the Android Context, while other platforms default to throwing an error if no container is provided.
framework/compose/kodein-di-framework-compose-runtime · high confidence
New ConfigurableDI and global DI configuration API
Introduces the \ConfigurableDI\ class in the \kodein-di-conf\ module, allowing users to build a DI container by adding configuration lambdas, imports, and extensions before the first dependency retrieval. It supports mutable reconfiguration via \clear()\ and chaining on configuration methods. Additionally, a \global\ singleton property is exposed on \DI.Companion\ for a single shared instance, along with a \DIGlobalAware\ interface to access it.
kodein-di-conf/src/commonMain · high confidence
New KSP-based DI resolver module for compile-time dependency validation
This change introduces a new KSP (Kotlin Symbol Processing) module that allows users to define DI resolver interfaces annotated with @Resolved. The processor generates code that creates type-safe accessors for dependencies and provides a check() method to validate that all required bindings exist in the DI container at compile time, reducing runtime errors. The module includes the DIResolver interface, @Resolved and @Tag annotations, the KSP processor implementation, and test cases demonstrating usage with nested resolver interfaces.
(repo-wide) · high confidence
New Ktor integration with request/session scoping and sub-containers
This release introduces the Ktor server integration module, providing \closestDI()\ extension functions on \Application\, \ApplicationCall\, \Routing\, and \Route\ to access the DI container. It adds \CallScope\ for request-scoped dependencies and \SessionScope\ (with \KodeinDISession\ interface) for session-scoped singletons, including a \clearSessionScope()\ helper. Additionally, \Route.subDI()\ allows creating sub-containers with optional silent overrides.
framework/ktor/kodein-di-framework-ktor-server-jvm/src/main · high confidence
New javax.inject compatibility module for Kodein DI
The \kodein-di-jxinject-jvm\ module introduces a new integration layer that allows Kodein DI to work with classes annotated using the standard \javax.inject.\*\ annotations (such as \@Inject\). This includes a \JxInjector\ class for performing field and method injection on existing objects, as well as a \jxInjectorModule\ that registers the necessary bindings. The module also provides custom annotations (\@ErasedBinding\, \@ProviderFun\, \@FactoryFun\, \@OrNull\) to handle specific injection scenarios and utility functions to easily retrieve the injector from a \DI\ or \DirectDI\ instance.
kodein-di-jxinject-jvm/src/main/kotlin/org/kodein/di/jxinject · high confidence
Plain ViewModel extensions for AppCompatActivity and Fragment
The \kodein-di-framework-android-x-viewmodel\ module now provides plain \viewModel()\ extension functions for \AppCompatActivity\ and \Fragment\ classes that implement \DIAware\. These extensions allow developers to access ViewModels directly via property delegation (e.g., \private val model: MyViewModel by viewModel()\) by resolving them from the Kodein DI container, supporting optional tags and custom owner producers for fragments.
framework/android/kodein-di-framework-android-x-viewmodel · high confidence
Project initialization with IDE configuration and documentation scaffolding
The repository has been initialized with standard project scaffolding, including an EditorConfig file to enforce consistent Kotlin code formatting (4-space indentation, 100-character line limit) across IDEs, and an AGENTS.md file documenting the core architecture, binding system, and framework integration patterns for the Kodein-DI dependency injection library. The README has been updated to reflect the current KODEIN SAS copyright, Kotlin Multiplatform support, and modern installation instructions, while the CHANGELOG.md has been created to track version history starting from 7.33.0. Additionally, the .gitignore has been expanded to include Kotlin-specific build artifacts and the Gradle wrapper scripts have been updated to the latest POSIX-compliant versions.
(repo-wide) · high confidence
Removals
Removal of legacy Kodein core implementation files
The core Kodein dependency injection implementation files (Kodein.kt, Scopes.kt, and lazy.kt) have been removed from the src/main directory. This deletion eliminates the previous implementation of the Kodein IoC container, including its Key-based binding mechanism, singleton/thread-singleton/instance scopes, and property delegation helpers (lazyInstance, injectInstance). Users relying on these specific legacy APIs for dependency injection will no longer have access to them in this location.
src/main · high confidence
Behavioural changes
JVM-specific dependency injection extensions and reference types
The JVM module now includes platform-specific implementations for retrieving all factories, providers, and instances via \DIAware\ and \DirectDI\, utilizing \TypeToken\ from the \kodein-type\ library for generic type resolution. Additionally, new \RefMaker\ objects (\threadLocal\, \softReference\, and \weakReference\) are provided to support thread-local, soft, and weak reference binding strategies for singletons and multitons, while \TypeBinderSubTypes\ gains a \with\ function to bind handlers for any subtype of a given type.
kodein-di/src/jvmMain/kotlin/org/kodein/di · high confidence
JVM-specific dependency injection implementation and collection utilities
The library now includes platform-specific implementations for the JVM target, introducing a new DirectDI implementation that leverages the TypeToken from Kodein-Type to resolve factories, providers, and instances. Additionally, JVM-specific collection utilities have been added to use Java's ConcurrentHashMap and LinkedList for internal data structures, ensuring optimal performance and compatibility on the JVM platform.
kodein-di/src/jvmMain/kotlin/org/kodein/di/internal · high confidence
Jetpack Compose ViewModel integration refactored for Android
The \kodein-di-framework-android-x-compose\ module has been restructured to focus exclusively on Android Jetpack Compose, introducing new \rememberViewModel\ and \rememberNavGraphViewModel\ composables that return \ViewModelLazy\ instances for better lifecycle management. The previous \viewModel\ and \navGraphViewModel\ functions are now deprecated in favor of these new APIs, and the underlying factory classes (\KodeinViewModelScopedFactory\ and \KodeinViewModelScopedSingleton\) have been updated to use generic types for improved type safety.
framework/compose/kodein-di-framework-android-x-compose · high confidence
Kodein DI core library restructured with new binding and retrieval APIs
The Kodein DI core module has been reorganized into a new package structure, introducing dedicated files for binding definitions (BindingsMap, DIBuilder), container management (DIContainer, DITree), and instance retrieval (DirectDI, Named, New, ParameterizedNew, Retrieving). This change introduces a new \DirectDI\ interface for non-delegate-based injection, adds a \Named\ extension for property-name-based tagging, and provides new \new()\ overloads for constructor-based dependency resolution with parameterized arguments. The internal binding tree and map structures have been refactored to support these new retrieval patterns and improved debugging capabilities.
kodein-di/src/commonMain/kotlin/org/kodein/di · high confidence
New DIController API for Ktor routing installation
The Ktor server controller module introduces a new \DIController\ interface and \AbstractDIController\ base class, replacing the previous \KodeinControllerFeature\ approach. This change allows developers to define controllers that implement \getRoutes()\ and install them directly into Ktor's \Routing\ or specific \Route\ instances using new extension functions (\Route.controller\). This provides a more flexible, MVC-like architecture where controllers can be installed into existing routing structures rather than requiring a dedicated feature installation.
framework/ktor/kodein-di-framework-ktor-server-controller-jvm/src/main · high confidence
TornadoFX integration deprecated and API renamed to DI
The TornadoFX framework integration is now deprecated with a recommendation to migrate to Compose. The public API has been renamed from \\Kodein\\ to \\DI\\ (e.g., \kodeinDI\ to \kodeinDI\ but conceptually part of the new \DI\ naming scheme, and \closestKodein\ aliases updated), and all extension functions for \Component\, \Node\, and \DI.MainBuilder\ are marked as deprecated. This includes changes to how the DI container is retrieved and installed, such as the new \closestKodeinDI\ alias and \installTornadoSource\ method, while maintaining backward compatibility through deprecation warnings.
framework/tornadofx/kodein-di-framework-tornadofx-jvm/src/main · high confidence
Fixes
Improved stability of JSR-330 injection on Android
The JSR-330 injection mechanism now gracefully handles missing runtime types during class introspection. Previously, if a class referenced a type absent on the device (common on Android with SDK version mismatches), the injection process would fail with a \NoClassDefFoundError\. The updated code catches these linkage errors, logs a warning, and continues processing, ensuring that applications remain stable even when some injected members cannot be resolved due to missing platform classes.
kodein-di-jxinject-jvm/src/main/kotlin/org/kodein/di/jxinject/internal · high confidence
Test coverage
Added JVM injection tests for JSR-330 compatibility and reflection resilience; Added JVM-specific tests for ConfigurableDI generic overrides and external sources; Added comprehensive test coverage for the new direct binding API; Added disabled Compose Multiplatform integration tests; Added integration tests for Ktor server DI features; Added integration tests for TornadoFX Kodein DI framework; Added test helper for AutoCloseable validation; Added test utilities for multiplatform testing; Added tests for ConfigurableDI configuration and lifecycle; JVM-specific dependency injection tests for erased and generic type handling; Removal of legacy Kotlin test suite.
Dependencies
Gradle wrapper upgraded to version 9.3.1
The Gradle wrapper has been updated from version 2.2 to 9.3.1. This upgrade brings the build system to a significantly newer version of Gradle, which may affect build performance, plugin compatibility, and build script syntax. Users should ensure their local Gradle installations and CI/CD pipelines are compatible with Gradle 9.3.1 or rely on the wrapper to manage the version automatically.
gradle · high confidence
Migrate build system to Gradle Kotlin DSL and Kosi-libs infrastructure
The project has replaced the legacy Groovy-based build scripts (build.gradle, settings.gradle) with a modern Gradle Kotlin DSL configuration. This migration introduces the Kosi-libs internal Gradle plugin (v9.2.0) to manage multiplatform targets, namespaces, and publishing. The build now utilizes a version catalog (libs.versions.toml) to define dependencies, including KSP 2.3.10, Ktor 3.5.1, Compose Multiplatform 1.11.1, and AndroidX libraries. Additionally, the root project version is set to 7.33.0, and the module structure is reorganized to include core DI, Android frameworks, Ktor integration, and Compose extensions.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 60 → 61 (+1.9)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 98 → 97 (-1.4)
- Architecture 99 → 96 (-2.5)
- Maturity 52 → 52 (+0.0)
- Readiness 50 → 52 (+1.8)
- Security 71 → 81 (+10.4)
Resolved (389)
- Duplicated block (11 lines × 2) (framework/compose/kodein-di-framework-compose/src/androidMain/kotlin/org/kodein/di/compose/viewModel.kt)
- Duplicated block (14–15 lines × 2) (framework/compose/kodein-di-framework-android-x-compose/src/main/kotlin/org/kodein/di/compose/android/viewModel.kt)
- Duplicated block (3–5 lines × 3) (kodein-di/src/commonMain/kotlin/org/kodein/di/internal/DIContainerImpl.kt)
- Duplicated block (5 lines × 2) (framework/android/kodein-di-framework-android-x-viewmodel-savedstate/src/main/java/org/kodein/di/android/x/viewmodel/savedstate/DIAware.kt)
- High CVE: [GHSA redacted] (kotlin-js-store/yarn.lock)
- High CVE: [GHSA redacted] (kotlin-js-store/yarn.lock)
- High CVE: [GHSA redacted] (kotlin-js-store/yarn.lock)
- Off-boarding risk: anonymized user #1
- Outdated (compile): com.fasterxml.jackson.core:jackson-annotations
- Outdated (compile): com.fasterxml.jackson.core:jackson-core
- Outdated (compile): com.fasterxml.jackson.core:jackson-databind
- Outdated (compile): com.fasterxml.jackson.dataformat:jackson-dataformat-xml
- Outdated (compile): com.fasterxml.jackson.module:jackson-module-kotlin
- Outdated (compile): com.fasterxml.jackson:jackson-bom
- Outdated (compile): com.fasterxml.woodstox:woodstox-core
- Outdated (compile): com.github.ben-manes.caffeine:caffeine
- Outdated (compile): com.google.api.grpc:proto-google-common-protos
- Outdated (compile): com.google.auto:auto-common
- Outdated (compile): com.google.code.gson:gson
- Outdated (compile): com.google.crypto.tink:tink
- …and 369 more
New (34)
- Dependency hygiene PARTLY measured — Maven/Gradle declarations read, no dependency graph resolved
- Duplicated block (10 lines × 2) (kodein-di/src/commonMain/kotlin/org/kodein/di/internal/DIBuilderImpl.kt)
- Duplicated block (11 lines × 2) (framework/compose/kodein-di-framework-compose/src/androidMain/kotlin/org/kodein/di/compose/viewModel.kt)
- Duplicated block (14–15 lines × 2) (framework/compose/kodein-di-framework-android-x-compose/src/main/kotlin/org/kodein/di/compose/android/viewModel.kt)
- Duplicated block (3–5 lines × 3) (kodein-di/src/commonMain/kotlin/org/kodein/di/internal/DIContainerImpl.kt)
- Duplicated block (5 lines × 2) (framework/android/kodein-di-framework-android-x-viewmodel-savedstate/src/main/java/org/kodein/di/android/x/viewmodel/savedstate/DIAware.kt)
- Edited copies of one member (3 members, 1+ corresponding lines) (kodein-di/src/commonMain/kotlin/org/kodein/di/DIAware.kt)
- Edited copies of one member (3 members, 1+ corresponding lines) (kodein-di/src/commonMain/kotlin/org/kodein/di/DIAware.kt)
- Edited copies of one member (3 members, 13+ corresponding lines) (framework/compose/kodein-di-framework-android-x-compose/src/main/kotlin/org/kodein/di/compose/android/navigation/navGraphViewModel.kt)
- Edited copies of one member (4 members, 12+ corresponding lines) (framework/compose/kodein-di-framework-android-x-compose/src/main/kotlin/org/kodein/di/compose/android/viewModel.kt)
- Edited copies of one member (7 members, 6+ corresponding lines) (kodein-di/src/commonMain/kotlin/org/kodein/di/New.kt)
- Edited copy of a member (1 corresponding lines) (kodein-di/src/commonMain/kotlin/org/kodein/di/DIAware.kt)
- Edited copy of a member (1 corresponding lines) (kodein-di/src/commonMain/kotlin/org/kodein/di/DIAware.kt)
- Edited copy of a member (1 corresponding lines) (kodein-di/src/commonMain/kotlin/org/kodein/di/DIAware.kt)
- Edited copy of a member (1 corresponding lines) (kodein-di/src/commonMain/kotlin/org/kodein/di/DIAware.kt)
- Edited copy of a member (1 corresponding lines) (kodein-di/src/commonMain/kotlin/org/kodein/di/DIAware.kt)
- Edited copy of a member (1 corresponding lines) (kodein-di/src/commonMain/kotlin/org/kodein/di/DIAware.kt)
- Edited copy of a member (1 corresponding lines) (kodein-di/src/commonMain/kotlin/org/kodein/di/DIAware.kt)
- Edited copy of a member (1 corresponding lines) (kodein-di/src/commonMain/kotlin/org/kodein/di/DIAware.kt)
- Edited copy of a member (1 corresponding lines) (kodein-di/src/commonMain/kotlin/org/kodein/di/internal/DirectDIImpl.kt)
- …and 14 more
Changes since last survey
- 3 commits — 3 feature/other, 0 fixes
By area
- (root) — 2 commits
- (repo) — 1 commit
Notable commits
- change: Merge pull request #515 from kosi-libs/SalomonBrys-patch-1
- change: Update README to reflect Kodein DI maintenance mode
- change: Update README.md
Architecture
- Unchanged — 0 containers · 3 contexts · 1 edges
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
kosi-libs/Kodein was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 14 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 8ef0da2757a8cbfb4ac0a83af501d80854eb4b89 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-e1a3b69fc8ee.