</>PackageGraphPackageGraph

pg

npmv8.23.0

PostgreSQL client - pure javascript & libpq with the same API

Safe to adopt

Yes — pg scores well across adoption, maintenance, weight, supply chain, and licensing. 46.3M downloads per week and 5 known dependents. Last published 32 days ago. 26 releases in the last 2 years.

  • AAdoption: grade A, Excellent.

    46.3M downloads per week and 5 known dependents.

  • AMaintenance: grade A, Excellent.

    Last published 32 days ago. 26 releases in the last 2 years.

  • BWeight: grade B, Good.

    Pulls in 6 transitive packages, about 372 KB installed (at least — some of the tree is still being crawled).

  • BSupply chain: grade B, Good.

    This package has a single maintainer (bus factor of 1).

  • ALicense: grade A, Excellent.

    MIT — permissive, with no copyleft found in the dependency tree.

Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.

Install cost

What you actually take on by adding pg to a project.

6
Direct dependencies

Runtime packages this one declares itself.

6
Total installed

Distinct packages in the full runtime tree, deduplicated the way a package manager would.

372 KB
Install size

Unpacked size of this package plus its entire runtime tree.

1
Tree depth

Longest resolved dependency chain below this package.

Part of this dependency tree has not been crawled yet, so these figures are a lower bound rather than a final total.

Licenses in the dependency tree

MIT

Every license you inherit by installing pg, not just its own. Check this before a legal review, not after.

Compatibility

Node.js
node >= 16.0.0
Module format
ESM + CommonJS
TypeScript
No bundled types
Install scripts
None

pg vs the alternatives

Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.

PackageWeekly downloadsDependentsLicenseLast release
pgthis page46.3M5MIT1 month ago
postgres01Unlicense1 day ago
drizzle-orm19M0Apache-2.01 day ago
pg-pool43.5M1MIT1 day ago
pgpass33M1MIT1 day ago
knex01MIT1 day ago

Dependencies

Declared by pg v8.23.0. Runtime dependencies are installed with the package; dev dependencies are not.

Dev (9)

@cloudflare/vitest-pool-workers 0.8.23@cloudflare/workers-types ^4.20230404.0async 2.6.4bluebird 3.7.2co 4.6.0pg-copy-streams 0.3.0typescript ^6.0.3vitest ~3.0.9wrangler ^3.x

Used by

Popular packages that depend on pg.

Relationship graph

Dependencies (left) and dependents (right) of pg.

Frequently installed together

Release history

24 releases in the last two years, typically about 7 days apart.

Recent versions of pg
VersionPublishedSizeLicense
8.23.0latest1 month ago98 KBMIT
8.22.02 months ago93 KBMIT
8.21.03 months ago91 KBMIT
8.20.06 months ago90 KBMIT
8.19.06 months ago90 KBMIT
8.18.07 months ago89 KBMIT
8.17.27 months ago88 KBMIT
8.17.17 months ago88 KBMIT
8.17.07 months ago88 KBMIT
8.16.31 year ago86 KBMIT
8.16.21 year ago86 KBMIT
8.16.11 year ago86 KBMIT
8.16.01 year ago86 KBMIT
8.15.61 year ago86 KBMIT
8.15.51 year ago86 KBMIT

Overview

pg is an npm package that postgreSQL client - pure javascript & libpq with the same API. It is extremely widely used, with about 46.3M downloads per week and 5 known dependents in the graph. The latest version is 8.23.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 (46.3M 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.

Maintainers

Keywords

Frequently asked questions

Should I use pg?

Yes — pg scores well across adoption, maintenance, weight, supply chain, and licensing. 46.3M downloads per week and 5 known dependents. Last published 32 days ago. 26 releases in the last 2 years.

How do I install pg?

Run `npm install pg` to add pg to your npm project.

How many dependencies does pg have?

pg declares 17 direct dependencies and pulls in 6 packages in total once its runtime tree is resolved totalling about 372 KB on disk.

What license is pg released under?

pg is distributed under the MIT license.

How popular is pg?

pg has approximately 46,345,814 downloads per week and 5 known dependent packages.

Is pg still maintained?

The most recent release of pg (v8.23.0) was published 1 month ago.

Does pg run install scripts?

No. pg does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.