npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@indiekitai/pg-toolkit

v0.2.1

Published

Unified CLI for all IndieKit PostgreSQL tools — inspect, diff, top, health, types

Readme

pg-toolkit

The PostgreSQL Swiss Army knife for TypeScript developers.

One CLI to diagnose, inspect, diff, monitor, and generate types for your Postgres databases.

🔍 20+ health checks with scoring and auto-generated fix SQL 🔄 Schema diff that outputs ready-to-run migration SQL 🤖 AI-agent ready via MCP — plug into Claude, Cursor, or any MCP client

Quick Start

npx @indiekitai/pg-toolkit doctor postgres://localhost/mydb
🏥 Database Health Report — mydb
Overall Score: 82/100

✅ Cache Hit Ratio .............. 99.2%  (excellent)
⚠️  Unused Indexes .............. 3 found
✅ Connection Usage ............. 12/100
❌ Table Bloat .................. 2 tables need VACUUM
✅ Long Transactions ............ none
✅ Lock Contention .............. clear
⚠️  Vacuum Status ............... 1 table never vacuumed
✅ Slow Queries ................. p95 < 100ms

📋 Fix Script Generated → fix.sql (4 statements)

Commands

doctor — Diagnose, score, fix

Runs 20+ checks against your database, produces a 0–100 health score, and generates executable SQL to fix what it finds.

pg-toolkit doctor postgres://localhost/mydb
pg-toolkit doctor postgres://localhost/mydb --ci --threshold 70   # fail CI if unhealthy
pg-toolkit doctor postgres://localhost/mydb --output fix.sql      # save fixes
pg-toolkit doctor postgres://localhost/mydb --json                # machine-readable

inspect — See everything in your schema

Tables, views, functions, indexes, enums, triggers, constraints, RLS policies — all in one command.

pg-toolkit inspect postgres://localhost/mydb
pg-toolkit inspect --tables --indexes postgres://localhost/mydb
pg-toolkit inspect --summary postgres://localhost/mydb            # just counts

diff — Compare schemas, get migration SQL

Point it at two databases. Get ALTER, CREATE, and DROP statements to migrate one to the other.

pg-toolkit diff postgres://localhost/dev postgres://localhost/prod
pg-toolkit diff --safe postgres://localhost/dev postgres://localhost/prod   # no DROPs
pg-toolkit diff postgres://dev postgres://prod | psql postgres://prod      # apply directly

top — Live activity monitor

Like htop for your database. See active queries, locks, and connection stats in real time.

pg-toolkit top postgres://localhost/mydb
pg-toolkit top --refresh 1 --no-idle postgres://localhost/mydb
pg-toolkit top --snapshot --json postgres://localhost/mydb        # single snapshot

types — PostgreSQL → TypeScript

Generate TypeScript interfaces from your database schema.

pg-toolkit types postgres://localhost/mydb

Programmatic API

import { doctor, inspect, diff } from '@indiekitai/pg-toolkit';

const report = await doctor({ connectionString: 'postgres://localhost/mydb' });
console.log(report.overallScore); // 82
console.log(report.fixes);        // SQL fix statements

const schema = await inspect('postgres://localhost/mydb');

const migration = await diff(devUrl, prodUrl, { safe: true });
console.log(migration.sql); // ALTER TABLE ..., CREATE INDEX ...

AI Agent / MCP

All tools are available as an MCP server. Add this to your agent config:

{
  "mcpServers": {
    "pg-toolkit": {
      "command": "npx",
      "args": ["@indiekitai/pg-toolkit", "mcp"],
      "env": { "DATABASE_URL": "postgresql://localhost/mydb" }
    }
  }
}

Exposes pg_doctor, inspect_schema, diff_schemas, and pg_activity as MCP tools. Works with Claude, Cursor, Windsurf, and any MCP-compatible agent.

How it compares

| Feature | pg-toolkit | pgcli | migra | prisma | |---|---|---|---|---| | Health checks + scoring | ✅ 20+ checks | ❌ | ❌ | ❌ | | Auto-generate fix SQL | ✅ | ❌ | ❌ | ❌ | | Schema inspection | ✅ | ✅ partial | ❌ | ✅ introspect | | Schema diff → SQL | ✅ | ❌ | ✅ | ✅ migrate diff | | Live activity monitor | ✅ | ❌ | ❌ | ❌ | | TypeScript generation | ✅ | ❌ | ❌ | ✅ built-in | | MCP / AI-agent support | ✅ | ❌ | ❌ | ❌ | | CI mode (exit codes) | ✅ | ❌ | ✅ | ✅ | | Single npx command | ✅ | pip install | pip install | npm + config |

pg-toolkit combines what used to require 3–4 separate tools into one npx call.

License

MIT