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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

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