You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/250-postgres/300-database/675-prisma-studio/100-embedding-studio.mdx
+60-3Lines changed: 60 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ toc: true
10
10
11
11
Prisma Studio can be embedded in your own application via the [`@prisma/studio-core`](https://www.npmjs.com/package/@prisma/studio-core) package.
12
12
13
-
It gives you `Studio` a React component which renders Prisma Studio for your database. The `Studio` component accepts an _executor_ which accesses a `/studio` endpoint in your backend. The backend uses your API key to identify the correct Prisma Postgres instance and sends the SQL query to it.
13
+
It provides `Studio`, a React component which renders Prisma Studio for your database. The `Studio` component accepts an executor that calls a `/studio` endpoint in your backend. The backend uses your `DATABASE_URL` (connection string) to connect to the correct Prisma Postgres instance and execute the SQL query.
14
14
15
15
:::tip
16
16
If you want to see what embedded Studio looks like, **[check out the demo](https://github.com/prisma/studio-core-demo) on GitHub**!
@@ -57,6 +57,7 @@ Here's what a minimal implementation looks like:
You can customize the look and feel of Prisma Studio so that it matches your application’s design. This is done by passing a custom theme to the `Studio` component. A theme is simply a set of CSS variables that define colors, spacing, and other style properties for both light and dark modes.
With this setup, Studio inherits your custom colors, borders, and typography rules, making it feel like a natural part of your app rather than a separate tool. You can define as many or as few variables as you need depending on the level of customization you want.
172
+
116
173
### Concepts
117
174
118
175
Here's an overview of the key concepts in your frontend:
@@ -123,7 +180,7 @@ Here's an overview of the key concepts in your frontend:
123
180
124
181
## Backend setup
125
182
126
-
Your backend needs to expose a `/studio` endpoint, that's where the frontend sends its requests. The implementation of this endpoint uses the `createAccelerateHttpClient` function that can be imported from the `@prisma/studio-core`.
183
+
Your backend needs to expose a `/studio` endpointwhere the frontend sends its requests. The implementation below uses `createPrismaPostgresHttpClient`from `@prisma/studio-core`.
127
184
128
185
The backend also needs to have access to the Prisma Postgres API key, we recommend setting it as an environment variable as a best practice.
129
186
@@ -234,7 +291,7 @@ sequenceDiagram
234
291
235
292
When you want to authenticate the users of your app against Prisma Studio, you can do that by adding custom logic around your embedded Prisma Studio version.
236
293
237
-
On the frontend, you xan ensure yo pass the `Authorization` header and other data (e.g. a user ID) when creating the executor:
294
+
On the frontend, you can ensure to pass the `Authorization` header and other data (e.g. a user ID) when creating the executor:
0 commit comments