/devposts

This project demonstrates a scalable, maintainable, and testable architecture.

Primary LanguageKotlin

๐Ÿ‘จโ€๐Ÿ’ป Devposts

Devposts is a sample application that displays a brief selection of the hottest articles from Dev.to, showcasing featured content for developers.

๐ŸŒ  Screenshots (Light & Dark Color Schemes)

Articles Screen Article Details Screen

๐ŸŽฏ Why I Built This?

In this project, I aimed to design and implement a scalable, maintainable, reusable, and testable architecture based on Clean Architecture and modular design, in a way that is simple and easy for others to understand.

๐Ÿงฑ Project Architecture

devposts_banner

What is Clean Architecture?

Before introducing that, let me say that Clean Architecture is not a template, trend, or some boilerplate. In fact, this architecture comes from following some principles like SOLID Principles. These principles are conceptual guidelines that prioritize the separation of concerns, making your software independent of frameworks, UI, and databases.

Modularization and Component Principles

If we want to implement a well-modularized project, we have to follow something like SOLID principles (Which are applied at the class and interface level), but at the component (Module) level. These principles are Component Principles. These principles govern the dependencies between modules and ensure that the overall architecture remains flexible.

By combining Clean Architecture with a modular design, we can establishes a strong foundation for building large-scale Android applications that are easy to extend, maintain, and test.

Modules depend only on more stable modules, minimizing the ripple effect of changes. Each module is highly cohesive and loosely coupled, providing clear separation of concerns and easier testing.

Presentation Layer Pattern

The project employs the Model-View-Intent (MVI) pattern in its presentation modules, a unidirectional data flow pattern that improves state management and UI predictability.

Additionally, the project leverages Convention Plugins for streamlined Gradle configuration, keeping build logic clean and reusable across modules.

๐Ÿงฉ Modularization Overview

  • :app Acts as the application entry point.
  • :build-logic Project-specific convention plugins
  • :data Handles all data-related concerns and consists of:
    • :datasources Handles where data comes from (network APIs, local DB). Implements an offline-first strategy by keeping the local Room database as the single source of truth.
    • :repository Provides a layer that encapsulates and exposes data operations, abstracting underlying data sources.
  • :domain Encapsulates business logic and use cases, the core rules and operations of the app, independent of UI or data source implementation
  • :feature Includes UI logic (feature modules):
    • :articles Handles the list of articles UI (Articles Screen) logic and presentation.
    • :article-details Handles the UI logic for showing details of a selected article (Article Details Screen).
  • :libraries Reusable libraries:
    • :base-domain Contains logic that can be reused by other domain modules (if they exist).
    • :base-feature Contains logic that can be reused by other feature modules, (e.g ui components).
    • :design-system Contains theme and typography-specific logic.
    • :common All utilities that can be reused in all project modules.
    • :navigation Includes navigation-related logic/tools.
    • testA shared library for test utilities.

๐Ÿ› ๏ธ Development

  • Kotlin A modern, concise, and safe programming language.
  • Kotlin Coroutines a way to write asynchronous code in a sequential manner.
  • Kotlin Flow wich is built on top of coroutines to handle asynchronous data streams in a simple, safe, and reactive way.
  • Jetpack Compose Androidโ€™s modern UI toolkit for building declarative and reactive UIs.
  • Room An ORM for SQLite, providing a clean API for local data persistence.
  • Ktor An asynchronous framework for building connected applications, used here as the HTTP client.
  • Hilt A dependency injection library built on top of Dagger for Android.
  • Paging 3 A library for loading and displaying large datasets efficiently.
  • Coil An image loading library for Android backed by Kotlin Coroutines, optimized for Jetpack Compose.
  • Ktlint for Kotlin code style checks
  • detekt for static code analysis, ensuring consistent code quality
  • Convention Plugins Gradle plugins that centralize and reuse build configuration across multiple modules.
  • Testing: The project relies on the following tools to ensure maintainable tests
    • JUnit Testing framework.
    • MockK creates mocks and stubs for dependencies.
    • Truth fluent, human-readable assertions.

๐Ÿ”Œ API

This project integrates with the Dev.to API (also known as the Forem API), enabling seamless access to published articles and content directly from the Dev.to platform.

๐Ÿš€ Whatโ€™s Next?

Planned additions:

  • Unit tests (current focus)
  • Integration tests
  • UI tests

โญ Found this project useful?

Give it a star to support the project and stay notified about future updates!

๐Ÿ‘ฅ Want to contribute?

This project is a work in progress and may include technical debt. Contributions are welcome to help refine and enhance it, with the goal of delivering a robust and scalable architecture.