Skip to content

britors/Prisma4Postgres

Repository files navigation

Prisma4Postgres

Release License Issues AUR

Prisma4Postgres is a standalone Electron desktop app for exploring and managing PostgreSQL databases. No VS Code required, no CLI wrappers, no config files — just connect and explore.


Download latest release

⬇ Download

👉 GitHub Releases — download the latest version

Platform File
🪟 Windows .exe (NSIS installer)
🐧 Linux (Debian/Ubuntu) .deb
🐧 Linux (Fedora/RHEL) .rpm
🐧 Linux (Arch/Manjaro) AUR: prisma4postgres-bin

Features

Explorer (left sidebar)

  • Tree view of all schemas, tables, views, and functions
  • Folder icons matching OpenBase.Icons style — open/closed per node state
  • Column details with PK / FK badges and data types
  • Estimated row count badges (optional, configurable)
  • Real-time filter/search across tables and columns
  • Drag handle to resize the sidebar
  • Double-click a connection to connect to the database
  • Double-click a table to open its detail tab
  • Create Table icon on each connected connection — opens the visual table creator pre-wired to that database

SQL Query Editor

  • Monaco editor with SQL syntax highlighting and live autocomplete
  • Multi-tab queries — each tab shows an SQL file icon + name
  • Ctrl+Enter or F8 to run (runs selection if text is selected)
  • Ctrl+T to open a new query tab from anywhere in the app
  • Shift+Alt+F to format SQL (keywords uppercase, clause newlines)
  • Connection selector per tab
  • Resizable split between editor and results (drag handle)
  • Cancel button stops a running query via pg_cancel_backend
  • Auto-reconnect on connection drop (retries once silently)

SQL Command Bar (line editor)

  • Compact sql> input bar — toggle with the button in the toolbar
  • Enter executes immediately against the active connection
  • ↑ / ↓ navigates a 20-entry command history
  • Escape clears the field
  • Visibility persisted across sessions

Results

  • Result grid with NULL highlighting
  • Click any row to open a key:value detail panel on the right
  • Copy results as CSV, JSON, or Markdown to clipboard (no dialog)
  • Export results as CSV or JSON via save dialog

EXPLAIN Plan Viewer

  • One-click EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) via Explain button
  • Expandable node tree with cost, actual time, and row counts
  • Expensive nodes highlighted (Seq Scan, high relative cost)
  • Toggle between tree view and raw JSON

Schema Inspection

  • Full DDL viewer with Monaco read-only (CREATE TABLE reconstructed from pg_catalog)
  • Indexes & constraints panel (size, type badges, definitions)
  • FK Map — outgoing and incoming foreign keys, click to navigate tree

Table Detail Tab

  • Per-table tabs opened from the Explorer (icon or double-click)
  • Columns with full type, nullable, default, PK / FK badges
  • Constraints, indexes with size, and FK map sections
  • Run SELECT — opens a pre-filled query in the editor
  • Copy model — generates a Prisma model {} block for the table and copies to clipboard

Visual Table Creator

  • GUI form to define a new table — no SQL required
  • Column editor: name, type (20 PostgreSQL types), length, nullable, default, PK
  • Live CREATE TABLE SQL preview as you type
  • Copy SQL copies the DDL to clipboard
  • Execute runs against the selected database and refreshes the Explorer on success
  • Accessible from the Create Table icon on any connected connection

Activity Viewer

  • Activity tab shows live pg_stat_activity for the selected connection
  • Auto-refreshes every 5 seconds (toggle checkbox)
  • Long-running queries highlighted (> 5s amber, > 30s red)
  • Cancel individual queries per row via pg_cancel_backend

Query History

  • Last 50 queries, searchable, click to restore in editor

Keyboard Shortcuts

Shortcut Action
Ctrl+Enter Run query (or selection)
F8 Run query (or selection)
Ctrl+T New query tab
Shift+Alt+F Format SQL
Ctrl+Z / Ctrl+Y Undo / Redo in editor

Getting Started

Add a connection

  1. Click + in the Explorer sidebar header
  2. Fill in host, port, database, user, and optional password
  3. Click Test to verify connectivity, then Save

Connect and explore

  • Double-click a connection to connect, or click the plug icon
  • Expand the tree: schema → Tables & Views → columns
  • Double-click a table to open its detail tab

Run a query

  1. Switch to the Query tab
  2. Select your connection from the dropdown
  3. Write SQL and press F8 (or Ctrl+Enter)
  4. Results appear in the bottom pane; drag the divider to resize
  5. Click any row to see its full key:value breakdown on the right
  6. Use the clipboard copy buttons (CSV / JSON / MD) or Export to save to file

Quick queries — line editor

Toggle the sql> bar with the button in the query toolbar. Type a statement, press Enter to run. Use ↑ / ↓ to browse history.

Create a table visually

Click the table icon () on any connected connection in the Explorer. Fill in the column form, check the live SQL preview, and click Execute.

View EXPLAIN

With a SELECT query in the editor, click Explain to see the full query plan tree with cost and timing for each node.

Monitor active queries

Switch to the Activity tab, select a connection, and click Refresh (or enable auto-refresh). Long-running queries are highlighted; click Cancel to stop them.


Settings

Settings are stored in the app's user-data directory (userData/settings.json).

Setting Default Description
queryTimeout 30000 Query timeout (ms)
defaultPort 5432 Pre-filled port for new connections
defaultSsl false SSL enabled by default for new connections
showRowCount false Show estimated row count badges in the Explorer

Passwords are encrypted with electron.safeStorage and stored separately in userData/passwords.json.


Layout

Prisma4Postgres — Explorer sidebar and SQL query editor

  • Left sidebar always visible, drag handle to resize (160–600 px, persisted)
  • Right area holds Query, History, Activity tabs + dynamic table detail tabs
  • Query/Results split resizable (default 50/50, persisted per session)
  • Row detail panel slides in on the right when you click a result row

Development

Prerequisites

  • Node.js 20+ (via nvm recommended)
  • npm

Setup

git clone https://github.com/britors/Prisma4Postgres.git
cd Prisma4Postgres
npm install

Run in development

npm run dev

Run tests

npm test

46 unit tests covering PgConnection validation, PrismaParser, and ConnectionManager.

Build for distribution

npm run package

Produces an AppImage (Linux), dmg (macOS), or NSIS installer (Windows) in dist/.


Tech Stack

Layer Technology
Shell Electron 29
Language TypeScript 5
DB driver node-postgres (pg)
SQL editor Monaco Editor 0.45 (CDN)
Icons OpenBase.Icons style (inline SVG)
Theme OpenBase.Theme colors
Build esbuild
Tests Node built-in node:test + tsx

Contributing

See CONTRIBUTING.md for setup instructions, architecture overview, and coding guidelines.

Found a bug or have a feature request? Open an issue.


License

MIT © Rodrigo Brito

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages