Architecting Modern Android Apps

Architecting Modern Android Apps

Scalability and maintainability are the primary goals of any serious software project. In the Android ecosystem, “Clean Architecture” combined with MVVM (Model-View-ViewModel) has become the gold standard.

I built github-browser-lab to serve as a reference implementation for these patterns.

The Layers

  1. Domain Layer: The pure Kotlin core. It contains Entities and Use Cases. It knows nothing about Android or the database.
  2. Data Layer: The implementation details. Repositories, Retrofit services, and Room databases live here. It maps raw data to Domain entities.
  3. Presentation Layer: The UI. Activities, Fragments (or Composables), and ViewModels. It observes the domain data and renders it.

Dependency Injection

To glue everything together without tight coupling, I rely heavily on Hilt.

@Module
@InstallIn(SingletonComponent::class)
object NetworkModule {
    @Provides
    fun provideGithubService(): GithubService { ... }
}

This separation of concerns allows me to swap out the database implementation or network client without touching the UI code, and makes unit testing the business logic effortless.