Back to Prisma1

Prisma Generate Xcv2

docs/1.34/prisma-cli-and-configuration/cli-command-reference/prisma-generate-xcv2.mdx

1.34.121.9 KB
Original Source

export const meta = { title: "prisma1 generate", position: 130, }

prisma1 generate

Invokes the generators specified in prisma.yml. Available generators are:

The following generators are built-into the Prisma CLI:

  • Prisma client in JavaScript: javascript-client
  • Prisma client in TypeScript: typescript-client
  • Prisma client in Flow: flow-client
  • Prisma client in Go: go-client
  • GraphQL schema of the Prisma API: graphql-schema

By default, the Prisma client is generated locally based on the datamodel. If the datamodel is currently out-of-sync with the API of the running Prisma service, it's also possible to generate the client from the live API instead of the datamodel using the --endpoint option. prisma1 generate looks up the endpoint in your prisma.yml when the option is added to the command. If you want to provide a custom endpoint, you can add it as an argument to the --endpoint option as well.

Usage

bash
prisma1 generate [flags]

Flags

-e, --env-file ENV-FILE    Path to .env file to inject env vars
-p, --project PROJECT    Path to Prisma definition file
--endpoint    Use a specific endpoint for schema generation or pick endpoint from prisma.yml

Examples

Generate the TypeScript client and store the generated files at ./generated/prisma

prisma.yml:

yml
generate:
    - generator: typescript-client
      output: ./generated/prisma
bash
prisma1 generate

Generate the TypeScript client from custom endpoint

prisma.yml:

yml
generate:
    - generator: typescript-client
      output: ./generated/prisma
bash
prisma1 generate --endpoint http://localhost:4466

Generate the Go client and the GraphQL schema store the generated files at ./generated/prisma

prisma.yml:

yml
generate:
    - generator: go-client
      output: ./generated/prisma
    - generator: graphql-schema
      output: ./generated/prisma
bash
prisma1 generate