
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
@prisma/extension-optimize
Advanced tools
This is the package for the Prisma Client extension, which enables the use of Prisma Optimize.
Prisma Optimize enables developers to profile and get performance-related recommendations while developing applications with Prisma ORM.
It is part of the Prisma ecosystem, alongside other tools such as:
Prisma is leading Data DX, a philosophy that promotes simplicity in data-driven application development. Learn more on the Data DX manifesto.
You can explore Optimize with the following resources:
If you're using Prisma version 5 or earlier, run the following command in your terminal to install compatible packages, else use version 6:
Version 5:
npm install @prisma/client@^5 @prisma/instrumentation@^5
@prisma/extension-optimize
npm install --save-dev prisma@^5
Version 6:
npm install @prisma/client@^6
@prisma/extension-optimize @prisma/instrumentation@^6
npm install --save-dev prisma@^6
Skip this step if you're using prisma client v.6
Prisma Optimize uses Prisma ORM's OpenTelemetry tracing functionality. In the generator
block of your Prisma schema, add the tracing preview feature:
generator client {
provider = "prisma-client-js"
+ previewFeatures = ["tracing"]
}
Then, generate the Prisma Client:
npx prisma generate
Install the latest versions of Prisma Client and the Optimize extension:
npm install @prisma/client@latest @prisma/extension-optimize
Generate an Optimize API key by following the instructions here and add it to your .env file:
OPTIMIZE_API_KEY="YOUR_OPTIMIZE_API_KEY"
Extend your existing Prisma Client instance with the Optimize extension:
import { PrismaClient } from "@prisma/client";
import { withOptimize } from "@prisma/extension-optimize";
const prisma = new PrismaClient().$extends(withOptimize({ apiKey: process.env.OPTIMIZE_API_KEY }));
Follow these steps to start generating query insights with Prisma Optimize:
In the Optimize dashboard, click the Start recording button, then run your app.
After your app runs and insights are generated for the desired queries, click the Stop recording button.
Explore individual query details by clicking on them, and check the Recommendations tab for any suggested improvements to enhance query performance.
NOTE: Use the AI Explainer feature to understand recommendations and apply them within your Prisma model context.
For a hands-on learning experience, try out the step-by-step example.
If you need assistance, reach out in the #help-and-questions channel on our Discord, or connect with our community to see how others are using Optimize.
FAQs
Prisma Optimize client extension for Prisma ORM
The npm package @prisma/extension-optimize receives a total of 17,521 weekly downloads. As such, @prisma/extension-optimize popularity was classified as popular.
We found that @prisma/extension-optimize demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.