Skip to content
🤔 Documentation issue? Report or edit



(You can also look how it’s done in the examples)

Gradle Plugins

You need to add KSP and the Ktorfit Gradle plugin

plugins {
  id("") version "CURRENT_KSP_VERSION"
  id("de.jensklingenberg.ktorfit") version "1.10.1"

Next you have to add the Ktorfit KSP Plugin to the common target and every compilation target, where you want to use Ktorfit.

val ktorfitVersion = "1.10.1"

dependencies {
    add("kspCommonMainMetadata", "de.jensklingenberg.ktorfit:ktorfit-ksp:$ktorfitVersion")

[NAMEOFPLATFORM] is the name of the compilation target. When you want to use it for the Android module it’s kspAndroid, for Js it’s kspJs, etc. Look here for more information


Add the Ktorfit-lib to your common module.

val ktorfitVersion = "1.10.1"

sourceSets {
    val commonMain by getting{


Ktorfit is based on Ktor clients 2.3.4. You don’t need to add an extra dependency for the default clients. When you want to use Ktor plugins for things like serialization, you need to add the dependencies, and they need to be compatible with 2.3.4

You can also use “de.jensklingenberg.ktorfit:ktorfit-lib-light” this will only add the Ktor client core dependency and not the platform dependencies for the clients. This will give you more control over the used clients, but you have to add them yourself. Everything else is the same as “ktorfit-lib”

Last update: September 16, 2023