Registry / database / feathers-prisma

feathers-prisma

JSON →
library0.7.0jsnpmunverified

A Feathers service adapter for the Prisma ORM, enabling CRUD operations via Feathers methods (find, get, create, update, patch, remove) with support for Prisma-specific features like relation eager loading ($eager), full-text search ($search), and raw Prisma filters ($prisma). Current stable version is 0.7.0, requiring Prisma v5 and Feathers v4. Release cadence is moderate with breaking changes between major Prisma version bumps. Key differentiators: integrates Feathers query syntax with Prisma's powerful filtering, allows batched operations, and provides a whitelist-based safety model for allowed query operators.

npm install feathers-prisma
INSTALL
IMPORT
SIG · FEATHERS-PRISMA
F
feathers-prisma
databasejavascriptv0.7.0
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.

service
✓ import { service } from 'feathers-prisma'
✗ const { service } = require('feathers-prisma')
ESM-only package; CJS require will not work in Node >=16 with default module resolution.
FeathersPrismaService
✓ import { FeathersPrismaService } from 'feathers-prisma'
✗ import FeathersPrismaService from 'feathers-prisma'
FeathersPrismaService is a named export, not default.
default
✓ import feathersPrisma from 'feathers-prisma'
✗ import { default as feathersPrisma } from 'feathers-prisma'
Default export exists but is not recommended; prefer named exports for clarity.

Set up a Feathers app with Prisma adapter, configure pagination, and perform a simple find with eager loading.

import feathers from '@feathersjs/feathers'; import { service } from 'feathers-prisma'; import { PrismaClient } from '@prisma/client'; const app = feathers(); const prismaClient = new PrismaClient(); prismaClient.$connect(); app.set('prisma', prismaClient); const paginate = { default: 10, max: 50 }; app.use('/messages', service({ model: 'message', paginate, multi: ['create', 'patch', 'remove'], whitelist: ['$eager'] }, prismaClient)); const msgs = await app.service('messages').find({ query: { $limit: 5, $eager: ['recipients'] } }); console.log(msgs);
Debug
Known issues
gotchaWhitelist must include $eager, $prisma, etc. before use, otherwise service will throw an error
fix
Add the required operator names to the 'whitelist' array in service options.
affects: *
breakingPrisma v3 users must use feathers-prisma v0.6.0; v0.7.0+ requires Prisma v5
fix
Downgrade to v0.6.0 if using Prisma v3, or upgrade Prisma to v5.
affects: >=0.7.0
deprecated$rawWhere property is deprecated since v0.7.0; use $prisma instead
fix
Replace $rawWhere with $prisma in query objects.
affects: >=0.7.0
gotchaBatch operations (multi) must be explicitly allowed via the 'multi' option; otherwise array input throws
fix
Specify the methods you want to allow multi: ['create', 'patch', 'remove'] in service options.
affects: *
gotchaFeathers adapter global error handling may not catch Prisma-specific errors (e.g., unique constraint)
fix
Implement custom error middleware or use Feathers hooks to map Prisma errors.
affects: *
Errors
Common errors & fixes
TypeError: Cannot destructure property 'service' of 'require(...)' as it is undefined.
Using require() in an ESM-only package context.
fix
Use import { service } from 'feathers-prisma' instead of require().
Error: The "model" option is required.
Omitting the model name in the service options object.
fix
Provide a model option: { model: 'message' }.
Error: $eager is not allowed. Please add it to the whitelist.
Using $eager in query without adding it to the whitelist option.
fix
Add '$eager' to the whitelist array in the service options.
Error: Multi-create is not allowed for the 'create' method.
Passing an array to create() without allowing multi: ['create'] in options.
fix
Include 'create' in the multi array: multi: ['create'].
Upgrade
Version history
0.7.0latest on npm
Audit
Dependencies
@feathersjs/adapter-commonsrequiredProvides adapter utilities like pagination and error handling
@feathersjs/feathersrequiredCore Feathers framework dependency
@feathersjs/errorsrequiredFeathers error types for consistent error handling
@prisma/clientrequiredPrisma ORM client for database operations
Agent activity
9 hits · last 30 days
node
8
Resources
feathers-prisma — npm install feathers-prisma · libregistry