JavaScript PostgreSQL driver with pooling, prepared statements, streaming, and optional native libpq bindings for Node.js, Bun, Deno, and Cloudflare Workers.
Overview
node-postgres is a family of Node.js packages for talking to PostgreSQL from application code. The core pg module offers a non-blocking client with callbacks, promises, and async/await, plus optional native libpq bindings that share the same API as the pure JavaScript implementation.
Connection pooling, parameterized queries, named statements with plan caching, LISTEN/NOTIFY notifications, and COPY bulk import or export are supported. Related packages add cursors, query streams, connection-string parsing, and protocol-level building blocks within the same monorepo.
The client stays intentionally light on higher-level ORM-style abstractions while providing extensible JavaScript-to-PostgreSQL type coercion. Documentation covers pooling patterns, error handling, and compatibility across maintained Node LTS releases as well as Bun, Deno, and Cloudflare Workers.
PostgreSQL server versions from 8.x through current releases are supported, making the driver suitable as the low-level database layer in web backends and services that already run Node or compatible runtimes.
Key features
- Pure JS and native libpq API
- Connection pooling
- Parameterized queries
- Prepared statement caching
- LISTEN/NOTIFY support
- COPY import and export
- Streaming query results
- Extensible type parsing
Use cases
- Backend services using PostgreSQL
- Async database access in Node.js
- Apps needing connection pools
- Streaming large query results
- Workers and edge runtimes with pg