MySQL2 ORM v3.0.0 is a lightweight, intuitive ORM built on top of mysql2/promise, focusing on essential CRUD operations (INSERT, SELECT, UPDATE, DELETE) with automatic prepared statements and smart connection handling. It ships TypeScript types and avoids `any`. The library provides a MySQL pool wrapper and a QueryBuilder for custom queries. It is actively maintained with regular releases. Key differentiators: strictly typed (no `any`, `as`, or `satisfies`), automatic limit/offset parameterization, and transaction connection release detection. Node.js >=14.18.0 required.
npm install mysql2-ormNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows creating a MySQL pool, selecting a single user by ID using OP.eq, and closing the connection.
Use import syntax instead of require().
Pass an object with host, user, database, password, etc.
Use OP.equal('id', 16) instead of OP.eq('id', 16).Check if result is an array or object before using properties.
Do not manually call pool.release() after transaction; it's handled.
Run npm i -D @types/node.
Set "type": "module" in package.json or rename file to .mjs.
Use dynamic import: const { MySQL } = await import('mysql2-orm'); or switch to ESM.Ensure correct import: import { MySQL } from 'mysql2-orm' and instantiate with new MySQL({...}).Run npm install mysql2.