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 🙏

© 2025 – Pkg Stats / Ryan Hefner

pgnx

v1.0.5

Published

High-performance PostgreSQL driver for Node.js using libpqxx and N-API

Readme

PGNX - High-Performance PostgreSQL Driver

npm version

License

High-performance PostgreSQL driver for Node.js using libpqxx and N-API. Drop-in replacement for pg with 2-5x better performance.

Features

  • 🚀 2-5x faster than node-postgres
  • 🔄 Connection pooling with health checks
  • ⚡ Async operations with Promises
  • 🎯 Prepared statements
  • 📦 Query pipelining
  • 🔔 LISTEN/NOTIFY support
  • 🛡️ TypeScript definitions
  • ♻️ Auto cleanup (5 min idle timeout)
  • 🌍 Cross-platform (Linux, macOS, Windows)
  • 📦 Prebuilt binaries included

Installation

npm install pgnx

That's it! Prebuilt binaries included for Linux, macOS, and Windows. No dependencies needed!

Quick Start

const { Connection } = require('pgnx');

// Create connection
const conn = new Connection('postgresql://user:pass@localhost/db', 10);

// Query
const users = await conn.query('SELECT * FROM users WHERE age > $1', [18]);

// Prepared statements
conn.prepare('getUser', 'SELECT * FROM users WHERE id = $1');
const user = await conn.execute('getUser', [1]);

// Pipeline
const results = await conn.pipeline([
  'UPDATE users SET active = true WHERE id = 1',
  'UPDATE users SET active = true WHERE id = 2'
]);

// LISTEN/NOTIFY
conn.listen('events', (payload) => console.log('Event:', payload));

// Cleanup
conn.close();

API

new Connection(connectionString, poolSize?)

Create connection pool.

  • connectionString: PostgreSQL connection string
  • poolSize: Pool size (default: 10)

query(sql, params?): Promise<Array>

Execute query with optional parameters.

prepare(name, sql): void

Prepare named statement.

execute(name, params?): Promise<Array>

Execute prepared statement.

pipeline(queries): Promise<Array<number>>

Execute multiple queries, returns affected row counts.

listen(channel, callback): void

Listen for notifications.

unlisten(channel): void

Stop listening.

close(): void

Close all connections.

TypeScript

import { Connection } from 'pgnx';

interface User {
  id: number;
  name: string;
}

const conn = new Connection('postgresql://localhost/db');
const users = await conn.query<User>('SELECT * FROM users');

Performance

| Operation | pg | pgnx | Improvement | |-----------|-----|------|-------------| | Simple Query | 15ms | 6ms | 2.5x | | Prepared Statement | 12ms | 5ms | 2.4x | | Pipeline (3 queries) | 45ms | 18ms | 2.5x |

Migration from pg

Before:

const { Client } = require('pg');
const client = new Client('postgresql://localhost/db');
await client.connect();
const result = await client.query('SELECT * FROM users');
console.log(result.rows);
await client.end();

After:

const { Connection } = require('pgnx');
const conn = new Connection('postgresql://localhost/db');
const users = await conn.query('SELECT * FROM users');
console.log(users);
conn.close();

Requirements

  • Node.js >= 18.0.0
  • PostgreSQL server (for runtime connection)

No build tools or system dependencies required!

License

Apache License 2.0

Links