# Let Koin Shape your Application Architecture

DevFeed: [Let Koin Shape your Application Architecture](<https://devfeed.tech/articles/let-koin-shape-your-application-architecture-22974.md>)

Original publisher: [Read original article](<https://blog.insert-koin.io/let-koin-shape-your-application-architecture-9cd60b1e02b0?source=rss----925561f2ecdf---4>)

Author: Gabriel Bronzatti Moro

Published: 2026-07-06T12:01:01Z

Content type: article

Language: en

Sources: [Koin developers](<https://devfeed.tech/sources/koin-developers-medium.md>)

Topics: [koin](<https://devfeed.tech/topics/koin.md>), [Dependency injection](<https://devfeed.tech/topics/dependency-injection.md>), [software-architecture](<https://devfeed.tech/topics/software-architecture.md>), [architecture-components](<https://devfeed.tech/topics/architecture-components.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [scalable-architecture](<https://devfeed.tech/topics/scalable-architecture.md>)

Tags: [application](<https://devfeed.tech/tags/application.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [best-practices](<https://devfeed.tech/tags/best-practices.md>), [clean-architecture](<https://devfeed.tech/tags/clean-architecture.md>), [data](<https://devfeed.tech/tags/data.md>), [define](<https://devfeed.tech/tags/define.md>), [domain](<https://devfeed.tech/tags/domain.md>), [dsl](<https://devfeed.tech/tags/dsl.md>), [koin](<https://devfeed.tech/tags/koin.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [ktor](<https://devfeed.tech/tags/ktor.md>), [manage](<https://devfeed.tech/tags/manage.md>), [pattern](<https://devfeed.tech/tags/pattern.md>), [presentation](<https://devfeed.tech/tags/presentation.md>), [protocol](<https://devfeed.tech/tags/protocol.md>), [repositories](<https://devfeed.tech/tags/repositories.md>), [software-architecture](<https://devfeed.tech/tags/software-architecture.md>), [use-cases](<https://devfeed.tech/tags/use-cases.md>)

## AI overview

The excerpt presents Koin as the mechanism for defining how application objects are created and managed. Use `@Single` or `single { ... }` for shared instances such as a Ktor `HttpClient`; use `factory` when each request should get a fresh object, illustrated by stateless use cases parameterized with the selected movie ID. Define ViewModels with `viewModel` and inject them with `koinViewModel()`: unlike ordinary factories, their retention follows screen and navigation lifecycle, so they may remain while a screen is on the back stack and survive configuration changes. The guidance is to choose a component's lifetime based on its architectural role; custom scopes are only referenced as a topic covered elsewhere.

## Source excerpt

Hey, friends! 👋 Today we're going to explore application architecture and how Koin can help us build scalable, maintainable applications by applying the principles of Clean Architecture and other software design best practices. Application architecture is a fundamental skill for every software engineer. A well-designed architecture makes applications easier to understand, test, extend, and maintain as they grow over time. A collection of LEGO towers in various stages of construction -- Unsplash by richard_heFoundation When we think about software architecture, we often picture layered diagrams -- data, domain, and presentation -- along with classes such as use cases, handlers, repositories, and helpers. But how do all these components work together? How do we establish a reliable communication protocol between them? Architecture is more than just organizing classes into packages. It's about defining how objects communicate and collaborate working toward a common goal. With that in mind, let's begin our journey with a simple principle: Every object instance should be created by Koin. My only responsibility as a developer is to describe how each object should be instantiated, while Koin takes care of the creation process.SingletonSingleton Café generated by ChatGPT Koin makes it easy to define singletons, whether you're using the @Single annotation or the single { ... } DSL. By declaring a singleton, you're telling Koin to create and manage a single instance of that object for the lifetime of the application. In the example below, we define an HttpClient as a singleton: @Module class NetworkModule { @Single fun provideHttpClient(): HttpClient { return HttpClientBuilder.build( baseUrl = BuildKonfig.HOST, ) } ... } HttpClient is a class provided by Ktor, and it should typically be instantiated only once. By declaring it as a singleton, Koin ensures that the same HttpClient instance is shared throughout the application. The Singleton pattern is commonly used for objects tha