OSS TanbouSign in with GitHub

connect Node.js directly to PostgreSQL with pools, parameterized queries, and LISTEN/NOTIFY

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
13,218
Primary language
JavaScript
License
MIT
Repository last updated
Oct 1, 2026
On this page

Overview

node-postgres is a collection of PostgreSQL clients for Node.js. Its main pg package provides a pure JavaScript client and optional native libpq bindings behind the same API, with connection pooling, parameterized queries, prepared statements, LISTEN/NOTIFY, and COPY support.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Build PostgreSQL access around pools and parameterized queries

pg and pg-pool provide pooled connections and parameterized queries so values can be sent separately from SQL text instead of being concatenated into statements.

Sources: [1][2]

Use prepared statements, LISTEN/NOTIFY, COPY, and PostgreSQL type handling

The client supports named statements with plan caching, asynchronous notifications, COPY import/export, and extensible JavaScript/PostgreSQL type coercion.

Sources: [1]

Best fit

Fits Next.js Node runtimes and backend services that want direct PostgreSQL control

It is useful when teams want SQL and connection-pool control closer to PostgreSQL rather than through a higher-level ORM. The monorepo also includes runtime-related packages for other JavaScript environments.

Sources: [1][2]

Before adoption

Design pool lifecycle and connection limits explicitly for serverless deployments

Creating a new pool per request can exhaust database connections. Next.js and serverless deployments should define module-level reuse, provider-side pooling, and transaction requirements deliberately.

Sources: [1]

The current pg 8.23.1 package requires Node 16 or newer

The current master package metadata reports pg 8.23.1 with a Node.js 16+ engine requirement. Check the target runtime and optional native-binding requirements before deployment.

Sources: [2]

Official sources

  1. [1]node-postgres README(2026-10-06)
  2. [2]pg 8.23.1 package metadata(2026-10-06)
  3. [3]node-postgres MIT license(2026-10-06)
Supplemental curator note

It fits Node.js backends that want lower-level PostgreSQL control than an ORM. In Next.js and serverless environments, design pool reuse and connection limits explicitly.

Try it in 3 steps

  1. 1

    Get the source

    git clone --depth 1 https://github.com/brianc/node-postgres.git
  2. 2

    Enter the repository

    cd node-postgres
  3. 3

    Check the official steps

    Continue with the commands in the README Installation, Quick Start, or Getting Started section.

    find . -maxdepth 1 -iname 'README*' -exec sed -n '1,220p' {} \; -quit
Check the official README

Growth

Growth trends · Last 30 days

13,218 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
10
Open PRs
89

Development activity is still being collected.

Built with

Categories and tags

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • postgresql
  • postgresql-driver
  • node-postgres
  • postgres
  • libpq
Stars
13,218
Forks
1,357
Watchers
179
Open issues
451
Contributors
335
Owner type
User
Primary language
JavaScript
License
MIT
Repository last updated
Oct 1, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?