Skip to content

Kraft — mappers you write, generated. Compile-time KSP, no reflection, no runtime cost, Kotlin Multiplatform.

Maven Central GitHub Release

Every Kotlin codebase has that file. Forty lines of id = id, name = name, email = email that nobody wanted to write and nobody wants to review. Kraft deletes it:

- fun User.toUserDto(): UserDto = UserDto(
-     id = id,
-     name = name,
-     email = email,
- )
+ @MapConfig(source = User::class, target = UserDto::class)
+ object UserMapper
val dto = user.toUserDto() // generated at compile time

That's the whole mapper. Kraft is a KSP processor that generates type-safe extension functions between your data classes — plain, readable Kotlin you can inspect in build/generated. No reflection, no runtime library, nothing to ship.

Get started Browse the guide

What Kraft handles for you

  • Basic mapping


    Same-name properties map automatically — @MapConfig, @MapFrom, or @MapTo, whichever fits your layering.

    Basic Mapping →

  • Nested objects & collections


    Child mappers are auto-detected when types differ, and List<T> / Set<T> map their elements along the way.

    Nested Mapping →

  • Enums


    @MapEnum matches entries by name and lets you pin the exceptions with custom entry pairs.

    Enum Mapping →

  • Custom converters


    @MapUsing for one-off transformations, @KraftConverter for converters discovered across the whole classpath.

    Custom Converters →

  • Reverse mapping


    One @MapReverse and the inverse mapper is generated too — renames, converters, and ignores included.

    Reverse Mapping →

  • AI-assisted workflows


    A ready-made skill file teaches coding agents to write Kraft mappers correctly on the first try.

    AI Integration →

Install

Kraft is on Maven Central (com.blu3berry.kraft) — ensure mavenCentral() is in your repositories { } block, then replace <version> with the release shown in the badge above. The Gradle plugin wires everything (dependencies, generated sources, task ordering) on Kotlin Multiplatform, JVM, and Android modules:

// build.gradle.kts
plugins {
    kotlin("multiplatform") // or kotlin("jvm") / kotlin("android")
    id("com.google.devtools.ksp") version "2.3.3"
    id("com.blu3berry.kraft") version "<version>"
}

See Getting Started for manual wiring, requirements, KSP version matching, and legacy-project compatibility.

Where next