Registry / devops / pothos-prisma-generator

pothos-prisma-generator

JSON →
library1.3.11jsnpmunverified

pothos-prisma-generator v1.3.11 automatically generates a complete GraphQL schema (queries, mutations, counts) from your Prisma schema at runtime. No code generation output — the schema is built internally using Pothos plugins. It supports standard CRUD operations, authorization via ScopeAuthPlugin, and dynamic value replacement (e.g., injecting user IDs). Requires @pothos/core, @pothos/plugin-prisma, @pothos/plugin-prisma-utils, and optionally @pothos/plugin-scope-auth. Active development on GitHub.

npm install pothos-prisma-generator
INSTALL
IMPORT
SIG · POTHOS-PRISMA-GENE
P
pothos-prisma-generator
devopsjavascriptv1.3.11
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.

PothosPrismaGeneratorPlugin
import PothosPrismaGeneratorPlugin from 'pothos-prisma-generator'
const PothosPrismaGeneratorPlugin = require('pothos-prisma-generator')
Default export, ES module only. CommonJS require will fail.
SchemaBuilder
import SchemaBuilder from '@pothos/core'
Used in conjunction with this plugin.
PrismaTypes
import PrismaTypes from './generated/pothos-types'
import PrismaTypes from 'pothos-prisma-generator'
PrismaTypes is generated locally, not part of this package.

Basic setup of Pothos builder with the Prisma generator plugin, auto-generating GraphQL schema from Prisma model.

import SchemaBuilder from '@pothos/core'; import PrismaPlugin from '@pothos/plugin-prisma'; import PrismaUtils from '@pothos/plugin-prisma-utils'; import PothosPrismaGeneratorPlugin from 'pothos-prisma-generator'; import { PrismaClient } from '@prisma/client'; const prisma = new PrismaClient(); export const builder = new SchemaBuilder({ plugins: [PrismaPlugin, PrismaUtils, PothosPrismaGeneratorPlugin], prisma: { client: prisma, dmmf: Prisma.dmmf, }, }); const schema = builder.toSchema();
Debug
Known issues
gotchaUsing async-function@1.0.0 causes errors with Pothos when running via tsx. Pin async-function to 0.1.0 via resolutions in package.json.
fix
Add "resolutions": { "async-function": "0.1.0" } to package.json.
affects: >=1.0.0
deprecatedPrismaTypes is no longer required to be passed to SchemaBuilder generics; types are generated automatically. Including it may cause conflicts.
fix
Remove PrismaTypes from the generic parameter of SchemaBuilder.
affects: >=1.0.0
gotchaThe plugin automatically registers scalar types (BigInt, Bytes, etc.) using graphql-scalars. If you don't have those installed, it will throw at runtime.
fix
Install graphql-scalars or set autoScalers: false in plugin options.
affects: >=1.0.0
breakingEdge runtimes require the prisma-dmmf.js file to be imported instead of using Prisma.dmmf.
fix
Import prismaDmmf from './generated/prisma-dmmf.js' and pass to dmmf instead of Prisma.dmmf.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'dmmf')
Missing or incorrect dmmf configuration in builder options.
fix
Ensure prisma.dmmf is passed correctly: { prisma: { client: prisma, dmmf: Prisma.dmmf } }
Error: Cannot find module 'graphql-scalars'
The plugin auto-registers scalars from graphql-scalars, which is not installed.
fix
Install graphql-scalars: npm install graphql-scalars
Error: async-function@1.0.0 is incompatible with Pothos
tsx resolves async-function to version 1.0.0 which breaks Pothos.
fix
Pin async-function to 0.1.0 in package.json resolutions.
Upgrade
Version history
1.3.11latest on npm
Audit
Dependencies
@pothos/corerequiredCore Pothos GraphQL schema builder
@pothos/plugin-prismarequiredRequired for Prisma integration
@pothos/plugin-prisma-utilsrequiredRequired for utility features
@pothos/plugin-scope-authoptionalRequired for authorization directives
Agent activity
10 hits · last 30 days
node
8
Bingbot
1
Resources
pothos-prisma-generator — npm install pothos-prisma-generator · libregistry