0.6.0 • Published 2 days ago

@prisma/extension-optimize v0.6.0

Weekly downloads
-
License
-
Repository
-
Last release
2 days ago

Optimize Prisma Client extension

This is the package for the Prisma Client extension that enables usage of Prisma Optimize.

Optimize enables developers to profile and get performance-related recommendations while developing applications with Prisma.

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.

Getting started with Optimize

Enabling Optimize in your local development workflow is really simple.

1. Install the extension

npm install @prisma/extension-optimize --save-dev

Starting a Prisma project from scratch? Follow https://www.prisma.io/docs/getting-started

2. Enable the tracing preview feature in your schema

 generator client {
   provider        = "prisma-client-js"
+  previewFeatures = ["tracing"]
 }

After enabling the tracing preview feature, you need to re-generate your Prisma Client:

npx prisma generate

3. Extend your Prisma Client with Optimize support

import { PrismaClient } from "@prisma/client";
import { withOptimize } from "@prisma/extension-optimize";

const prisma = new PrismaClient().$extends(withOptimize());

The extension will orchestrate the user experience around Optimize. You will:

  • Be required to log into the Prisma Data Platform through your GitHub account
  • And be instructed to visit the URL of your Optimize dashboard:
[...]
> tsx index.ts

┌─────────────────────────────────┐
│ See your Optimize dashboard at: │
│ https://optimize-3k7.pages.dev/ │
└─────────────────────────────────┘
[...]

Got feedback?

Please submit an issue or join a discussion in our feedback repository