# node-postgres: 8.7 out of 10

A strong pick. 1st of 10 in [Database drivers](https://elestia.ai/opensource/db-drivers/index.md).

node-postgres (pg) is the standard PostgreSQL client for Node.js. It is mature and still gets new features, such as ESM support in 8.15 and query pipelining in 8.23. It is the safest default for a new Postgres project, and Postgres.js is the main alternative for teams that want a tagged-template API.

**Best for:** Any Node.js team that talks to PostgreSQL and wants the most widely supported driver that works with any ORM or query builder.

## Scores

- **Overall: 8.7** (likely 7.6 to 9.3)
  - Claude Opus 5.5 (8.5): pg is the default Postgres driver for Node.js. It is deep, maintained, compatible with almost every ORM and growing faster than the median. Postgres.js offers a nicer API and the Neon driver suits serverless edge runtimes, but for most new Postgres projects pg remains the safest choice. Bundled TypeScript types and a smaller backlog would push it higher.
  - GPT-6.2 Sol (8.8): For a new Node.js service using PostgreSQL, `pg` combines a mature query API, regular releases, and integration support from Prisma and Cloudflare. Postgres.js is a strong peer for teams that want built-in types, tagged SQL, and a transaction helper. Manual transaction handling and uneven repository security controls keep the recommendation below the top of the scale.
- **Needed by many: 6.1** (likely 5.1 to 7.2)
  - Claude Opus 5.5 (6.0): Most back-end and full-stack JS developers need a database driver, and PostgreSQL is the most popular relational database for new projects. Still, pg serves only Postgres and Node-like runtimes, so it is narrower than the whole category. Many of its users reach it through an ORM.
  - GPT-6.2 Sol (6.2): PostgreSQL serves a large share of backend developers, and production telemetry shows growing Node.js use with it. The driver also supports Bun, Deno, and Cloudflare Workers, although its scope is limited to PostgreSQL. The survey leaves the share of JavaScript and TypeScript teams that choose a low-level PostgreSQL driver uncertain.
- **Helps a lot: 8.3** (likely 7.3 to 9.3)
  - Claude Opus 5.5 (8.0): It is feature-complete and well tested: pooling, a pure-JS client plus an optional libpq binding, SSL and SCRAM options, a per-query timeout, ESM support, and now pipelining with a measured 1.5-2.4x throughput gain. In an independent benchmark the pure-JS client was slightly faster than Postgres.js. It loses points because its types come from DefinitelyTyped and its API is less ergonomic than Postgres.js.
  - GPT-6.2 Sol (8.6): Stable `pg` 8.23.1 covers pooled parameterized queries, streaming, and opt-in pipelining. The docs give coding agents clear examples, but a transaction still requires correct connection handling and TypeScript row types are supplied separately. Postgres.js offers a transaction helper and bundled types. An independent benchmark found `pg` competitive on an earlier 8.x build, so performance on current workloads remains uncertain.
- **Holds up over time: 8.1** (likely 7.0 to 9.1)
  - Claude Opus 5.5 (8.0): The project has been active for 16 years. It had 114 commits and 10 npm releases in the last year, still ships new features, and supports Node 26. The 8.x line has avoided breaking changes. The main risks are a large open backlog and a release process that depends on a small core team led by the original author.
  - GPT-6.2 Sol (8.2): The repository logged 114 commits and npm received 10 versions in the past year. Sponsorship and steady additions within v8 support continued maintenance. The open issue and pull request backlog, unclear release ownership, and planned removal of the internal query queue in v9 leave some uncertainty about response times and upgrade effort.
- **Used widely: 8.5** (likely 7.5 to 9.5)
  - Claude Opus 5.5 (9.0): It has about 390M downloads in 4 weeks, up from 47M a year ago. That ratio of 8.3 is twice the 4.1 median, and pg leads the category in downloads. Many of those downloads come through ORMs and CI, but its 273k dependent repos show that a very large number of projects choose it directly.
  - GPT-6.2 Sol (8.0): Ecosyste.ms found 273,357 dependent repositories, far more than for Postgres.js and fewer than for the MongoDB driver. Four-week downloads grew 8.3 times year over year, above the 4.1 times catalog median but behind Postgres.js at 29.1 times. Repeat CI installs and dependencies such as Prisma’s adapter inflate download counts, so the pace of direct adoption is harder to estimate.
- **Vouched for: 8.3** (likely 7.3 to 9.3)
  - Claude Opus 5.5 (8.0): The major ORMs and query builders (Drizzle, Kysely, Knex, TypeORM, Sequelize, Prisma's pg adapter) build on it, and the Neon driver keeps its API. Independent benchmarks and write-ups recommend it for robust workloads. Survey data that names pg itself is thin.
  - GPT-6.2 Sol (8.6): Prisma ORM 7 uses `pg` for its standard PostgreSQL adapter, Cloudflare recommends it for Hyperdrive, and Medplum ships it in its server. Independent testing found competitive performance on one workload. Driver-specific satisfaction data is scarce, and users have reported a shutdown regression on Cloudflare Workers.
- **Safe: 7.6** (likely 6.5 to 8.6)
  - Claude Opus 5.5 (8.0): There is only one advisory, a 2018 remote-code-execution bug that was fixed quickly, and none in the last 24 months. It pulls in about six small dependencies, mostly its own pg-* packages, and uses the MIT licence. Its OpenSSF Scorecard of 5.7 shows gaps: no security policy, no branch protection, unpinned dependencies and no SAST.
  - GPT-6.2 Sol (7.1): The package uses the permissive MIT license and has five required dependencies plus one optional dependency. The maintainer shipped fixes for the old critical advisory on the day it was reported, and the collector found zero new advisories for `pg` in the last two years. OpenSSF scored the repository 5.7, with gaps in branch protection, dependency pinning, fuzzing, and security policy. Release provenance and the number of authorized publishers remain unverified.

## Good

- Drizzle, Kysely, Knex, TypeORM, Prisma's pg adapter and many other tools build on it, so it fits almost any stack.
- It has a complete feature set: pooling, parameterized and prepared queries, cursors, LISTEN/NOTIFY, SCRAM with channel binding, an optional libpq binding and, since 8.23, opt-in pipelining.
- The 8.x line has stayed compatible for years, so upgrades rarely break code.
- Docs and examples are everywhere, so AI coding agents usually write correct code for it.

## Bad

- Types are not shipped in the package; you install @types/pg from DefinitelyTyped, and those types can drift from the code.
- The API is older and more verbose than Postgres.js, whose tagged templates make queries both safe and short.
- The backlog is large, with about 470 open issues and 126 open pull requests, and some pool edge cases (stale connections after failover) come up again and again.
- Its OpenSSF Scorecard is a middling 5.7, with no security policy, no branch protection and unpinned dependencies.

## The numbers

- Downloads, 4 weeks: 390M
- In a year: ×8.3
- GitHub stars: 13k
- Commits, 12 months: 114
- Last npm release: Sept 2026
- Advisories, 24 months: 0
- Licence: MIT
- GitHub: https://github.com/brianc/node-postgres
- npm: https://www.npmjs.com/package/pg

Scores run from 0 to 10 and are the mean of the scores of AI reviewers (Claude Opus 5.5, GPT-6.2 Sol), made on 22 November 2026 from GitHub, npm, OSV, OpenSSF Scorecard, ecosyste.ms, Hacker News and Bluesky data and a web search. The ecosyste.ms count of repositories that use a project is far too low for projects that grew in the last few years, and some reviews quote it. Overall is the reviewers' own judgement for a new project today, not an average of the parts. An AI wrote them and can be wrong.
