Kotlin Project Structure
A scalable and maintainable folder structure for Kotlin applications
File Structure
- app
- src
- main
- java
- com
- example
- myapp
- MyApplication.kt
- MainActivity.kt
- di
- AppModule.kt
- NetworkModule.kt
- features
- home
- presentation
- domain
- data
- profile
- presentation
- domain
- data
- core
- network
- database
- utils
- res
- layout
- values
- drawable
- navigation
- AndroidManifest.xml
- test
- java
- androidTest
- java
- build.gradle.kts
- proguard-rules.pro
- buildSrc
- Dependencies.kt
- Versions.kt
- build.gradle.kts
- settings.gradle.kts
- gradle.properties
- README.md
Directory Structure Explanation
di/
Dependency injection modules using Dagger/Hilt for managing dependencies.
features/
Feature-based organization following Clean Architecture principles.
features/home/presentation/
Presentation layer containing UI components, view models, and composables.
features/home/domain/
Domain layer containing use cases, entities, and repository interfaces.
features/home/data/
Data layer containing repository implementations and data sources.
core/
Core infrastructure shared across features including network and database.
core/network/
Network layer implementation with API clients and interceptors.
buildSrc/
Gradle build logic and dependency management using Kotlin DSL.
Dependencies.kt
Centralized dependency management for consistent versions across modules.