Skip to content

Installation ​

Objection.js can be installed using npm or yarn. Objection uses knex as its database access layer, so you also need to install it.

bash
npm install objection knex
yarn add objection knex

Objection is an ES module and needs node ^20.19.0 || >=22.12.0: node 20.19 or newer within node 20, or node 22.12 or newer. The examples in this documentation use import, but CommonJS code can still load objection with require('objection'), see the migration notes.

You also need to install one of the following depending on the database you want to use:

bash
npm install pg
npm install sqlite3
npm install mysql
npm install mysql2

You can use the next tag to install an alpha/beta/RC version:

bash
npm install objection@next

TypeScript ​

Objection ships with its own TypeScript typings. They require TypeScript 5.8 or newer: 5.8, 6 and 7 are supported.

MIT Licensed