A lightweight PostgreSQL database explorer for quick data viewing.
- Install dependencies:
npm install- Run the development server:
npm run dev- Next.js 14 (App Router)
- TypeScript
- Tailwind CSS
- PostgreSQL (pg)
db-explorer/
├── app/
│ ├── api/ # API routes for database operations
│ ├── components/ # React components
│ ├── globals.css # Global styles
│ ├── layout.tsx # Root layout
│ └── page.tsx # Home page
├── lib/ # Utility functions and database connections
└── types/ # TypeScript type definitions
- Database connection management
- Table listing
- Browse table data
- Simple query executor
- Search and filter
Create a .env.local file:
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=your_database
POSTGRES_USER=your_username
POSTGRES_PASSWORD=your_password
The tauri-spike branch wraps this app as a native desktop binary so users' DB credentials never leave their machine. The Rust side (in src-tauri/) holds tokio-postgres connections; the Next.js UI loads in the Tauri webview and talks to Rust via invoke().
Migration plan from spike → v1: docs/tauri-migration.md.
| OS | Required |
|---|---|
| macOS | Rust (brew install rustup-init && rustup-init), Xcode CLT (xcode-select --install) |
| Windows | Rust (rustup-init.exe), Microsoft C++ Build Tools (Desktop C++ workload), WebView2 (preinstalled on Win10/11) |
| Linux (incl. WSL2) | Rust (rustup), libwebkit2gtk-4.1-dev libsoup-3.0-dev librsvg2-dev libayatana-appindicator3-dev libxdo-dev |
pnpm install
pnpm tauri:devThe script starts next dev -p 3030, compiles the Rust binary, and opens a native window pointed at http://localhost:3030/tauri-test (the spike test page).
WebKitGTK + WSLg is fragile: window draws but the WebView surface can render as 1×1 pixels. The tauri:dev script already sets the known stabilizers (WEBKIT_DISABLE_DMABUF_RENDERER=1 WEBKIT_DISABLE_COMPOSITING_MODE=1 LIBGL_ALWAYS_SOFTWARE=1). If the window still won't render, build/run from the host OS (Mac, Windows PowerShell) instead — same repo, different toolchain.
- src-tauri/src/lib.rs — Tauri commands:
db_connect,db_query,db_disconnect. Session-keyed connection store viaDashMap. - src-tauri/src/postgres.rs —
tokio-postgresclient + type-aware row → JSON serialization (bool, int2/4/8, float4/8, text, json/jsonb, uuid, timestamp/tz, date, numeric). - app/tauri-test/page.tsx — spike UI that calls
invoke('db_connect', { config })andinvoke('db_query', { sessionId, sql }).
For the production app, the SaaS at justdb.kreativekorna.com keeps the existing Next.js API routes; the desktop build uses the Rust commands instead.