If you build a Kotlin Multiplatform app, you probably debug it with Chucker on Android and Pulse on iOS. Both are great at HTTP. But bug reports rarely stop at HTTP: which value did the new_checkout flag have on that device? Did the purchase event go out with the right parameters? What did the app write to SharedPreferences right before it broke? The answer usually lives in a different tool on each platform, or in none.

That's why I built StackAudit: one inspector, the same on every platform, that records more than HTTP. It's free and open source (Apache 2.0).

The StackAudit viewer

What it records

Shake the phone and you get one timeline with:

Source Android iOS KMP Flutter
REST OkHttp URLSession Ktor package:http, Dio
WebSocket OkHttp, Ktor URLSessionWebSocketTask Ktor
Key-value storage SharedPreferences UserDefaults multiplatform-settings
SQL Room, SQLDelight SQLite SQLDelight
Analytics events ✓ ✓ ✓ ✓
Feature flags ✓ ✓ ✓ ✓

Nothing leaves the device. There's no backend: when you need to share a session, export it as HAR, JSONL, CSV or text, or copy a single request as cURL.

Setup

Android

dependencies { debugImplementation("io.github.r1b2ns:stackaudit-android:0.4.3") debugImplementation("io.github.r1b2ns:stackaudit-ui:0.4.3") releaseImplementation("io.github.r1b2ns:stackaudit-noop:0.4.3") } 
class App : Application() { override fun onCreate() { super.onCreate() StackAudit.start() } } val okHttp = OkHttpClient.Builder().audited().build() val prefs = context.auditedSharedPreferences("prefs") val db = Room.databaseBuilder(context, AppDatabase::class.java, "app.db").audited("app.db").build() 

On Android you choose what to record: only the clients and stores you wrap are captured.

iOS (Swift Package Manager, iOS 15+)

.package(url: "https://github.com/r1b2ns/stack-audit", from: "0.4.3") 
import StackAudit @main struct MyApp: App { init() { StackAudit.start() } } 

That one call already captures URLSession requests, WebSocket tasks and UserDefaults.standard, with no other code.

KMP

commonMain.dependencies { implementation("io.github.r1b2ns:stackaudit-core:0.4.3") implementation("io.github.r1b2ns:stackaudit-ktor:0.4.3") implementation("io.github.r1b2ns:stackaudit-ui:0.4.3") } 
val client = HttpClient { install(WebSockets) install(StackAuditKtor) { source = "api" } } val driver = createDriver().audited("app.db") 

The viewer is a Compose Multiplatform screen, so a KMP app gets the same UI on both platforms.

Flutter (beta)

flutter pub add stack_audit 

On iOS, the plugin also records URLSession traffic from native plugins and SDKs, so Dart and native requests show up in the same list.

Design decisions

A debug tool sees everything your app sends: tokens, cookies, passwords, personal data. Most of the design went into making it safe to leave in QA builds.

Mask when writing, not when showing. Secrets are masked before an event is stored. Headers like Authorization and Cookie, query parameters, and fields named password, token and similar are replaced by •••• (plus the last four characters, for long values), in form bodies and in JSON, including JSON encoded inside a string value. Since the raw value is never written, it can't leak through an export, a screenshot or a backup. You can add your own names or allow some through.

Bodies encrypted at rest. Request and response bodies are encrypted with AES-GCM, with the key in the Android Keystore or the iOS Keychain (ThisDeviceOnly).

A hash chain over the log. Each event stores the hash of the previous one, and StackAudit.verify() reports the first broken link. If someone edits the database by hand, you know.

Signed tokens to open the viewer. In Handshake mode, the viewer opens only after it receives a token signed with Ed25519, bound to the app id, valid for at most 24 hours and usable once. A small CLI attached to each release creates the keys and signs tokens, and can produce a deep link you send to a tester. A token with the read_secrets scope lets that tester reveal masked values on the device.

No-op artifacts for release builds. Every capture artifact has a no-op twin with the same API. Release builds compile the same calls and carry no capture code.

Automatic capture on iOS. StackAudit inserts its URLProtocol into the default and ephemeral session configurations, and hooks URLSessionWebSocketTask to record frames, pings and close codes. It sends the app's stored cookies and keeps the ones it receives, so logins work the same with capture on. You can turn this off and wrap sessions by hand instead.

Analytics and feature flags

These are the two things HTTP inspectors can't answer.

Analytics. Wrap the tracker you already call, and every event is recorded and then forwarded:

val tracker = StackAudit.analytics.wrap( AnalyticsTracker { name, params -> firebaseAnalytics.logEvent(name, params.toBundle()) }, provider = "firebase", ) 

Give it a tracking plan in JSON (required and optional parameters, types, strict mode) and each event is marked Valid, Invalid or Not in plan as it's recorded. The plan file can be the same one your product and data teams review.

Feature flags. Read flags through StackAudit and the Flags tab lists every flag the app read, its value and where it came from:

val flags = StackAudit.flags.wrap( FlagProvider { key -> (remoteConfig[key] as? Boolean)?.let { FlagValue.Bool(it) } }, name = "remote_config", ) val newCheckout = flags.bool("new_checkout", default = false) 

From the viewer you can override any flag on the device, and the override survives restarts. Testing the new checkout no longer means changing the remote config for everyone. UI tests can set overrides from code too.

The same APIs exist in Swift and Dart.

What's next

  • Export from code in Swift and Dart, which today is only in Kotlin
  • More capture sources. Tell me which one you need

If you'd like to contribute, there are open issues labeled good first issue and help wanted, such as a Room scenario for the Android sample and a check that the no-op artifacts keep the same public API.

Try it

The repository has sample apps for Android and iOS that exercise every source: github.com/r1b2ns/stack-audit.

If it's useful to you, a star helps other developers find it, and I'd love to hear what you'd want it to record next.