Debugging local database state on Android often requires tethering the device to Android Studio to use the App Inspection tab. However, when QA engineers or developers are testing in the field, verifying whether an offline sync job or local caching mutation wrote the correct database records is impossible without desktop access.
compose-room-inspector is an on-device SQLite & Room database inspector featuring live table browsing, schema introspection, and an interactive raw SQL console with query timing.
🏗️ Architecture & Security Model
-
Zero Schema Boilerplate: Automatically introspects all tables, column types, and primary key (
🔑) constraints at runtime using SQLite pragmas. - 2D Virtualized Grid: Horizontally and vertically scrollable table viewer with sticky column headers and real-time column search.
-
SQL Console with Execution Profiling: Execute ad-hoc queries with an execution time badge (e.g.
⚡ 14 ms) to verify query efficiency. - 1-Tap Export: Copy table records as structured CSV or JSON to the clipboard for bug reports.
🛠️ Step-by-Step Implementation Guide
1. Add Gradle Dependency
dependencies {
// Debug builds: in-app SQLite & Room inspector overlay
debugImplementation("io.github.zakayothuku:compose-room-inspector:1.0.0")
// Release builds: zero-overhead no-op artifact
releaseImplementation("io.github.zakayothuku:compose-room-inspector-noop:1.0.0")
}
2. Register Your Database Instance
In your Application class or Dependency Injection module:
@Provides
@Singleton
fun provideAppDatabase(@ApplicationContext context: Context): AppDatabase {
val database = Room.databaseBuilder(
context,
AppDatabase::class.java,
"app_commerce.db"
).build()
// Register database with the inspector in debug builds
if (BuildConfig.DEBUG) {
ComposeRoomInspector.register(
name = "Commerce DB",
database = database.openHelper.writableDatabase
)
}
return database
}
3. Display the Inspector Overlay
@Composable
fun AppRoot() {
Box(modifier = Modifier.fillMaxSize()) {
MainNavigation()
if (BuildConfig.DEBUG) {
ComposeRoomInspectorOverlay()
}
}
}
👉 GitHub Repository: github.com/zakayothuku/compose-room-inspector

Top comments (0)