A Boilerplate Android project using Jetpack Compose, following Clean Architecture principles and the MVI (Model-View-Intent) pattern. Designed for scalability, maintainability, and testability.
- Language: Kotlin
- UI Framework: Jetpack Compose
- Dependency Injection: Hilt
- Networking: Retrofit & OkHttp
- Database: Room
- Concurrency: Coroutines & Flow
- JSON Parsing: Moshi
- Image Loading: Coil
- Navigation: Jetpack Navigation Compose
The project is divided into 3 main modules following Clean Architecture:
domain: Contains Business Logic, Entities, Repository Interfaces, and Use Cases. This module is pure Kotlin and has no Android dependencies.data: Implements Repository Interfaces from the Domain layer. Manages data sources like API (Remote) and Database (Local), along with Mappers to convert DTOs to Domain Models.app: Contains UI (Compose), ViewModels, and DI Modules. This is where the MVI pattern is implemented.
Each screen is built upon:
- UiState: The single source of truth for the UI state (Loading, Success, Error).
- UiIntent: Actions initiated by the user or system events.
- UiEffect: One-time side effects like Navigation or showing a Snackbar/Toast.
app/
├── base/ # Base classes: BaseViewModel, MviContract
├── di/ # Hilt Modules (App level)
├── navigation/ # Navigation configuration and Routes
├── ui/
│ ├── components/ # Reusable UI components
│ ├── home/ # Home Screen (MVI)
│ └── detail/ # Detail Screen (MVI)
data/
├── local/ # Room Database, DAOs, Entities
├── remote/ # Retrofit API, DTOs
├── repository/ # Repository implementation
└── di/ # Hilt Modules for Data layer
domain/
├── model/ # Domain Entities
├── repository/ # Repository Interfaces
└── usecase/ # Business Logic Use Cases
- Clone the project:
git clone https://github.com/lyhoangvinh/Compose-MVI-Clean-Architecture.git
- Open with Android Studio: (Ladybug version or newer recommended).
- Sync Gradle: Wait for the library download process to complete.
- Run the project: Click
Runto install on a virtual or physical device.
BaseViewModel: Manages State, Intent, and Effect in a unified way.BaseScreen: A wrapper for Compose screens to handle Side Effects and lifecycle.BaseUseCase: Base class for Use Cases to standardize data handling.
⭐ If you find this project useful, please give it a star!