NeoPG is a high-performance, zero-dependency PostgreSQL ORM for Node.js, built on top of postgres.js. Current stable version is 2.3.1. It provides a hybrid API combining chainable query builder methods with tagged template literals, and includes automatic schema synchronization, model generation via CLI, and Snowflake-like ID generation. Major differentiators are its minimal dependency footprint (zero external dependencies beyond the vendored client), hybrid API, and built-in auto-sync for tables and indices. Release cadence is irregular; last update was on the npm registry.
npm install neopgNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to PostgreSQL, defines a User model with schema, syncs table automatically, and queries users with age=18.
Add 'static tableName = 'your_table';' to your model class definition.
Upgrade Node.js to version 12 or later.
For auto-increment primary key, use 'dataTypes.SERIAL' instead of 'dataTypes.ID'.
Set 'autoSync: false' in config and manage schema migrations manually.
Explicitly set schema in config to avoid default changes.
Run 'npm install neopg' in your project directory.
Use 'const { dataTypes } = require('neopg');' to import it.Create a class that extends ModelChain, then instantiate that class.
Ensure you create the instance: const db = new NeoPG(config); then use await db.close().