Skip to content

Commit

Permalink
Add example snippet to enable Optimizie only in development (#6581)
Browse files Browse the repository at this point in the history
  • Loading branch information
nurul3101 authored Jan 10, 2025
1 parent 504b416 commit bca3f13
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion content/700-optimize/600-faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,18 @@ They are counted based on viewed recommendations. Once you click on a recommenda

## Can I use Prisma Optimize in production?

No, Prisma Optimize is not intended for production use. It is specifically designed for local development, providing valuable insights and optimizations during that phase. While it’s technically possible to run it in a production environment, doing so could result in performance problems or unexpected behaviors, as Optimize is not built to handle the complexity and scale of production workloads. For the best experience, we recommend using Prisma Optimize solely in your development environment.
No, Prisma Optimize is not intended for production use. It is specifically designed for local development, providing valuable insights and optimizations during that phase. While it’s technically possible to run it in a production environment, doing so could result in performance problems or unexpected behaviors, as Optimize is not built to handle the complexity and scale of production workloads. For the best experience, we recommend using Prisma Optimize solely in your development environment.

You can use the `enable` property in the Optimize extension to run Optimize only in development envrioment. By default, the `enable` property is set to `true`.

```ts file=script.ts copy showLineNumbers
import { PrismaClient } from '@prisma/client'
import { withOptimize } from "@prisma/extension-optimize"

const prisma = new PrismaClient().$extends(
withOptimize({
apiKey: process.env.OPTIMIZE_API_KEY,
enable: process.env.ENVIRONMENT === 'development',
})
);
```

0 comments on commit bca3f13

Please sign in to comment.