Getting Started¶
Livewire has two halves: a client library you add to your app, and a host app you run on your desktop. This guide walks through both.
1. Add the client to your app¶
Add the client library to your app's dependencies:
dependencies {
// Core SDK for integrating into your app
implementation("com.livewire-kt.livewire:client:<version>")
// SQLite Database Viewer
implementation("com.livewire-kt.livewire:plugin-database:<version>")
// Network Viewer
implementation("com.livewire-kt.livewire:plugin-network-core:<version>")
implementation("com.livewire-kt.livewire:plugin-network-ktor:<version>") // if using ktor
implementation("com.livewire-kt.livewire:plugin-network-okhttp:<version>") // if using okhttp
// Preferences Viewer (SharedPreferences, DataStore, NSUserDefaults)
implementation("com.livewire-kt.livewire:plugin-preferences:<version>")
// Jetpack Compose Recomposition Viewer
implementation("com.livewire-kt.livewire:plugin-recomposition:<version>")
}
The client library ships as a Kotlin Multiplatform artifact with Android, iOS, and JVM targets — add it to commonMain in a KMP project, or directly to an Android app.
2. Create and start a client¶
Create a LivewireClient, install the plugins you want, and start it:
val livewireClient = LivewireClient {
install(DatabasePlugin(context))
install(NetworkPlugin())
install(PreferencesPlugin(context))
install(MyCustomPlugin())
}
livewireClient.start()
start() begins broadcasting a discovery packet so the host can find your app, and connects to the host once one is listening. Call stop() to shut it down.
Recommendation: debug builds only
Livewire is a development tool. Gate it behind a debug source set or a build-type check so the server never ships in a release build.
3. Run the host¶
macOS:
or
Until publishing is configured for other platforms, you may run the host app from source:
4. Connect¶
With your app running on a connected device, emulator, or the same machine, the host discovers it automatically:
- Android — devices and emulators visible to
adb devices - iOS — devices connected over USB, simulators connected through localhost
- Desktop — Livewire apps running on the same machine
Select your app in the host's device list to connect. The host performs an encrypted handshake and your installed plugins appear as panels, live.
Next steps¶
- Browse the existing plugins you can install today
- Learn how to build your own plugin
- Curious what's on the wire? See Connections