koa-orm is a Koa.js middleware that integrates Sequelize ORM for database operations, simplifying multi-database management in Koa applications. The current stable version is 3.2.1, with releases via npm. It supports single and multiple database configurations, provides a middleware to attach ORM instances to the Koa context, and leverages Sequelize for SQL querying. Differentiated by its focus on Koa and automatic context binding, it is actively maintained.
npm install koa-ormNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a Koa app with koa-orm middleware for single MySQL database, performs a raw SQL select query.
Migrate to koa-orm v2: use `orm(configs).middleware` and access via `ctx.orm(name)` instead of `ctx.db`.
Upgrade Node.js to version >=10.0.0.
Use `path.join(__dirname, 'models')` or provide an absolute path.
Set different `name` values for each database configuration.
Define models in the modelPath and use `ctx.orm().ModelName` for queries instead of raw SQL.
Use `import orm from 'koa-orm'` (ESM) or `const orm = require('koa-orm')` (CommonJS).Run `npm install sk2` to install the required dependency.
Set `dialectOptions: { insecureAuth: true }` in the config or alter the MySQL user's authentication plugin to mysql_native_password.