@paljs/generator
This generator is designed for learning, prototyping, and example projects. It exposes full Prisma operations through GraphQL without built-in authorization or input validation.
For production applications, use the @paljs/plugins package with PrismaSelect instead — it gives you optimized queries while you maintain full control over your API.
Introduction
A native Prisma generator that creates GraphQL schemas (Nexus), client-side .graphql files, typed helpers for PrismaSelect, and admin UI pages — all from a single prisma generate command.
Best for:
- Learning how Prisma + GraphQL work together
- Building proof-of-concept applications
- Creating demo or example projects
- Quickly scaffolding admin interfaces
Installation
Setup
1. Add the Generator to Your Schema
Add the paljs generator block to your schema.prisma:
2. Create a Configuration File
Create paljs.config.ts in the same directory as your schema.prisma:
3. Run Generation
Generated Output
The generator produces the following directory structure inside your configured output path:
DMMF Writer
Outputs the Prisma DMMF (Data Model Meta Format) captured during generation. Useful for custom tooling or passing to PrismaSelect in Prisma 7 where Prisma.dmmf is no longer available.
Types Writer
Generates a ModelsObject type that provides full type safety for PrismaSelect:
Nexus Writer
Generates Nexus type definitions, queries, and mutations for each model:
GraphQL Client Writer
Generates .graphql files with fragments, queries, and mutations for client-side usage with Apollo Client or similar:
Admin Writer
Generates the admin schema and page files for use with @paljs/admin:
Configuration
See the full Configuration Reference for all options.
Minimal Config
Full Config Example
Boolean Shorthand
Both generateGraphQL and generateAdmin accept true as shorthand:
Available Queries and Mutations
For each model, the generator creates:
Queries:
findUnique{Model}— Find a single record by unique fieldfindFirst{Model}— Find the first matching recordfindMany{Model}— Find multiple records with filtering, sorting, paginationfindCount{Model}— Count matching recordsaggregate{Model}— Aggregate operations (sum, avg, min, max)
Mutations:
createOne{Model}— Create a new recordupdateOne{Model}— Update an existing recordupsertOne{Model}— Create or update a recorddeleteOne{Model}— Delete a single recordupdateMany{Model}— Update multiple recordsdeleteMany{Model}— Delete multiple records
Use excludeQueriesAndMutations to remove specific operations globally or per-model.
Upgrading from v8
If you're migrating from @paljs/generator v8 or @paljs/cli, see the Upgrade Guide.