Dimension35c is a modern Android application built to showcase a clean, multi-module architecture and the latest Android development best practices. It serves as a client for the public Rick and Morty API, allowing users to explore characters and episodes from the show.
This project is intended for software engineers and the open-source community to serve as a reference for building robust and scalable Android applications.
The application follows the principles of Clean Architecture, separating concerns into distinct layers to create a decoupled, testable, and maintainable codebase.
graph TD
subgraph "Presentation Layer (:app)"
direction LR
Compose_UI["Compose UI"]
ViewModel["ViewModel"]
Compose_UI --> ViewModel
end
subgraph "Domain Layer (:app)"
direction LR
Repository["Repository"]
end
subgraph "Data Layer (:network)"
direction LR
KtorClient["Ktor Client"]
end
subgraph "External"
direction LR
API["Rick and Morty API"]
end
ViewModel --> Repository
Repository --> KtorClient
KtorClient --> API
The project is divided into two primary modules:
:app: The main application module that contains the UI and presentation logic. It is built entirely with Jetpack Compose and uses ViewModels for state management. This module is responsible for observing data streams and rendering the UI accordingly.:network: A self-contained Android library module responsible for all communication with the Rick and Morty API. It has no dependencies on the:appmodule and can be reused in other projects.
This modular approach enforces separation of concerns, improves build times, and allows for independent development and testing of different layers.
-
Data Layer (
:networkmodule)- Networking: Uses Ktor for making HTTP requests to the API.
- Data Serialization: Uses
kotlinx.serializationto parse JSON responses into Kotlin objects. - Model Mapping: A key feature of this layer is the mapping of
Remotemodels (which directly reflect the API's JSON structure) to cleanDomainmodels. This ensures that the rest of the application is shielded from any changes in the API and works with type-safe, clean data. - Error Handling: API calls are wrapped in a custom
ApiOpssealed interface (MadeorFailed), providing a robust and predictable way to handle network errors.
-
Domain Layer (Implicit)
- Repositories: The
CharacterRepositoryandEpisodesRepositoryact as a facade, providing a single source of truth for data. They abstract the data source (theKtorClient) from the presentation layer. - Domain Models: Simple, immutable data classes (e.g.,
Dimension34cCharacter,Episode) represent the core business objects of the application.
- Repositories: The
-
Presentation Layer (
:appmodule)- UI: The entire UI is built with Jetpack Compose, creating a modern, declarative, and reactive user interface.
- State Management: ViewModels are used to manage UI state. They fetch data from the repositories and expose it to the UI using Kotlin's
StateFlow. - Dependency Injection: Hilt is used to manage dependencies throughout the application, making the code more modular and testable.
| Light Theme | Dark Theme |
|---|---|
| Home Page | Home Page |
![]() |
![]() |
| Details Page | Details Page |
![]() |
![]() |
| Search Page | Search Page |
![]() |
![]() |
| Episodes Page | Episodes Page |
![]() |
![]() |
To build and run the project, you will need Android Studio.
- Clone the repository:
git clone https://github.com/ansgrb/Dimension35c.git
- Open the project in Android Studio.
- Let Gradle sync and download the required dependencies.
- Run the
appconfiguration on an Android emulator or a physical device.
This project would not be possible without the incredible Rick and Morty API created by Axel Fuhrmann. A huge thank you for providing this amazing resource to the developer community.







