Skip to content

From Compile Safety to Configuration Safety: Let's Build the Koin IDE Plugin

The Koin IDE Plugin

Our Koin community has been clear: compile safety is crucial. This year, over 100 Koin users highlighted the need for more robust dependency management.

We're responding to you, with an even more targeted solution- Configuration Safety.

Configuration safety means catching dependency issues before compilation, directly in your integrated development environment (IDE)

Compile Safety vs. Configuration Safety

Unlike traditional compile safety, which happens during the compilation process, our approach analyzes Koin configurations in real-time as you write your code.

The Koin IDE Plugin will perform static code analysis, identifying issues like circular references or missing declarations early—before they become runtime errors. This proactive approach will streamline your workflow by preventing configuration problems at their source, rather than waiting for them to surface during compilation or build-time.

By integrating immediately into your development workflow, we're not just checking code—we're preventing configuration errors at their source.

This approach offers additional value compared to other DI frameworks like Dagger2/Hilt, by eliminating the need to wait for compilation or build time.

📈 The Technical Advantage 

✅ Immediate configuration analysis

✅ Errors detected in real-time, before compilation

✅ Instant visual feedback in your IDE

✅ Zero runtime surprises

 

Background

Dependency injection is a core part of modern Android development, helping us build more modular, testable, and maintainable applications. Koin is a popular choice for DI in the Kotlin ecosystem, providing a lightweight and flexible solution.

One of the key advantages of Koin is its declarative approach to dependency configuration. Instead of relying on complex annotations or XML configurations, Koin allows you to define your dependencies using a simple and concise domain-specific language (DSL). This promotes clean, readable code and reduces boilerplate, making it easier to manage and maintain your application's dependency graph.

 

Empowering Kotlin Developers with Compile Safety

While Koin's declarative DSL is a powerful feature, the framework also provides an annotation-based API that allows you to use the Kotlin Compiler to perform compile-time checks on your Koin configurations. This is achieved through the Koin Compiler Plugin and KSP, which provide options to:

  1. Check Koin Configuration at Compile Time: Add the KOIN_CONFIG_CHECK option to your Gradle setup, and the compiler will verify that all dependencies used in your configuration are declared and that all modules are accessible.
    Screenshot 2024-11-18 at 16.06.45
  2. Bypass Compile Safety with @Provided: If you have certain components that are provided externally (ie, a module declared with the DSL), you can use the @Provided annotation to exclude them from the compile-time checks.
    Screenshot 2024-11-18 at 16.07.29
  3. Use the verify() extension function on your Koin module to verify your Koin configuration. This checks that all constructor classes have a corresponding Koin component defined. If any issues are found, verify() will throw a MissingKoinDefinitionException:
    Screenshot 2024-11-18 at 16.10.06

These compile safety features have been available to Koin users since the release of Koin Annotations 1.3.0, but they do require manual setup and configuration.

Now, having listened to your feedback, we want to make this level of type-safety accessible to all Kotlin developers using Koin for DI, directly within the IDE.

Enter the Koin IDE Plugin

We're excited to announce the upcoming release of the Koin IDE Plugin. This new tool will integrate directly with Android Studio and IntelliJ IDEA, providing enhanced visibility and navigation of Koin configurations, as well as the powerful configuration checks.

The Koin IDE Plugin will be part of the broader Kotzilla Platform, which also includes the Kotzilla SDK and the Kotzilla Console.

 

Initial Feature Set

In our initial release (Q1 2025), the Koin IDE Plugin will focus on two key areas:

  1. Configuration Tree View: You'll be able to visualize your entire Koin setup, including modules, components, and dependencies, all within the IDE, making it easier to understand relationships between different parts of your configuration. This view will also include an initial validation check to ensure no configurations are missing, representing the first step toward configuration safety.
  2. Contextual Navigation: Moving between a component and its configuration will be seamless, with the plugin providing direct links. No more manually searching through your codebase to find where a particular dependency is declared.

These features aim to address common issues faced by Koin users, like struggling to grasp the big picture of their DI setup or having to switch between different files to trace configuration details


The Koin IDE Plugin's Superpower: Configuration Safety

So, as we said at the start, the ultimate goal is to bring the power of Koin's configuration safety checks directly into the IDE experience. We'll achieve this by integrating our tool seamlessly, where you can easily activate the desired level of safety checks without any extra effort. The plugin handles everything behind the scenes, ensuring a frictionless developer workflow.

It will help you catch problems early in the development cycle, as we’ll analyse your code directly saving time and frustration.

  • Real-time Safety Checks: The plugin will proactively detect Koin configuration issues directly in the IDE. 
  • CI/CD Integration: You can choose when to execute compile safety tasks within the CI/CD pipeline, thanks to a dedicated Gradle task that launches a compilation safety check.

This functionality is targeted to be available in the second release of the Koin IDE Plugin, scheduled for Q2 2025, making this level of type-safety accessible to all Koin developers, directly within their everyday IDE workflows.

 Join In : Help Us Build The Koin IDE Plugin

As always, we can't build this without you, so please join our beta testing program. Your feedback will directly influence the plugin's development roadmap and ensure we're building something truly valuable to you and for the Koin community.