Skip to content
Docs
Settings
Gentime

Gentime Settings

You are able to control certain aspects of the Nexus Prisma code generation.

Usage

  1. Create a configuration file named any of:

    nexusPrisma.ts  /  nexus-prisma.ts  /  nexus_prisma.ts

    In one of the following directories:

    1. Project Root – The directory containing your project's package.json. Example:

        ├── nexus-prisma.ts
        └── package.json
    2. Prisma Directory – The directory containing your Prisma schema. Example:

        ├── prisma/nexus-prisma.ts
        └── package.json
  2. If you have not already, install ts-node (opens in a new tab) which nexus-prisma will use to read your configuration module.

  3. Import the settings singleton and make your desired changes. Example:

    import { settings } from 'nexus-prisma/generator'
     
    settings({
      projectIdIntToGraphQL: 'ID',
    })

Reference

Please refer to the thorough JSDoc for reference documentation. Typically consumed in your IDE or Paka (opens in a new tab).

Notes

Prisma Schema File Generator Config

Nexus Prisma supports custom configuration of the output directory within the generator block within your Prisma Schema file like so:

// prisma/schema.prisma

generator nexusPrisma {
  provider = "nexus-prisma"
  output   = "../generated/nexus-prisma"
}

The above is equivalent to the following:

// prisma/nexus-prisma.ts
 
import { settings } from 'nexus-prisma/generator'
 
settings({
  output: '../generated/nexus-prisma',
})

It is considered idiomatic to use the Nexus Prisma configuration file instead of inline generator block configuration. Inline generator block configuration lacks autocomplete and inline JSDoc. The only reason output is supported is to be symmetrical with Prisma Client (opens in a new tab) and thus ease onboarding.