Skip to content

Latest commit

 

History

History
112 lines (79 loc) · 4.13 KB

README.md

File metadata and controls

112 lines (79 loc) · 4.13 KB

Clean Architecture - Android App

This is a sample Android application that demonstrates the principles of Clean Architecture. The app follows a modular approach to ensure separation of concerns, maintainability, and scalability.

Table of Contents

Overview

The Clean Architecture pattern helps to create Android applications that are easy to maintain, test, and scale. It follows a structured approach where:

  • Business logic is separated from UI and data handling.
  • Dependencies flow inwards, meaning that external libraries and data sources are isolated from core logic.
  • The app uses MVVM (Model-View-ViewModel) architecture with Jetpack Compose for UI components.

In this project, we implement Clean Architecture with multiple layers:

  1. Presentation Layer (UI)
  2. Domain Layer (Business logic)
  3. Data Layer (API and database)

Architecture

This project follows Clean Architecture, which consists of the following layers:

  1. Presentation Layer:

    • Handles UI-related logic and interacts with ViewModel.
    • UI is built using Jetpack Compose.
  2. Domain Layer:

    • Contains business logic, UseCases, and repository interfaces.
    • Manages the flow of data between the presentation layer and data layer.
  3. Data Layer:

    • Responsible for data fetching and management.
    • Uses Retrofit for networking and Room for local data storage (if applicable).
    • Handles API calls and data manipulation.

The dependencies flow inwards:

  • The presentation layer depends on the domain layer, but not vice versa.
  • The domain layer depends on the data layer but not vice versa.

Technologies Used

  • Kotlin: Programming language used for Android development.
  • Jetpack Compose: Modern UI toolkit for building native UIs.
  • Clean Architecture: Structured app design for better maintainability and testability.
  • ViewModel: Manages UI-related data lifecycle-consciously.
  • LiveData / StateFlow: For handling UI-related state changes.
  • Retrofit: A type-safe HTTP client for making API calls.
  • Coil : An image loading library for Android and Compose Multiplatform.
  • Kotlin Coroutines: For asynchronous operations and handling background tasks.
  • Hilt: Dependency injection library (if used for managing dependencies).

Installation

To get started with this project locally, follow these steps:

Prerequisites

  1. Android Studio (latest version)
  2. JDK 11 or higher

Steps

  1. Clone the repository:

    git clone https://github.com/javaman97/CleanArchitecture.git
  2. Open the project in Android Studio.

  3. Wait for the dependencies to be synced.

  4. Run the app on an emulator or a physical device.

Usage

Once the app is up and running, you can:

  • Search for GitHub users and view their repositories.
  • The app will display user details, including the name, description, and number of stars of each repository.
  • Error handling is implemented for invalid usernames or network failures.
  • Loading states are shown while fetching data from the API.

The app follows modern Android development practices such as MVVM, StateFlow, Kotlin Coroutines, and Jetpack Compose.

Contributing

Contributions are welcome! If you want to improve or extend this project, follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature).
  3. Make your changes.
  4. Commit your changes (git commit -am 'Add new feature').
  5. Push to the branch (git push origin feature/your-feature).
  6. Create a new Pull Request.

Code Style

  • Follow the standard Kotlin coding conventions.
  • Ensure code is well-documented and easy to read.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Feel free to modify the README as needed, depending on the specific features and technologies you’ve used in your project!