Registry / database / feathers-sequelize

feathers-sequelize

JSON →
library7.0.3jsnpmunverified

Service adapter for using Sequelize ORM with Feathers.js. Current stable version: 7.0.3. Released as part of the Feathers.js ecosystem, it follows the major version releases of Feathers core. Key differentiator: provides a seamless integration between Feathers services and SQL databases via Sequelize, supporting MySQL, PostgreSQL, SQLite, MariaDB, and MSSQL. It automatically handles CRUD operations, pagination, query operators, and includes/populate, while allowing access to raw Sequelize model instances. Ships TypeScript definitions. Requires Feathers.js v5 (Dove) or later.

npm install feathers-sequelize
INSTALL
IMPORT
SIG · FEATHERS-SEQUELIZE
F
feathers-sequelize
databasejavascriptv7.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sequelize
import { sequelize } from 'feathers-sequelize';
const sequelize = require('feathers-sequelize');
ECMAScript module syntax; the library is ESM-only from v7. CommonJS is not supported.
service
import { service } from 'feathers-sequelize';
Default export for creating a service; works with Feathers app.configure().
SequelizeService
import { SequelizeService } from 'feathers-sequelize';
import { SequelizeService } from 'feathers-sequelize/lib/service';
Exported class for custom service extensions; direct file path imports are not public API.

Shows how to create a Feathers app, define a Sequelize model, and register a service with pagination.

import { sequelize } from 'feathers-sequelize'; import { Sequelize, DataTypes } from 'sequelize'; const db = new Sequelize('sqlite::memory:'); const messageModel = db.define('message', { text: { type: DataTypes.STRING }, }); const app = feathers(); app.use('messages', sequelize({ Model: messageModel, paginate: { default: 10, max: 25 } })); async function run() { const messagesService = app.service('messages'); await messagesService.create({ text: 'Hello!' }); const result = await messagesService.find({ query: { $limit: 5 } }); console.log(result.data); } run();
Debug
Known issues
breakingfeathers-sequelize v7 requires Feathers v5 (Dove) and Sequelize v6+. Older versions incompatible.
fix
Update to @feathersjs/feathers@5 and sequelize@6 or later.
affects: >=7.0.0
breakingESM-only; CommonJS require() no longer works. Projects using 'require' will throw a runtime error.
fix
Switch to ES module imports or use dynamic import().
affects: >=7.0.0
deprecatedThe 'sync' option in service options is deprecated; use Sequelize model.sync() directly.
fix
Call model.sync() before app.listen().
affects: >=6.0.0
gotchaMulti-row create (array) does not return created items by default; sequelize creates but does not return.
fix
Set { raw: true } in service options or retrieve the items manually.
affects: >=6.0.0
gotchaSequelize model associations must be set up before passing the model to the service; otherwise includes won't work.
fix
Define associations on the Sequelize model after creation before using it in service.
affects: >=6.0.0
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'feathers-sequelize' in ...
Package not installed or wrong import path.
fix
Run npm install feathers-sequelize and ensure correct import: import { sequelize } from 'feathers-sequelize'.
TypeError: app.use is not a function
App not created with feathers() correctly, or using app.configure instead of app.use.
fix
Create app: const app = feathers(); then call app.use('messages', sequelize(...)).
SequelizeDatabaseError: SQLITE_ERROR: no such table: messages
Model sync not performed before querying.
fix
Add await messageModel.sync() before starting the server.
Cannot find module './lib/service' from '...'
Importing internal modules directly; only the package's main export is public.
fix
Use import { SequelizeService } from 'feathers-sequelize'; instead of from a subpath.
Upgrade
Version history
7.0.3latest on npm
Audit
Dependencies
sequelizerequiredPeer dependency; the ORM that provides the database models and queries.
@feathersjs/feathersrequiredPeer dependency; core Feathers library for service hooks and app initialization.
@feathersjs/errorsrequiredPeer dependency for consistent Feathers error handling.
Agent activity
2 hits · last 30 days
node
2
Resources
feathers-sequelize — npm install feathers-sequelize · libregistry