Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

On this pageOverview

Generating Prisma Client

prisma generate creates Prisma Client from the models and generator configuration in your schema.prisma file.

In Prisma ORM v7, the output field is required:

title="schema.prisma"
generator client {

  provider = "prisma-client"

  output   = "./generated"

}

Run the following command whenever you add models, change fields, or update generator settings:

bunx prisma generate
Bash
pnpm prisma generate
Bash
yarn prisma generate
Bash
npx prisma generate

If you want the CLI-specific options such as --watch or --generator, see the prisma generate command reference.

If you want the CLI-specific options such as --watch or --generator, see the prisma generate command reference.

Import Prisma Client from the output path you configured:

import { PrismaClient } from "./generated/client";

const prisma = new PrismaClient();

You should run prisma generate after:

  • changing your Prisma schema
  • updating generator configuration
  • enabling features that affect the client API
  • pulling schema changes from another branch or teammate

In many projects it also makes sense to run prisma generate in postinstall or before your production build so deployments always use a current client.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu