psqlorm is a lightweight ORM for PostgreSQL built on top of the pg npm package. Current stable version is 9.6.9. It provides two model classes: Model (basic SQL generation and execution) and PostgreModel (with automatic table synchronization and foreign key support). Key differentiators: minimal learning curve, direct use of pg connection/pool, support for advanced queries (ILIKE, JOIN, transaction), and built-in data export/import. It has undergone multiple breaking changes (v5, v7, v8, v9) focusing on API consistency and feature enhancements. Suitable for small to medium projects that need ORM simplicity without the overhead of larger ORMs like Sequelize or TypeORM.
npm install psqlormNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows initializing psqlorm with initORM, creating a model for 'users' table, and running a simple select query.
Use regular delete(), insert(), update() calls. For foreign key operations, ensure PostgreModel with auto-sync enabled.
Review the v7 upgrade guide: option properties renamed, join syntax changed, transaction callback signature updated.
For v4.x you must install 'pg' separately. For v5+ pg is installed automatically, but ensure pg version compatibility.
Use delete(), insert(), update() with explicit foreign key conditions.
Use require() or use a bundler that can consume CommonJS. Do not attempt import statements with ES modules.
Use '@' only when you need raw SQL fragments. For user input, always use parameterized queries with '?' placeholders.
npm install pg
Use const psqlorm = require('psqlorm');Check dbconfig (host, user, database, password) and ensure PostgreSQL server is running.
Verify table schema and column names.