Skip to content

Sample Pixabay API with Kotlin Multiplatform Mobile. 🍭 Clean Architecture - 🌰 MVVM - 🌸 SOLID - 🤟 SqlDelight - 🔆 Ktor - 🔥 Koin(DI)

Notifications You must be signed in to change notification settings

LamNguyen17/KMM_Clean_Architecture

Repository files navigation

🚀 Project using Clean Architecture recommend by Google Developer

This guide encompasses best practices and recommended architecture for building robust, high-quality apps

🚀 Introduction

This sample demonstrates how one can

  • Setup base architecture of KMM (Kotlin Multiplatform Mobile) app using Clean Architecture
  • Use Koin(dependency injection) for layers separation
  • Make api calls using Ktor plugin.
├── androidApp
|   ├── di
|   └── presentation/features
├── iosApp
|   └── iosApp
|       └── Presentation
└── shared
    ├── androidMain
    |   ├── db
    |   └── BaseViewModel.kt
    ├── commonMain
    |   ├── kotlin
    |   |   ├── common
    |   |   ├── db
    |   |   ├── di
    |   |   ├── photo
    |   |   └── BaseViewModel.kt
    |   └── sqldelight
    |       └── ForestDatabase.sq
    └── iosMain
        ├── db
        └── di

Dependencies

  • Kotlinx Coroutines Core : Library support for Kotlin coroutines with multiplatform support.
  • Lifecycle ViewModel Kotlin Extensions : Kotlin extensions for 'viewmodel' artifact
  • SqlDelight : SQLDelight generates typesafe Kotlin APIs from your SQL statements. It verifies your schema, statements, and migrations at compile-time and provides IDE features like autocomplete and refactoring which make writing and maintaining SQL simple.
  • Koin : KOIN - Kotlin simple Dependency Injection Framework
  • Ktor : Ktor is a framework for quickly creating web applications in Kotlin with minimal effort.
  • Coil_Compose : An image loading library for Android backed by Kotlin Coroutines.

🚀 Module Structure

Clean Architecture

There are 3 main modules to help separate the code. They are Data, Domain, and Presentaion.

  • Data contains Local Storage, APIs, Data objects (Request/Response object, DB objects), and the repository implementation.

  • Domain contains UseCases, Domain Objects/Models, and Repository Interfaces

  • Presentaion contains UI, View Objects, Widgets, etc. Can be split into separate modules itself if needed. For example, we could have a module called Device handling things like camera, location, etc.

Presentation (View)

  • View,updates UI

🚀 Screenshoots

Image

About

Sample Pixabay API with Kotlin Multiplatform Mobile. 🍭 Clean Architecture - 🌰 MVVM - 🌸 SOLID - 🤟 SqlDelight - 🔆 Ktor - 🔥 Koin(DI)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published