Clean Architecture is primarily a dependency rule: policy should not depend on framework details. A feature-first structure keeps related code close while preserving presentation, domain and data boundaries where they add value.
Practical guidance
- Start with feature packages instead of global folders full of unrelated ViewModels.
- Keep domain models independent from Retrofit and Room annotations when that independence is valuable.
- Place interfaces near the consumer that owns the abstraction.
- Add use cases for reusable business decisions, not one-line forwarding.
Working example
feature/profile/
presentation/ProfileScreen.kt
presentation/ProfileViewModel.kt
domain/Profile.kt
domain/ProfileRepository.kt
data/DefaultProfileRepository.kt
data/local/ProfileEntity.kt
data/remote/ProfileDto.kt
Common mistakes
- Too many mapper and use-case classes slow simple features.
- Layer names do not enforce dependency direction.
- A shared module can become an unowned dumping ground.
Key takeaway
Use the fewest boundaries that protect change. Feature-first packaging plus enforced module dependencies scales better than ceremonial layers.
