NodeBatis is a SQL-style ORM for Node.js, inspired by MyBatis on Java. It allows developers to write SQL statements in YAML files and execute them via namespaced keys. Version 2.4.2 is the latest stable release, compatible with Node >=7.6.0. It currently supports only MySQL. Key differentiators include first-class SQL support, parameter binding with :paramName, DDL support with ::ddl, SQL inheritance via {{namespace.key}}, conditional SQL fragments (if), and for-loop SQL generation for batch operations. It also offers transaction management and connection pooling. Compared to traditional ORMs like Sequelize or TypeORM, NodeBatis gives full control over SQL, avoiding ORM abstraction overhead.
npm install nodebatisNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initialize NodeBatis with MySQL config, execute a named query from YAML, and handle results asynchronously.
Use path.resolve(__dirname, 'yaml') or an absolute path string.
Set dialect: 'mysql' or wait for future versions.
Use :paramName in SQL and pass an object with matching keys.
Upgrade Node to >=7.6.0 or use an older NodeBatis version (not recommended).
Run: npm install nodebatis --save
Provide an absolute path using path.resolve(__dirname, './yaml')
Change config.dialect to 'mysql'
No dependency data recorded yet.