Skip to content

muryno/CleanArchitecture_Modularization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MusicBrainz Android App

A comprehensive Android application built with Clean Architecture, Modularization, and Jetpack Compose. This app integrates with the MusicBrainz API to search for artists, albums (release groups), and events.

For more details on the architectural approach, see the Medium article: Practical Guide to Building Powerful and Easy-to-Maintain Android Apps with Clean Architecture, Modularization

Architecture

The app follows Clean Architecture principles with a modular structure:

┌─────────────────────────────────────────────────────────────┐
│                          app                                 │
│  (MainActivity, Navigation, Compose Screens, DI Modules)    │
└─────────────────────────────────────────────────────────────┘
                              │
        ┌─────────────────────┼─────────────────────┐
        ▼                     ▼                     ▼
┌───────────────┐   ┌───────────────┐   ┌───────────────┐
│ artist-ui     │   │ (future UI    │   │ (future UI    │
│ (Compose)     │   │  modules)     │   │  modules)     │
└───────────────┘   └───────────────┘   └───────────────┘
        │                     │                     │
        ▼                     ▼                     ▼
┌───────────────┐   ┌───────────────┐   ┌───────────────┐
│ presentation  │   │ presentation  │   │ presentation  │
│ (ViewModels)  │   │ (ViewModels)  │   │ (ViewModels)  │
└───────────────┘   └───────────────┘   └───────────────┘
        │                     │                     │
        ▼                     ▼                     ▼
┌───────────────┐   ┌───────────────┐   ┌───────────────┐
│    domain     │   │    domain     │   │    domain     │
│  (Use Cases)  │   │  (Use Cases)  │   │  (Use Cases)  │
└───────────────┘   └───────────────┘   └───────────────┘
        │                     │                     │
        ▼                     ▼                     ▼
┌───────────────┐   ┌───────────────┐   ┌───────────────┐
│     data      │   │     data      │   │     data      │
│ (Repository)  │   │ (Repository)  │   │ (Repository)  │
└───────────────┘   └───────────────┘   └───────────────┘
        │                     │                     │
        ▼                     ▼                     ▼
┌───────────────┐   ┌───────────────┐   ┌───────────────┐
│  datasource   │   │  datasource   │   │  datasource   │
│ (API/Remote)  │   │ (API/Remote)  │   │ (API/Remote)  │
└───────────────┘   └───────────────┘   └───────────────┘

Project Modules

Artist Feature

  • artist-domain - Domain models, repository interfaces, use cases
  • artist-data - Repository implementations, data mappers
  • artist-datasource - API service, remote data source, API models
  • artist-presentation - ViewModels, presentation models, view states
  • artist-ui - Compose UI components, screens

Event Feature (New)

  • event-domain - Event domain models and use cases
  • event-data - Event repository with in-memory caching
  • event-datasource - MusicBrainz Event API integration
  • event-presentation - Event ViewModel and presentation layer

Release Group (Albums) Feature

  • release-group-domain - Release group domain models
  • release-group-data - Release group repository
  • release-group-datasource - MusicBrainz Release Group API
  • release-group-presentation - Release group ViewModel

Other Modules

  • app - Main application, DI modules, Compose navigation, screens
  • release-* - Release feature modules
  • series-* - Series feature modules

Features

  • Bottom Navigation with three tabs:

    • Artists - Search and browse artists
    • Albums - Search and browse release groups/albums
    • Events - Search and browse music events
  • Jetpack Compose UI - Modern declarative UI

  • State Preservation - Scroll position preserved on tab switch and rotation

  • In-Memory Caching - Events cached at repository level (no database schema changes)

  • Clean Architecture - No DTO leakage from network to domain/UI layers

  • Dark/Light Mode supported

Tech Stack

  • UI: Jetpack Compose, Material 3
  • Architecture: MVVM + Clean Architecture
  • DI: Hilt
  • Networking: Retrofit, OkHttp, Gson
  • Async: Kotlin Coroutines
  • Navigation: Jetpack Navigation Compose

Build Requirements

Java Version

This project requires Java 17. Set your JAVA_HOME before building:

export JAVA_HOME=/path/to/jdk-17

Gradle Properties

The gradle.properties includes necessary JVM arguments for kapt compatibility with Java 17+:

org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 \
    --add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED \
    --add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
    ...

Building the Project

# Set Java 17
export JAVA_HOME=/path/to/jdk-17

# Clean and build
./gradlew clean assembleDebug

Screenshots

Bottom Navigation with Tabs

The app features a bottom navigation bar with Artists, Albums, and Events tabs.

Screenshot 2022-10-25 at 22 43 48

API

This app uses the MusicBrainz API:

  • Artists: GET /ws/2/artist?query={name}&fmt=json
  • Release Groups: GET /ws/2/release-group?query={name}&fmt=json
  • Events: GET /ws/2/event?query={name}&fmt=json

License

This project is for educational purposes demonstrating Clean Architecture patterns in Android development.