kp-mysql-models v1.5.1 is a lightweight, promise-based Node.js ORM for MySQL that simplifies CRUD operations, advanced joins, pagination, soft deletes, and relationship handling (hasOne, belongsTo, hasMany). It uses model-based query building with a minimal footprint. Compared to larger ORMs like Sequelize, it offers a simpler, less opinionated API with direct pool connection management. The package is available on npm under both 'kp-mysql-models' and '@krishnapawar/kp-mysql-models' with no significant release cadence documented. It requires Node.js >=12.0.0 and a MySQL connection pool from the 'mysql' package.
npm install kp-mysql-modelsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows full setup: create a MySQL pool, define a User model extending BaseModels, and fetch all users with hidden fields.
Always pass a pool created with mysql.createPool().
Use super(pool) in constructor; avoid setting this._connection manually.
Use CommonJS require() or wrap with createRequire in ESM.
Choose one package name and stick with it; uninstall the other.
Run: npm install kp-mysql-models (or npm install @krishnapawar/kp-mysql-models) and use consistent import.
Use: const { BaseModels } = require('kp-mysql-models');Use mysql.createPool() and pass the pool to super(pool) in the model constructor.
Transform your file to CommonJS (.cjs extension) or use dynamic import: const { BaseModels } = await import('kp-mysql-models');