MySQL Easy Type is an ORM-like library for Node.js that provides a simple, typed interface for MySQL querying with automatic TypeScript declaration generation. Version 1.23.2 is current, with stable release cadence. It wraps mysql2 to provide model-based CRUD operations, join support, transactions, and a CLI tool to generate type definitions and model files from database schema. Key differentiators include its zero-config setup, automatic type generation from the database, and a concise API with chaining methods like find, limit, join, and get. It is ideal for developers who want strong typing without writing manual schemas, and it supports both connection and pool queries.
npm install mysql-easy-typeNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic CRUD operations: creating a user, finding by primary key, updating, querying with filter, and counting records.
Use PoolQuery for mysql2 pool: const { PoolQuery } = require('mysql-easy-type'); const query = new PoolQuery(pool);Always pass the query instance: const User = model('user'); const result = await User(query).find().all();Use require or use dynamic import: const { model } = await import('mysql-easy-type');Install dotenv and mysql2 as devDependencies: npm i dotenv mysql2 --save-dev; ensure .env file has all required vars.
Update join calls: .join(Message, { fk: 'id', ref: 'user_id', asList: true })npm install mysql-easy-type
Use: const user = await User(query).findByPk(1);
Use a pool instead of single connection: const pool = mysql.createPool({...}); const query = new PoolQuery(pool);npm install dotenv --save-dev