A Fastify plugin integrating objection.js ORM. Current version 2.0.1 requires Node.js ^14.x || >=16.x || >=18.x, Fastify ^4.0.0, and has a peer dependency on better-sqlite3. Provides automatic knex setup, model registration, and exposes models via fastify.objection. Uses ESM with CJS fallback. Differentiates by offering a declarative plugin interface for objection.js within Fastify, with default SQLite configuration.
npm install fastify-objectionjsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Registers the plugin with a User model and SQLite config, then queries a user from fastify.objection.
Avoid mutating fastify.objection.knex; create separate knex instances for custom work.
Define models directly or clone them before registration if reused.
Use dynamic import or ensure bundler handles CommonJS modules.
Explicitly pass knexConfig to avoid unintended file creation.
Monitor vulnerability databases for better-sqlite3 and objection.js.
Ensure fastify.register(fastifyObjectionjs, ...) is called before any route or hook that uses fastify.objection.
Run 'npm install better-sqlite3' to install the required database driver.
Use 'import fastifyObjectionjs from 'fastify-objectionjs'' or 'const plugin = require('fastify-objectionjs')'.Run 'npm install objection' to install the ORM dependency.