Dashboard

Set Up a KMP Repository

A KMP repository watches a Maven source for Kotlin Multiplatform libraries, automatically builds native npm and Swift packages from them, and serves the results through the standard npm and Swift registries. Kotlin library authors publish once to Maven, and JavaScript and Swift consumers install with their native package managers.

How it works

  1. You create a KMP repo and tell it where to find Maven artifacts (an Artifacts Maven repo or an external URL like Maven Central)
  2. You add watched packages — the Maven coordinates to monitor
  3. When you poll for new versions, Artifacts detects new releases and kicks off a build
  4. Artifacts builds JS and XCFramework outputs automatically, then publishes them to your KMP repo
  5. The generated packages are served through the standard npm and Swift proxies — consumers install with npm install or Swift Package Manager as usual

Prerequisites

  1. An Artifacts accountRegister here if you don't have one
  2. A KMP library published to Maven — either to an Artifacts Maven repository (see Publish a KMP Library) or to an external registry like Maven Central

Create the KMP repository

  1. Go to your Dashboard and click Create Repository
  2. Enter a name for the repo (e.g. my-kmp-packages)
  3. Select KMP as the package type
  4. Configure the Maven source:
    • Artifacts Repo — select one of your existing Maven repositories from the dropdown. Use this if you publish your KMP library to Artifacts.
    • External URL — enter a Maven repository URL (e.g. https://repo1.maven.org/maven2). Use this for libraries on Maven Central or other registries.
  5. Click Create

Add a watched package

Once the repo is created, go to the Watched Packages tab:

  1. Click Add Package
  2. Enter the Maven coordinates of the library you want to watch:
    • Group ID — e.g. com.example
    • Artifact ID — e.g. my-library
  3. The build pipeline detects which targets your library supports and shows what can be built:
    • Build npm package — enabled if the library has a JS target
    • Build Swift package — enabled if the library has Apple targets (iosArm64, macosArm64, etc.)
  4. The npm and Swift output names are derived automatically from your repo name and artifact ID. For a repo called my-kmp-packages with artifact my-library, you'll get:
    • npm: @my-kmp-packages/my-library
    • Swift: my-kmp-packages.my-library
  5. Click Add

If you need different output names, click Customize output names to override the defaults.

You can watch multiple packages in the same KMP repo.

Target requirements

The build pipeline only builds outputs for targets your library actually declares. Your library's build.gradle.kts must include the appropriate targets in its kotlin { } block:

For npm packages (JS output):

kotlin {
    js(IR) {
        browser()
        nodejs()
    }
}

For Swift packages (XCFramework output), add one or more Apple targets:

kotlin {
    iosArm64()
    iosSimulatorArm64()
    iosX64()
    macosArm64()
    macosX64()
}

The pipeline detects targets by looking for platform-specific Maven artifacts (e.g. my-library-js, my-library-iosarm64). If a target is missing, the UI will show a message explaining what to add. After adding targets, republish your library to Maven and the new targets will be detected on the next poll.

Poll for versions

Click the Poll for Versions button on the Watched Packages tab. Artifacts will:

  1. Fetch maven-metadata.xml from the Maven source for each watched package
  2. Compare discovered versions against existing builds
  3. For each new version, create a build record and start the build automatically

The Builds tab shows the status of each build:

Status Meaning
pending Build record created, waiting to start
queued Build queued, starting shortly
building Build in progress
success JS and XCFramework built and published
failed Something went wrong (check the error message)

Each build also shows npm and Swift publication flags, so you can see which outputs have been uploaded.

Consuming the generated packages

Once a build succeeds, the packages are available through the standard proxies:

npm

npm config set @kmp:registry https://artifacts.premex.se/api/npm/YOUR_KMP_REPO/
npm install @kmp/my-library

Swift Package Manager

swift package-registry set https://artifacts.premex.se/api/swift/YOUR_KMP_REPO/

Then add the dependency in Package.swift:

dependencies: [
    .package(id: "kmp.my-library", from: "1.0.0")
]

Maven (the original library)

The original Maven artifacts remain in the source Maven repository. The KMP repo only generates the JS and Swift outputs.

Next steps

  • Publish a KMP Library — Set up the Maven publishing side of the pipeline
  • API Tokens — Create scoped tokens for npm and Swift consumers with read-only access
  • Team Access — Invite collaborators to your KMP repository