┌─────────────────────────────────────────────────────────────────────────┐
│ FEATURE MODULES (feature/*) │
│ ┌─────────────────────────────────────────────────────────────────┐ │
│ │ Presentation Layer │ │
│ │ ┌──────────────┐ ┌─────────────────────────┐ │ │
│ │ │ Screen │◄───│ ViewModel │ │ │
│ │ │ (Compose) │ │ (StateFlow<UiState>) │ │ │
│ │ └──────────────┘ └───────────┬─────────────┘ │ │
│ │ │ │ │
│ └───────────────────────────────────┼─────────────────────────────┘ │
│ │ Dependencies │
├───────────────────────────────────────┼──────────────────────────────────┤
│ CORE/DOMAIN Module │ │
│ ┌────────────────────────────────────▼──────────────────────┐ │
│ │ Domain Layer │ │
│ │ ┌────────────────────────────────────────────────────┐ │ │
│ │ │ Use Cases │ │ │
│ │ │ (combine/transform logic) │ │ │
│ │ └───────────────────────┬────────────────────────────┘ │ │
│ │ ┌───────────────────────▼────────────────────────────┐ │ │
│ │ │ Repository Interfaces │ │ │
│ │ │ (contracts for data layer) │ │ │
│ │ └───────────────────────┬────────────────────────────┘ │ │
│ │ ┌───────────────────────▼────────────────────────────┐ │ │
│ │ │ Domain Models │ │ │
│ │ │ (business entities) │ │ │
│ │ └────────────────────────────────────────────────────┘ │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ Dependencies │
├───────────────────────────────────────┼──────────────────────────────────┤
│ CORE/DATA Module │ │
│ ┌────────────────────────────────────▼──────────────────────┐ │
│ │ Data Layer │ │
│ │ ┌────────────────────────────────────────────────────┐ │ │
│ │ │ Repository Implementations │ │ │
│ │ │ (offline-first, single source of truth) │ │ │
│ │ └─────────┬─────────────────────┬────────────────────┘ │ │
│ │ │ │ │ │
│ │ ┌─────────▼─────────┐ ┌───────▼──────────────┐ │ │
│ │ │ Local DataSource │ │ Remote DataSource │ │ │
│ │ │ (Room + DAO) │ │ (Retrofit) │ │ │
│ │ └─────────┬─────────┘ └──────────────────────┘ │ │
│ │ │ │ │
│ │ ┌─────────▼──────────────────────────────────────┐ │ │
│ │ │ Data Models │ │ │
│ │ │ (Entity, DTO, Response objects) │ │ │
│ │ └────────────────────────────────────────────────┘ │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
├───────────────────────────────────────────────────────────────────────┤
│ CORE/UI Module (shared UI resources) │
│ ┌─────────────────────────────────────────────────────────────────┐ │
│ │ UI Layer │ │
│ │ ┌─────────────────────────────────────────────────────────┐ │ │
│ │ │ Shared UI Components │ │ │
│ │ │ (Buttons, Cards, Dialogs, etc.) │ │ │
│ │ └─────────────────────────────────────────────────────────┘ │ │
│ │ ┌─────────────────────────────────────────────────────────┐ │ │
│ │ │ Themes & Design System │ │ │
│ │ │ (Colors, Typography, Shapes) │ │ │
│ │ └─────────────────────────────────────────────────────────┘ │ │
│ │ ┌─────────────────────────────────────────────────────────┐ │ │
│ │ │ Base ViewModels / State Management │ │ │
│ │ │ (BaseViewModel, UiState, etc.) │ │ │
│ │ └─────────────────────────────────────────────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────┘ │
└───────────────────────────────────────────────────────────────────────┘
feature/* → core/domain → core/data → core/ui
↑ ↑
(interface) (implementation)
Module Dependencies Flow:
Why?
Key Changes in Multi-Module Architecture:
Feature Modules (
feature/*)feature-home,feature-auth,feature-settings)core/domainfor business logiccore/uifor shared UI componentsCore/Domain Module (
:core:domain)core/datamust implementCore/Data Module (
:core:data)core/domainCore/UI Module (
:core:ui)