Skip to content

Latest commit

 

History

History
99 lines (71 loc) · 5.22 KB

File metadata and controls

99 lines (71 loc) · 5.22 KB

PRs Welcome Kotlin Jetpack Compose API License: MIT

Android Compose Template

An opinionated, production-ready template for modern Android applications.

This project serves as a comprehensive blueprint for building scalable and maintainable Android apps using 100% Kotlin, Jetpack Compose, and a cutting-edge tech stack. It's designed to help developers kickstart new projects with a solid architectural foundation.

Features

  • 100% Kotlin: Written entirely in Kotlin, embracing modern language features.
  • Modern UI Toolkit: Built with Jetpack Compose for a declarative and reactive UI.
  • Solid Architecture: Implements MVVM with Clean Architecture principles.
  • Dependency Injection: Pre-configured with Hilt for robust dependency management.
  • Asynchronous Programming: Utilizes Kotlin Coroutines and Flow for efficient background tasks.
  • Networking: Integrated with Retrofit for type-safe REST API communication.
  • Data Persistence: Features Room for local database caching and DataStore for user preferences.
  • Pagination: Includes Paging 3 for efficiently loading and displaying large datasets.
  • Navigation: Uses Navigation-Compose for a streamlined, single-activity navigation flow.
  • Image Loading: Leverages Coil for optimized image loading in Compose.

Architecture

This template follows the principles of Clean Architecture with an MVVM (Model-View-ViewModel) presentation layer. This creates a clear separation of concerns that is scalable and testable.

+----------------+   +----------------+   +----------------+
|      UI        |   |      Domain    |   |      Data      |
| (Jetpack Compose)|   |    (Use Cases) |   | (Repositories) |
+----------------+   +----------------+   +----------------+
        |                   |                   | 
    ViewModel         Kotlin/Java Lib        Retrofit, Room
  • UI Layer: Built with Jetpack Compose. ViewModels provide state to the UI and handle user events.
  • Domain Layer: Contains the core business logic of the application, encapsulated in UseCases. This layer is a pure Kotlin module and is independent of the Android framework.
  • Data Layer: Manages data from various sources (network, local database). Repository classes abstract the data sources from the rest of the app.

Tech Stack

This project uses a wide range of modern libraries and tools to provide a robust starting point:

  • Core

    • Kotlin: Official language for Android development.
    • Coroutines: For asynchronous programming.
    • Flow: A reactive stream library for Kotlin.
    • Hilt: For dependency injection.
  • UI

  • Data

    • Retrofit: Type-safe HTTP client for Android.
    • Room: Local database for offline caching.
    • Paging 3: For loading large datasets.
    • DataStore: For storing key-value pairs or typed objects.

Getting Started

To use this template for your own project, follow these steps:

  1. Clone the repository:

    git clone https://github.com/your-username/android-compose-template.git YourProjectName
    cd YourProjectName
  2. Change the package name:

    • In Android Studio, right-click on the root package com.composetemplate.
    • Select Refactor -> Rename.
    • In the dialog, choose Rename package and enter your desired package name.
  3. Update build.gradle.kts:

    • Open app/build.gradle.kts.
    • Change the applicationId to your new package name.
  4. Sync Gradle:

    • Click Sync Now in the toolbar to apply your changes.
  5. Start Building:

    • You are now ready to build your app on top of this template. Begin by adding your own features and modifying the existing modules.

Contributing

Contributions are always welcome! This project follows the Conventional Commits specification, and a PR template is provided to guide you.

Please feel free to open an issue or submit a pull request.

License

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