A generator determines which assets are created when you run the prisma generate command, including:

  • The Prisma client (language specific) (currently only prisma-client-js is available)

    • Target engine binaries for prisma-client-js (for example, debian-openssl-1.0.x if you are deploying to Ubuntu 14.04, or native if you are working locally)
  • Preview features to include

  • A custom output folder for the generated assets

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

generator client {
provider = "prisma-client-js"
binaryTargets = ["linux-msl"]
previewFeatures = ["sample-preview-feature"]

Binary targets (prisma-client-js)

Prisma Client JS (prisma-client-js) uses several engine binaries. For example:

  • Prisma Client uses the query engine binary file under the hood to communicate with a database.
  • Prisma Migrate uses the migration engine binary file to run schema migrations against a database.

Engines are implemented in Rust and are used by Prisma in the form of executable binary files.

The binary file is particularly important when deploying your application to production.

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, the binary file that was compiled for darwin will be selected.

Custom binary targets

You can use environment variables to specify a custom binary for one or more engines.

Edit this page on GitHub