pg
npmv8.22.0PostgreSQL client - pure javascript & libpq with the same API
Overview
pg is an npm package that postgreSQL client - pure javascript & libpq with the same API. It is extremely widely used, with about 36.2M downloads per week. The latest version is 8.22.0, released under the MIT license.
Who should use it
Teams working in the npm ecosystem who need postgreSQL client - pure javascript & libpq with the same API and value a battle-tested, widely-adopted solution.
When not to use it
Consider an alternative if you need to minimize your dependency tree, have first-class TypeScript types out of the box, or if a more actively-maintained option better fits your npm stack.
Pros
- Large, well-established user base (36.2M weekly downloads).
- Clear open-source license (MIT).
Cons
- Large dependency tree (17 direct dependencies) increases install size and audit surface.
- No bundled TypeScript types (may require a separate @types package).
Auto-generated from collected registry metadata. No external claims are inferred.
Relationship graph
Dependencies (left) and dependents (right) of pg.
Dependencies
Runtime (6)
Peer (1)
Dev (9)
Used by
Popular packages that depend on pg.
Connection pool for node-postgres
Module for reading .pgpass
Drizzle ORM package for SQL databases
Type safe SQL query builder
A batteries-included SQL query & schema builder for PostgresSQL, MySQL, CockroachDB, MSSQL and SQLite3
Alternatives to pg
Fastest full featured PostgreSQL client for Node.js
Drizzle ORM package for SQL databases
Connection pool for node-postgres
Module for reading .pgpass
A batteries-included SQL query & schema builder for PostgresSQL, MySQL, CockroachDB, MSSQL and SQLite3
A slightly nicer interface to Postgres over node-libpq
AWS RDS SSL certificates bundles.
Type safe SQL query builder
Low-level native bindings to PostgreSQL libpq
PGlite is a WASM Postgres build packaged into a TypeScript client library that enables you to run Postgres in the browser, Node.js and Bun, with no need to install any other dependencies. It is only 3.7mb gzipped.
Media Type Database
Functions for dealing with a PostgreSQL connection string
Frequently installed together
fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS
The fastest and simplest library for SQLite in Node.js.
TypeScript definitions for pg
TypeScript definitions for better-sqlite3
Asynchronous, non-blocking SQLite3 bindings
TypeScript definitions for node
PGlite is a WASM Postgres build packaged into a TypeScript client library that enables you to run Postgres in the browser, Node.js and Bun, with no need to install any other dependencies. It is only 3.7mb gzipped.
The semantic version parser used by npm.
Lodash modular utilities.
Prettier is an opinionated code formatter
TypeScript Execute (tsx): Node.js enhanced with esbuild to run TypeScript & ESM files
Fastest full featured PostgreSQL client for Node.js
Version history
| Version | Published | License |
|---|---|---|
| 8.22.0latest | 1 month ago | MIT |
| 8.21.0 | 2 months ago | MIT |
| 8.20.0 | 4 months ago | MIT |
| 8.19.0 | 4 months ago | MIT |
| 8.18.0 | 5 months ago | MIT |
| 8.17.2 | 6 months ago | MIT |
| 8.17.1 | 6 months ago | MIT |
| 8.17.0 | 6 months ago | MIT |
| 8.16.3 | 1 year ago | MIT |
| 8.16.2 | 1 year ago | MIT |
| 8.16.1 | 1 year ago | MIT |
| 8.16.0 | 1 year ago | MIT |
| 8.15.6 | 1 year ago | MIT |
| 8.15.5 | 1 year ago | MIT |
| 8.15.2 | 1 year ago | MIT |
| 8.15.1 | 1 year ago | MIT |
| 8.15.0 | 1 year ago | MIT |
| 8.14.2-alpha.1 | 1 year ago | MIT |
| 8.14.2-alpha.0 | 1 year ago | MIT |
| 8.14.1 | 1 year ago | MIT |
Maintainers
Frequently asked questions
How do I install pg?
Run `npm install pg` to add pg to your npm project.
What license is pg released under?
pg is distributed under the MIT license.
How popular is pg?
pg has approximately 36,210,333 downloads per week.