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. The following example specifies a provider and a list of previewFeatures:

generator client {
provider = "prisma-client-js"
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.

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.

Custom binary targets

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

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