Kotlin Architecture
Good Kotlin architecture keeps business rules separate from UI and transport details. Use the language features to improve readability, not to hide complexity.
Common use cases
- Android application layers.
- Backend services on Spring Boot or Ktor.
- Shared logic in multiplatform codebases.
Layered layout
src/
main/
kotlin/
app/
domain/
data/
ui/
config/
Feature layout
For larger applications, group code by feature when the product grows around business areas rather than around technical layers.
Design rules
- Keep data models and business rules separate from presentation.
- Use interfaces for boundaries and testing seams.
- Keep coroutines and I/O at the edges.
Practice
- Sketch a layered Kotlin project with one domain module and one adapter.
- Choose one feature that should become its own module.
- Write one note about why Kotlin’s expressiveness should not replace clear boundaries.