Skip to content

macss-dev/sqlite-inspector-vscode

Repository files navigation

SQLite Inspector

Alternative to Android Studio’s Database Inspector — lighter, portable, and independent of any IDE.
Inspect and query your on-device SQLite databases directly from VS Code, with real-time access through an embedded HTTP server.

Visual Studio Marketplace License


✨ Overview

This VS Code extension lets you connect to a running Flutter or Dart app and inspect its local SQLite database as if it were on your desktop.

It works by connecting (via ADB or TCP) to a lightweight HTTP server provided by the sqlite_inspector Dart package, which exposes a REST API for SQLite operations.
The extension automatically lists databases, tables, and schemas, and allows you to run SQL queries, view results, and export them to CSV — all inside VS Code.

Use cases

  • Debugging local persistence in Flutter apps.
  • Exploring on-device data without pulling .db files.
  • Replacing Android Studio’s Database Inspector with a cross-platform, open-source alternative.

🧩 Architecture


┌────────────────────┐       ┌─────────────────────────┐
│   VS Code (host)   │──────>│ sqlite_inspector server │
│  sqlite-inspector  │<──────│ (on device / emulator)  │
└────────────────────┘ HTTP  └─────────────────────────┘
    ▲
    │   adb forward tcp:7111 tcp:7111
    │
  Flutter app (debug)

  • VS Code extension → handles UI (Explorer, Console, Results Panel).
  • Dart package → runs a local HttpServer (SqliteInspector.start()).
  • ADB → forwards the TCP port (7111 by default) to the device.

🚀 Quick start

1️⃣ In your Flutter app

Add the Dart package to your app:

dependencies:
  sqlite_inspector: ^0.0.1

Then enable it only in debug mode:

import 'package:flutter/foundation.dart';
import 'package:sqlite_inspector/sqlite_inspector.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  if (kDebugMode) {
    await SqliteInspector.start(); // Default port 7111
  }

  runApp(const MyApp());
}

2️⃣ Forward the port with ADB

adb forward tcp:7111 tcp:7111

Check that the server responds:

curl http://127.0.0.1:7111/v1/health

3️⃣ Connect from VS Code

  1. Open VS Code → Command Palette (Ctrl + Shift + P / Cmd + Shift + P).
  2. Run SQLite Inspector: Connect (ADB).
  3. Choose your connected device.
  4. Explore your database and run queries!

🧭 Features

Category Description
🔌 ADB Connection Detects devices, forwards port 7111, connects via HTTP.
🗃️ Explorer View Lists databases → tables → columns.
📋 SQL Console Run queries directly (Ctrl + Enter).
📊 Result Panel Table view for query results (auto-scroll, sticky headers).
💾 Export / Copy CSV Save or copy query results.
🔒 Safe defaults Loopback-only, DDL disabled by default, optional token.
⚙️ Custom settings Port, token, page size, auto-refresh interval.

🧰 Settings

Setting Default Description
sqliteInspector.port 7111 Forwarded port for the HTTP server.
sqliteInspector.token "" Optional x-debug-token for auth.
sqliteInspector.pageSize 200 Default row limit for SELECT *.
sqliteInspector.autoRefresh false Future use — auto-refresh based on PRAGMA data_version.

All settings can be modified in Settings → Extensions → SQLite Inspector.


💾 Commands

Command Action
SQLite Inspector: Connect (ADB) Connect to a debug device.
SQLite Inspector: Disconnect Stop connection and clear state.
SQLite Inspector: Run Selection Execute selected SQL (Ctrl + Enter).
SQLite Inspector: Toggle DDL Allow schema modifications temporarily.
SQLite Inspector: Export CSV Save current result to a .csv file.
SQLite Inspector: Copy CSV Copy last result to clipboard.
SQLite Inspector: Refresh Tree Reload database list and tables.

🧠 Works great with Flutter

Although designed for Flutter developers, the system is generic. Any app that can start an HTTP server exposing the same REST API as sqlite_inspector will work — including Dart CLI tools, desktop apps, or even IoT devices.

The extension doesn’t depend on Flutter tooling; it only needs an HTTP endpoint.


🔭 Roadmap

  • Multi-platform support (Android, Desktop, iOS via iproxy).
  • Live refresh via PRAGMA data_version.
  • WebSocket streaming.
  • Secure channel & token rotation.
  • Possible Flutter Web proxy mode.

🧾 License

  • This extension is licensed under the MIT License © 2025 Cristian Cisneros.
  • Portions of code (Explorer structure, Results Panel rendering, CSV export logic) are adapted from AlexCovizzi/vscode-sqlite, licensed under the Apache License 2.0. See NOTICE and LICENSE for details.

🙌 Acknowledgements

  • Alex Covizzi for the original vscode-sqlite inspiration.
  • The Flutter and Dart community for making developer tooling so accessible.
  • Everyone who contributes or reports issues — thank you!

🧩 Links

About

Alternative to Android Studio’s Database Inspector

Resources

License

Stars

Watchers

Forks

Packages

No packages published