How deiivid/clean_arquitecture_compose works
Main Architectural Layers
• Presentation Layer: This includes the UI components (Jetpack Compose screens, navigation elements, and view models located under the “ui” and “presentation” directories in Java), as well as state management with resource state, error screens, and loading screens.
• Domain Layer: Contains business logic and use cases (see directories under “domain”), including use cases like AllCharactersUseCase, AllEpisodesUseCase, and AllLocationsUseCase.
• Data Layer: Holds all repository implementations, remote data stores, API communication (Retrofit), mapping, pagination (Paging 3), and models. Directories like “data/remote”, “data/service”, and “data/di” are key here.
• Dependency Injection: Implemented via Dagger Hilt. This is critical for wiring up components from the data, domain, and presentation layers together (note the “data/di” module and application class components).
Out the Relationships/Interactions Between Components
• ViewModels (Presentation Layer): Act as the intermediary between the UI and the Domain. They invoke use cases from the Domain and provide data back to the UI.
• Domain Layer: Contains the business logic in the form of use cases. Use cases call the repositories in the Data Layer to retrieve or update data.
• Data Layer: Responsible for API communication via Retrofit (e.g., RickyMortyService) and manages data transformation (using response mappers) before handing it off to the domain. It also includes error handling, pagination (Paging 3), and factory classes for model creation.
• External Libraries & Tools: Represent libraries like Kotlin Coroutines (for asynchronous processing), Paging 3 for pagination support, Lottie for animations, and Material 3 for theming.