{"id":13774611,"url":"https://github.com/happysingh23828/Android-Clean-Architecture","last_synced_at":"2025-05-11T06:33:28.270Z","repository":{"id":43639909,"uuid":"251545848","full_name":"happysingh23828/Android-Clean-Architecture","owner":"happysingh23828","description":"This is a sample movie list Android application built to demonstrate use of Clean Architecture tools. Dedicated to all Android Developers - (Kotlin, MVVM, Clean Architecture, Rx-Java, Dagger, OkHttp, Unit Testing, SOLID principles, Code Coverage)","archived":false,"fork":false,"pushed_at":"2021-10-10T08:58:23.000Z","size":6197,"stargazers_count":298,"open_issues_count":0,"forks_count":51,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-17T09:39:33.476Z","etag":null,"topics":["android","android-app","android-architecture","android-sdk","android-studio","cache","clean-architecture","cleanarchitecture","domain","mvvm","room","solid-principles"],"latest_commit_sha":null,"homepage":"http://happysingh.dev/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/happysingh23828.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-31T08:39:56.000Z","updated_at":"2024-09-24T04:58:24.000Z","dependencies_parsed_at":"2022-09-01T18:22:34.678Z","dependency_job_id":null,"html_url":"https://github.com/happysingh23828/Android-Clean-Architecture","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happysingh23828%2FAndroid-Clean-Architecture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happysingh23828%2FAndroid-Clean-Architecture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happysingh23828%2FAndroid-Clean-Architecture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happysingh23828%2FAndroid-Clean-Architecture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/happysingh23828","download_url":"https://codeload.github.com/happysingh23828/Android-Clean-Architecture/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253528415,"owners_count":21922623,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-app","android-architecture","android-sdk","android-studio","cache","clean-architecture","cleanarchitecture","domain","mvvm","room","solid-principles"],"created_at":"2024-08-03T17:01:28.638Z","updated_at":"2025-05-11T06:33:25.454Z","avatar_url":"https://github.com/happysingh23828.png","language":"Kotlin","funding_links":[],"categories":["Kotlin",":art: Pattern"],"sub_categories":["MVVM"],"readme":"\u003cp align=\"center\"\u003e\r\n \u003ccenter\u003e\u003cimg width=\"100%%\"  src=\"files/android_clean_architecture_banner.png\"\u003e\u003c/a\u003e\u003c/center\u003e\r\n\u003c/p\u003e\r\n\r\n# Android Clean Architecture \r\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/3ae0843cfd584f0582162c3c97000fd0)](https://app.codacy.com/manual/happysingh23828/Android-Clean-Architecture?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=happysingh23828/Android-Clean-Architecture\u0026utm_campaign=Badge_Grade_Settings)\r\n[![platform](https://img.shields.io/badge/platform-Android-yellow.svg)](https://www.android.com)\r\n![Android CI](https://github.com/happysingh23828/Android-Clean-Architecture/workflows/Android%20CI/badge.svg)\r\n[![GitHub license](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\r\n![Github Followers](https://img.shields.io/github/followers/happysingh23828?label=Follow\u0026style=social)\r\n![GitHub stars](https://img.shields.io/github/stars/happysingh23828/Android-Clean-Architecture?style=social)\r\n![GitHub forks](https://img.shields.io/github/forks/happysingh23828/Android-Clean-Architecture?style=social)\r\n![GitHub watchers](https://img.shields.io/github/watchers/happysingh23828/Android-Clean-Architecture?style=social)\r\n![Twitter Follow](https://img.shields.io/twitter/follow/happysingh23828?label=Follow\u0026style=social)\r\n\r\nThis is a sample movie list  Android application 📱 built to demonstrate use of *Clean Architecture* tools. Dedicated to all Android Developers with ❤️. \r\n\r\n***You can Install and test latest app from below 👇***\r\n\r\n[![Clean Architecture App](https://img.shields.io/badge/CleanArchitecture🍲-APK-red.svg?style=for-the-badge\u0026logo=android)](https://github.com/happysingh23828/Android-Clean-Architecture/raw/master/files/clean-arc.apk)\r\n\r\n## - How to build on your environment\r\nAdd your API key in **local.properties** file.\r\n```xml\r\ntmdb_api_key = YOUR_API_KEY\r\n```\r\nIf you don't have tmdb api key you can create new key from [here](https://developers.themoviedb.org/3/getting-started/introduction).\r\n\r\n## - About\r\nIt simply loads **Popular Movies** list from [TMDB-API](https://www.themoviedb.org/)  and stores it in persistence storage (i.e. Room Database). Movies list will be always loaded from local database. Remote data (from API) and Local data is always synchronized.\r\nIt has feature of bookmark movie which will be stored locally.\r\n- Modular approch followed\r\n- It is heavily implemented by following standard clean architecture principle.\r\n- Offline capability.\r\n- It has cache expiration feature [5 minutes].\r\n- Unit testing written for all layers.\r\n- Multi Module Code Coverage reports using Jacoco.\r\n- static code analyses added by using detekt, ktlint.\r\n- Android CI github action integration. \r\n- [S.O.L.I.D](https://en.wikipedia.org/wiki/SOLID) priciple followed for more understandable, flexible and maintainable.\r\n\r\n### - Disclaimer\r\n\r\nNote: The use of clean architecture may seem over-complicated for this sample project. However, this allows us to keep the amount of boilerplate code to a minimum and also demonstrate the approach in a simpler form.\r\n\r\nClean Architecture will not be appropriate for every project, so it is down to you to decide whether or not it fits your needs 🙂\r\n\r\n## - Built With 🛠\r\n- [Kotlin](https://kotlinlang.org/) - First class and official programming language for Android development.\r\n- [Rx-Java](https://github.com/ReactiveX/RxJava) - For composing asynchronous and event-based programs by using observable sequences.\r\n- [Android Architecture Components](https://developer.android.com/topic/libraries/architecture) - Collection of libraries that help you design robust, testable, and maintainable apps.\r\n  - [LiveData](https://developer.android.com/topic/libraries/architecture/livedata) - Data objects that notify views when the underlying database changes.\r\n  - [ViewModel](https://developer.android.com/topic/libraries/architecture/viewmodel) - Stores UI-related data that isn't destroyed on UI changes. \r\n  - [Room](https://developer.android.com/topic/libraries/architecture/room) - SQLite object mapping library.\r\n- [Dagger 2](https://dagger.dev/) - Dependency Injection Framework\r\n- [Retrofit](https://square.github.io/retrofit/) - A type-safe HTTP client for Android and Java.\r\n- [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\r\n- [Glide](https://github.com/bumptech/glide) - image loading framework for Android\r\n- [Gson](https://github.com/google/gson) - used to convert Java Objects into their JSON representation and vice versa.\r\n- [Mockito](http://site.mockito.org/) - Most popular mocking framework for Java/kotlin.\r\n- [Robolectric](http://robolectric.org/) - allows you to write unit tests and run them on a desktop JVM while still using Android API.\r\n- [Stetho](https://github.com/facebook/stetho) - Stetho is a debug bridge for Android applications, enabling the powerful Chrome Developer Tools and much more.\r\n- [Detekt](https://detekt.github.io/detekt/) - Detekt is a static analyze tool for the Kotlin language. It's open source.\r\n- [Ktlint](https://github.com/pinterest/ktlint) -Ktlint is a static code analysis tool maintain by Pinterest. Linter and formatter for Kotlin code.\r\n\r\n## - Clean Architecture\r\n\r\n\u003ccenter\u003e\u003cimg width=\"200\" height=\"200\" src=\"https://koenig-media.raywenderlich.com/uploads/2019/06/Android-Clean-Architecture.png\"\u003e\u003cp\u003e- photo by: \u003ca href=\"https://www.raywenderlich.com/3595916-clean-architecture-tutorial-for-android-getting-started\"\u003eraywenderlich\u003c/a\u003e\u003c/p\u003e\u003c/center\u003e\r\n\r\n### What is clean architecture?\r\nArchitecture means the overall design of the project. It's the organization of the code into classes or files or components or modules. And it's how all these groups of code relate to each other. The architecture defines where the application performs its core functionality and how that functionality interacts with things like the database and the user interface.\r\n\r\n### Why the cleaner approach?\r\n1. Separation of code in different layers with assigned responsibilities making it easier for further modification.\r\n2. High level of abstraction\r\n3. Loose coupling between the code\r\n4. Testing of code is painless\r\n\u003e Clean code always looks like it was written by someone who cares. - by Michael Feathers”\r\n\r\n### Layers\r\n- **Domain** - Would execute business logic which is independent of any layer and is just a pure kotlin/java package with no android specific dependency.\r\n- **Data** - Would dispense the required data for the application to the domain layer by implementing interface exposed by the domain.\r\n- **Presentation / framework** - Would include both domain and data layer and is android specific which executes the UI logic.\r\n\r\n## - Modules of App\r\n  ### App \r\n  It uses the all the components and class releated to Android Framework. It gets the data from presentation layer and shows on UI.\r\n  \r\n  ### BuildSrc\r\n  This module helps to list and manage all the dependencies of the app at one place. It has list of dependencies and versions of that dependencies.\r\n  \r\n  ### Data \r\n  The Data layer is our access point to external data layers and is used to fetch data from multiple sources (the cache and remote in our case).\r\n  \r\n  ### Cache\r\n  The Cache layer handles all communication with the local database which is used to cache data.\r\n  \r\n  ### Domain\r\n  The domain layer responsibility is to simply contain the UseCase instance used to retrieve data from the Data layer and pass it onto the Presentation layer. \r\n  \r\n  ### Presentation\r\n  This layer's responsibility is to handle the presentation of the User Interface, but at the same time knows nothing about the user interface itself. This layer has no dependence on the Android Framework, it is a pure Kotlin module. Each ViewModel class that is created implements the ViewModel class found within the Architecture components library. This ViewModel can then be used by the UI layer to communicate with UseCases and retrieve data.\r\n  \r\n  ### Remote\r\n  The Remote layer handles all communications with remote sources, in our case it makes a simple API call using a Retrofit interface. \r\n\r\n## - Code Coverage Reports\r\nThis projects uses [jacoco plugin](https://www.jacoco.org/jacoco/) for generate code coverage reports. currently each modules generates seprate code reports.\r\n\r\n  #### Java/Kotlin Modules\r\n  Use `./gradlew jacocoTestReport`\r\n  \r\n  Reports location for each module-\u003cbr\u003e\r\n  `-/data/build/reports/jacoco/test/html/index.html`\u003cbr\u003e\r\n  `-/domain/build/reports/jacoco/test/html/index.html`\u003cbr\u003e\r\n  `-/remote/build/reports/jacoco/test/html/index.html`\u003cbr\u003e\r\n\r\n  #### Android Modules\r\n  Use `./gradlew jacocoTestReportDebug`\r\n\r\n  Reports location for each module-\u003cbr\u003e\r\n  `-/app/build/reports/jacoco/debug/index.html`\u003cbr\u003e\r\n  `-/cache/build/reports/jacoco/debug/index.html`\u003cbr\u003e\r\n  `-/presentattion/build/reports/jacoco/debug/index.html` \u003cbr\u003e\r\n \r\n \r\n## - Code Quality Checks\r\nThis projects uses detekt, ktlint static code analyser and auto formatter in CI/CD pipeline to maintain code quality. they also genrated reports.\r\n\r\n  #### Run detekt locally\r\n  Use `./gradlew detekt`\r\n  \r\n  Reports location for each module-\u003cbr\u003e\r\n  `-/cache/build/reports/detekt/report.html`\u003cbr\u003e\r\n  `-/domain/build/reports/detekt/report.html`\u003cbr\u003e\r\n  `-/remote/build/reports/detekt/report.html`\u003cbr\u003e\r\n\r\n  #### Run ktlint locally\r\n  Use `./gradlew ktlint`\r\n\r\n  Reports location for each module-\u003cbr\u003e\r\n  `-/app/build/reports/ktlint/ktlint-checkstyle-report.xml`\u003cbr\u003e\r\n  `-/cache/build/reports/ktlint/ktlint-checkstyle-report.xml`\u003cbr\u003e\r\n  `-/presentattion/build/reports/ktlint/ktlint-checkstyle-report.xml` \u003cbr\u003e\r\n \r\n  #### Run ktlint formatter locally\r\n  Use `./gradlew ktlintFormat`\r\n  \r\n\r\n## - Current App's Architecture\r\nThis app uses [***MVVM (Model View View-Model)***](https://developer.android.com/jetpack/docs/guide#recommended-app-arch) architecture.\r\n\r\n## - Future Plans\r\n1. Add another features, Showing the crew and cast list for a movie. \r\n2. Instrumentation test cases to be added.\r\n3. Merge all code covergae reports at single place.\r\n4. MvRx implementaion on the UI layer.\r\n5. MVI implementation on the UI layer.\r\n6. Reach code coverage atleast 80%.\r\n7. Dark Mode theme etc.\r\n\r\n\r\n## - Thanks\r\nA special thanks to the authors involved with this repository, they were a great resource during our learning!\r\n- https://github.com/bufferapp/android-clean-architecture-mvi-boilerplate\r\n\r\n## If this project helps you in anyway, show your love :heart: by putting a :star: on this project :v:\r\n\r\n\r\n## - Contributing\r\n\r\nPlease fork this repository and contribute back using\r\n[pull requests](https://github.com/happysingh23828/Android-Clean-Architecture/pulls).\r\n\r\nAny contributions, large or small, major features, bug fixes, are welcomed and appreciated\r\nbut will be thoroughly reviewed .\r\n\r\n### - Contact - Let's become friend\r\n- [Blog](http://happysingh.dev/)\r\n- [Youtube](https://www.youtube.com/channel/UCILhpbLSFkGzsiCYAeR30DA)\r\n- [Github](https://github.com/happysingh23828)\r\n- [Linkedin](https://www.linkedin.com/in/happpysingh23828/)\r\n\r\n## - License\r\n\r\n```\r\nMIT License\r\n\r\nCopyright (c) 2020 Happy Singh\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all\r\ncopies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\nSOFTWARE.```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhappysingh23828%2FAndroid-Clean-Architecture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhappysingh23828%2FAndroid-Clean-Architecture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhappysingh23828%2FAndroid-Clean-Architecture/lists"}