import CodeBlock from '@theme/CodeBlock';

## {props.stepNumber ? `${props.stepNumber}. ` : ''}Install and generate Prisma Client

To get started with Prisma Client, first install the required packages:

{props.database === 'prisma-postgres' && (
<>
<CodeBlock language="terminal">
{`npm install @prisma/client @prisma/extension-accelerate`}
</CodeBlock>
</>
)}

{props.database === 'postgresql' && (
<>
<CodeBlock language="terminal">
{`npm install @prisma/client @prisma/adapter-pg`}
</CodeBlock>
</>
)}

{props.database === 'mysql' && (
<>
<CodeBlock language="terminal">
{`npm install @prisma/client @prisma/adapter-mariadb`}
</CodeBlock>
</>
)}

{props.database === 'sqlite' && (
<>
<CodeBlock language="terminal">
{`npm install @prisma/client @prisma/adapter-better-sqlite3`}
</CodeBlock>
</>
)}

{props.database === 'sqlserver' && (
<>
<CodeBlock language="terminal">
{`npm install @prisma/client @prisma/adapter-mssql`}
</CodeBlock>
</>
)}

{props.database === 'planetscale' && (
<>
<CodeBlock language="terminal">
{`npm install @prisma/client @prisma/adapter-planetscale`}
</CodeBlock>
</>
)}

{props.database === 'cockroachdb' && (
<>
<CodeBlock language="terminal">
{`npm install @prisma/client @prisma/adapter-pg`}
</CodeBlock>
</>
)}

{props.database === 'mongodb' && (
<>
<CodeBlock language="terminal">
{`npm install @prisma/client`}
</CodeBlock>
</>
)}

Then, run `prisma generate` which reads your Prisma schema and generates the Prisma Client:

```terminal
npx prisma generate
```

:::note Good to know

When you run `prisma generate`, you are creating code (TypeScript types, methods, queries) tailored to your Prisma schema. Whenever you make changes to your Prisma schema, you need to update the Prisma Client by running `prisma generate`.

Whenever you update your Prisma schema, you will also need to update your database schema using either `prisma migrate dev` or `prisma db push`. These commands will also run `prisma generate` automatically.

:::
