{"id":43450,"library":"node-pg-orm","title":"node-pg-orm","description":"A minimal ORM for Node.js and PostgreSQL that provides a simple mapping layer between JavaScript objects and database tables. Current version 1.0.15, with no established release cadence (appears maintained by a single developer). Key differentiators: lightweight, no dependencies, straightforward API with support for basic CRUD operations, finders, and aggregations. However, it lacks migration support, query building flexibility, and active maintenance compared to alternatives like Sequelize or Knex. Suitable for small projects needing quick PostgreSQL integration.","status":"maintenance","version":"1.0.15","language":"javascript","source_language":"en","source_url":"https://github.com/lealhugui/node-pg-orm","tags":["javascript"],"install":[{"cmd":"npm install node-pg-orm","lang":"bash","label":"npm"},{"cmd":"yarn add node-pg-orm","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-pg-orm","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only from the start; CommonJS require will fail.","wrong":"const Orm = require('node-pg-orm')","symbol":"default","correct":"import Orm from 'node-pg-orm'"},{"note":"Named export Orm is available for CommonJS, but default import is CommonJS-incompatible. For ESM, use default import.","wrong":"import { Orm } from 'node-pg-orm'","symbol":"Orm","correct":"const { Orm } = require('node-pg-orm')"},{"note":"TypeScript types are not bundled; check @types/node-pg-orm if exists.","wrong":null,"symbol":"QueryResult","correct":"import { QueryResult } from 'node-pg-orm'"}],"quickstart":{"code":"import Orm from 'node-pg-orm';\n\nconst config = {\n  user: process.env.PG_USER ?? 'postgres',\n  host: process.env.PG_HOST ?? 'localhost',\n  database: process.env.PG_DATABASE ?? 'test',\n  password: process.env.PG_PASSWORD ?? '',\n  port: parseInt(process.env.PG_PORT ?? '5432'),\n};\n\nasync function main() {\n  const orm = new Orm(config);\n  await orm.authenticate();\n  console.log('Connected');\n  \n  // Define a model\n  const User = orm.define('users', {\n    id: { type: 'serial', primaryKey: true },\n    name: { type: 'varchar', length: 255 },\n    email: { type: 'varchar', length: 255 }\n  });\n  \n  // Create\n  const user = await User.create({ name: 'Alice', email: 'alice@example.com' });\n  console.log('Created:', user);\n  \n  // Find\n  const users = await User.findAll();\n  console.log('All users:', users);\n  \n  await orm.close();\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Connects to PostgreSQL, defines a model, and performs basic CRUD operations."},"warnings":[{"fix":"Consider migration to a maintained ORM like Sequelize or Prisma.","message":"The package is not actively maintained; last update over a year ago. Use at your own risk.","severity":"gotcha","affected_versions":"<=1.0.15"},{"fix":"Install @types/node-pg-orm if available, or define your own types.","message":"No TypeScript type definitions are provided. You may encounter type errors.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Run 'npm install pg' alongside node-pg-orm.","message":"The package relies on the 'pg' driver but does not include it as a dependency. You must install 'pg' separately.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use Node 14 or lower, or switch to a modern ORM.","message":"Engine requirement node >=8.9 (very old). May not work on newer Node versions due to API changes.","severity":"breaking","affected_versions":"<=1.0.15"}],"env_vars":null,"search_vec":"'1.0.15':26 'activ':63 'aggreg':53 'altern':67 'api':44 'appear':32 'basic':48 'build':60 'cadenc':31 'compar':65 'crud':49 'current':24 'databas':22 'depend':42 'develop':37 'differenti':39 'establish':29 'finder':51 'flexibl':61 'howev':54 'integr':79 'javascript':19,80 'key':38 'knex':71 'lack':56 'layer':17 'lightweight':40 'like':68 'maintain':33 'mainten':64 'map':16 'migrat':57 'minim':6 'need':76 'node':2 'node-pg-orm':1 'node.js':9 'object':20 'oper':50 'orm':4,7 'pg':3 'postgresql':11,78 'project':75 'provid':13 'queri':59 'quick':77 'releas':30 'sequel':69 'simpl':15 'singl':36 'small':74 'straightforward':43 'suitabl':72 'support':46,58 'tabl':23 'version':25","created_at":"2026-06-05T16:59:51.138542+00:00","updated_at":"2026-06-05T16:59:51.138542+00:00","problems":[{"fix":"Run 'npm install pg' to add PostgreSQL driver.","cause":"The pg driver is not installed as a peer dependency.","error":"Cannot find module 'pg'"},{"fix":"Change the port in config or stop the other PostgreSQL service.","cause":"Default PostgreSQL port is already in use by another instance.","error":"Error: listen EADDRINUSE :::5432"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/lealhugui/node-pg-orm#readme","github":"https://github.com/lealhugui/node-pg-orm","docs":null,"changelog":null,"pypi":null,"npm":"node-pg-orm","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}