A Prisma schema can have one or more generators, represented by the generator block:

generator client {
provider = "prisma-client-js"
output = "./generated/prisma-client-js"
}

A generator determines which assets are created when you run the prisma generate command. The main property provider defines which Prisma Client (language specific) is created - currently, only prisma-client-js is available. Alternatively you can define any Npm package that follows our generator specification. Additionally and optionally you can define a custom output folder for the generated assets with output.

Prisma Client: prisma-client-js

The generator for Prisma's Javascript Client accepts multiple additional properties:

  • previewFeatures: Preview features to include
  • binaryTargets: Engine binary targets for prisma-client-js (for example, debian-openssl-1.1.x if you are deploying to Ubuntu 18+, or native if you are working locally)
generator client {
provider = "prisma-client-js"
previewFeatures = ["sample-preview-feature"]
binaryTargets = ["linux-msl"]
}

Binary targets

Prisma Client JS (prisma-client-js) uses several engines. Engines are implemented in Rust and are used by Prisma in the form of executable, platform dependent engine files. Depending on which platform you are executing your code on, you need the correct file. "Binary targets" are used to define which files should be present for the target platform(s).

The correct file is particularly important when deploying your application to production, which often differs from your local development environment.

The native binary target

The native binary target is special. It doesn't map to a concrete operating system. Instead, when native is specified in binaryTargets, Prisma detects the current operating system and automatically specifies the correct binary target for it.

As an example, assume you're running Mac OS and you specify the following generator:

generator client {
provider = "prisma-client-js"
binaryTargets = ["native"]
}

In that case, Prisma detects your operating system and finds the right binary file for it based on the list of supported operating systems . As you're running Mac OS (darwin), the binary file that was compiled for darwin will be selected.

Note: The native binary target is the default. You can set it explicitly if you wish to include additional binary targets for deployment to different environments.

Community generators

The following is a list of community created generators.

Note: Community projects are not maintained or officially supported by Prisma and some features may be out of sync. Use at your own discretion.

Edit this page on GitHub