|
| 1 | +[](https://stackoverflow.com/users/1548824/akhilesh0707) |
| 2 | +[](https://www.linkedin.com/in/akhilesh0707/) |
| 3 | + |
| 4 | +# Rick-and-Morty |
| 5 | +The Rick And Morty - App consuming a [Rick and Morty API](https://rickandmortyapi.com/) to display Characters it has been built with clean architecture principles, Repository Pattern, and MVVM pattern as well as Architecture Components. |
| 6 | + |
| 7 | +This app shows the usage of the new Navigation Architecture Component in collaboration with the Bottom Navigation view with separate back stack history for each tab. |
| 8 | + |
| 9 | +**App features:** |
| 10 | +- List of Rick and Morty characters |
| 11 | +- Detail of characters |
| 12 | +- Bookmark character |
| 13 | +- Light/ Dark theme. |
| 14 | + |
| 15 | +## Screenshots |
| 16 | +<img alt="List" src="art/screenshot.png"> |
| 17 | + |
| 18 | +## Architecture |
| 19 | +Uses concepts of the notorious Uncle Bob's architecture called [Clean Architecture](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html).</br> |
| 20 | + |
| 21 | +* Better separation of concerns. Each module has a clear API., Feature related classes life in different modules and can't be referenced without explicit module dependency. |
| 22 | +* Features can be developed in parallel eg. by different teams |
| 23 | +* Each feature can be developed in isolation, independently from other features |
| 24 | +* faster compile time |
| 25 | +<img src="art/app_architecture.png"> |
| 26 | + |
| 27 | +## Modules: |
| 28 | +* **rick-and-morty-ui** - It uses all the components and classes releated to Android Framework. It gets the data from presentation layer and shows on UI. (**access all the modules**) |
| 29 | +* **data** - The data layer implements the repository interface that the domain layer defines. This layer provide a single source of truth for data. (Kotlin module that **can only access domain module**) |
| 30 | +* **remote** - Handles data interacting with the network. (**can only access data module**) |
| 31 | +* **cache** - Handles data interacting with the local storing (Room DB). (**can only access data module**) |
| 32 | +* **domain** - The domain layer contains the UseCases that encapsulate a single and very specific task that can be performed. This task is part of the business logic of the application. (Kotlin module that **cannot access any other module**) |
| 33 | +* **presentation** - MVVM with ViewModels exposing LiveData that the UI consume. The ViewModel does not know anything about it's consumers. (Android module that **can only access domain module**) |
| 34 | + |
| 35 | +## MAD Scorecard |
| 36 | +[<img src="art/mad_scorecard.png">](https://madscorecard.withgoogle.com/scorecards/1519405986/) |
| 37 | + |
| 38 | +## Tech stack - Library: |
| 39 | + |
| 40 | +- [Kotlin](https://kotlinlang.org/) |
| 41 | +- [Coroutines](https://github.com/Kotlin/kotlinx.coroutines) - A coroutine is a concurrency design pattern that you can use on Android to simplify code that executes asynchronously |
| 42 | +- [Flow](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/) - Flow is used to pass (send) a stream of data that can be computed asynchronously |
| 43 | +- [Dagger-Hilt](https://developer.android.com/training/dependency-injection/hilt-android) - for dependency injection. |
| 44 | +- [Kotlin-DSL](https://docs.gradle.org/current/userguide/kotlin_dsl.html) - Used to handle gradle dependencies and config versions |
| 45 | +- JetPack |
| 46 | + - [LiveData](https://developer.android.com/topic/libraries/architecture/livedata) - For reactive style programming (from VM to UI). |
| 47 | + - [Lifecycle](https://developer.android.com/jetpack/androidx/releases/lifecycle) - Used get lifecyle event of an activity or fragment and performs some action in response to change |
| 48 | + - [ViewModel](https://developer.android.com/topic/libraries/architecture/viewmodel) - Stores UI-related data that isn't destroyed on UI changes. |
| 49 | + - [Room](https://developer.android.com/topic/libraries/architecture/room) - Used to create room db and store the data. |
| 50 | + - [Navigation](https://developer.android.com/guide/navigation/navigation-getting-started) - Used to navigate between fragments |
| 51 | + - [Data Binding](https://developer.android.com/topic/libraries/data-binding) - Used to bind UI components in your XML layouts. |
| 52 | +- [Material-Components](https://github.com/material-components/material-components-android) - Material design components like ripple animation, cardView. |
| 53 | +- [Retrofit](https://github.com/square/retrofit) - Used for REST api communication. |
| 54 | +- [OkHttp](http://square.github.io/okhttp/) - HTTP client that's efficient by default: HTTP/2 support allows all requests to the same host to share a socket |
| 55 | +- [Moshi](https://github.com/square/moshi) - Used to convert Java Objects into their JSON representation and vice versa. |
| 56 | +- [Timber](https://github.com/JakeWharton/timber) - Used for logging. |
| 57 | +- [Glide](https://bumptech.github.io/glide/) - Glide is a fast and efficient image loading library for Android |
| 58 | + |
| 59 | +## TODO |
| 60 | +- [X] CI/CD (Github Actions, Bitrise, CircleCI) |
| 61 | +- [X] Unit test |
| 62 | +- [X] Jacoco for test coverage |
| 63 | +- [X] Ktlint or Detekt |
| 64 | +- [ ] Use Jetpack Compose |
| 65 | + |
| 66 | +## Reference repository |
| 67 | +This repository code is mostly inspired by [Android-Clean-Architecture-Boilerplate](https://github.com/bufferapp/android-clean-architecture-boilerplate). |
| 68 | + |
| 69 | +## Find this repository useful? :heart: |
| 70 | +Support it by joining __[stargazers](https://github.com/akhilesh0707/Rick-and-Morty/stargazers)__ for this repository. :star: <br> |
| 71 | +And __[follow](https://github.com/akhilesh0707)__ me for my next creations! 🤩 |
| 72 | + |
| 73 | +## Contributions |
| 74 | +Please feel free to file an issue for errors, suggestions or feature requests. Pull requests are also encouraged. |
| 75 | + |
0 commit comments