Skip to content

This Android starter project utilizes Hilt to manage dependencies within a clean and modular architecture. It leverages Jetpack Compose for building a modern and declarative UI. The project separates features into data, domain, and presentation layers, allowing for concurrent development by multiple teams. It uses the Gitflow branching model.

Notifications You must be signed in to change notification settings

mfbcat/clean-architecture-compose-android-hilt

Repository files navigation

Multimodule App with Clean Code Layers

Overview

The application demonstrates how to add modules for the different App UI features.

It is built using Jetpack Compose and follows a modular architecture with Clean Architecture principles implemented within each feature module. To ensure complete independence between modules, this architecture embraces self-contained layers within each feature, despite the potential for code duplication. This design choice empowers individual developers or teams to work in isolation and allows for focused, independent module testing.

Android Studio

This app has been built using the following Android Studio version:

Android Studio Narwhal | 2025.1.1 Patch 1 Build #AI-251.25410.109.2511.13752376, built on July 9, 2025 Runtime version: 21.0.6+-13391695-b895.109 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Toolkit: sun.awt.windows.WToolkit Windows 11.0 GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation Memory: 4096M Cores: 16 Registry: ide.experimental.ui=true com.android.studio.ml.activeModel=com.android.studio.ml.AidaModel

Architecture

The app utilizes a modular architecture to promote code reuse, improve build times, and facilitate independent feature development. Key modules include:

  • app/: The main application module, responsible for initial setup, dependency injection, and high-level navigation.
  • features/: Contains feature-specific modules, each encapsulating its own domain, data, and presentation layers (Clean Architecture). Examples: policies/, claims/, profile/.
  • core/: Contains common UI components, utilities, and base classes shared across multiple modules. Used sparingly to maintain feature isolation.

Within each feature module, the Clean Architecture layers are structured as follows:

  • domain/: Defines the business logic and data models (entities) specific to the feature. Contains use cases and abstract repository interfaces. Framework-independent.
  • data/: Implements the repository interfaces defined in the domain/ layer. Handles data access from various sources (e.g., network, database). Contains data sources (remote, cache), mappers, and repository implementations.
  • presentation/: The UI layer, built with Jetpack Compose. Contains composable screens, ViewModels, and UI-related logic specific to the feature.

The NavHost component is located in the app module for centralized navigation.

Branching model

This project utilizes the Gitflow branching model for a structured development workflow.

The master branch reflects the latest stable release, with each version tagged for easy access. All development happens on the develop branch, which contains the most recent changes. When a release is planned, a release branch is created from develop for final preparations. Once ready, it is merged into both master (to create a new release) and back into develop to incorporate any last-minute fixes. Feature development occurs in separate feature-* branches.

This model ensures a clean and maintainable history.

For a detailed summary of changes in each release, please refer to the CHANGELOG.md file. You can find all official releases and their corresponding tags in the "Releases" section of this repository.

Technologies

  • Jetpack Compose: Modern UI toolkit for building native Android UIs.
  • Kotlin: Programming language.
  • Clean Architecture: Architectural pattern for building maintainable and testable applications.
  • Modular Architecture: Organizing code into independent, reusable modules.
  • Dependency Injection (Hilt/Koin): Managing dependencies between modules and classes.
  • Navigation Compose: Handling navigation between screens.
  • Coroutines: For asynchronous programming.
  • Android Studio: Latest release on June 2025

Setup

  1. Clone the repository:

    git clone [https://github.com/mfbcat/insurances.git](https://github.com/mfbcat/insurances.git)
  2. Open the project in Android Studio:

    • Open Android Studio.
    • Select "Open an Existing Project" and navigate to the cloned repository.
  3. Build and Run:

    • Select "Build" -> "Make Project" to build the application.
    • Connect an Android device or emulator.
    • Select "Run" -> "Run 'app'" to run the application on the device or emulator.

Testing

The application includes unit tests and potentially integration/UI tests to ensure code quality and stability.

  • Unit Tests: Located in the src/test/java/ directories of each module. Focus on testing individual components and units of code in isolation.
  • Integration Tests: Located in the src/androidTest/java/ directories. Verify the interactions between different modules.
  • UI Tests: Located in the src/androidTest/java/ directories. Test the user interface and user interactions.

To run the tests:

  1. Open the "Build Variants" window (View -> Tool Windows -> Build Variants).
  2. Select the "debug" build variant.
  3. Navigate to the directory containing the tests.
  4. Right-click on the directory and select "Run 'All Tests'".

Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix: git checkout -b feature/my-new-feature
  3. Make your changes and commit them with clear and descriptive commit messages.
  4. Test your changes thoroughly.
  5. Push your branch to your forked repository: git push origin feature/my-new-feature
  6. Create a pull request to the main branch of the original repository.

License

MIT License, Apache License 2.0 Copyright (c) 2025 Marc Farssac, email: [marc.farssac@mfb.cat](mailto: marc.farssac@mfb.cat) https://www.mfb.cat

About

This Android starter project utilizes Hilt to manage dependencies within a clean and modular architecture. It leverages Jetpack Compose for building a modern and declarative UI. The project separates features into data, domain, and presentation layers, allowing for concurrent development by multiple teams. It uses the Gitflow branching model.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages