### Navigate, install dependencies, and start SolidStart dev server Source: https://www.prisma.io/docs/guides/frameworks/solid-start After creating the project, change into the project directory, install necessary packages, and launch the development server. ```bash cd my-solid-prisma-app bun install bun run dev ``` ```bash cd my-solid-prisma-app pnpm install pnpm run dev ``` ```bash cd my-solid-prisma-app yarn install yarn dev ``` ```bash cd my-solid-prisma-app npm install npm run dev ``` -------------------------------- ### Example Database Connection String Output Source: https://www.prisma.io/docs/guides/frameworks/tanstack-start An example of the database connection string displayed by the CLI after project setup. ```text ● Database Connection │ │ Connection String: │ │ postgresql://username:password@db.prisma.io:5432/postgres ● ``` -------------------------------- ### Install the prisma-extension-find-or-create package Source: https://www.prisma.io/docs/orm/prisma-client/client-extensions/shared-extensions This example demonstrates installing a specific Prisma Client extension, `prisma-extension-find-or-create`, using various package managers. ```bash bun add prisma-extension-find-or-create ``` ```bash pnpm add prisma-extension-find-or-create ``` ```bash yarn add prisma-extension-find-or-create ``` ```bash npm install prisma-extension-find-or-create ``` -------------------------------- ### Prisma Accelerate Connection URL (Example Partial) Source: https://www.prisma.io/docs/orm/reference/connection-urls A partial example demonstrating the start of a Prisma Accelerate connection URL configuration within prisma.config.ts. ```ts export default defineConfig({ datasource: { ``` -------------------------------- ### Quick Start: Create a temporary Prisma Postgres database Source: https://www.prisma.io/docs/postgres/npx-create-db Run this command to quickly provision a temporary Prisma Postgres database with default settings. No global installation is required. ```bash bunx create-db@latest ``` ```bash pnpm dlx create-db@latest ``` ```bash yarn dlx create-db@latest ``` ```bash npx create-db@latest ``` -------------------------------- ### Example Output of prisma dev Source: https://www.prisma.io/docs/cli/dev Illustrates the typical console output after successfully starting a `prisma dev` server. ```text ✔ Great Success! Your prisma dev server default is ready and listening on ports 63567-63569. ╭──────────────────────────────────╮ │[q]uit [h]ttp url [t]cp urls │ ╰──────────────────────────────────╯ ``` -------------------------------- ### Start Development Server with Bun Source: https://www.prisma.io/docs/guides/deployment/bun-workspaces Starts the development server for the application using Bun. ```bash bun run dev ``` -------------------------------- ### Prisma CLI Initialization Output Source: https://www.prisma.io/docs/orm/reference/prisma-cli-reference Example output from an interactive Prisma CLI initialization process, showing authentication, project setup, and next steps. ```text ✓ Select an authentication method Google Authenticating to Prisma Platform via browser. Visit the following URL in your browser to authenticate: https://console.prisma.io/auth/cli?state=eyJjb6ll... Successfully authenticated as amanyoyoyo@gmail.com. Let's set up your Prisma Postgres database! ✓ Select your region: ap-southeast-1 - Asia Pacific (Singapore) ✓ Enter a project name: My Prisma Project ✓ Success! Your Prisma Postgres database is ready ✅ We found an existing schema.prisma file in your current project directory. --- Database URL --- Connect Prisma ORM to your Prisma Postgres database with this URL: --- Next steps --- Go to https://pris.ly/ppg-init for detailed instructions. 1. Install the Postgres adapter npm install @prisma/adapter-pg ...and add it to your Prisma Client instance: import { PrismaClient } from "./generated/prisma/client"; import { PrismaPg } from "@prisma/adapter-pg"; const connectionString = `${process.env.DATABASE_URL}`; const adapter = new PrismaPg({ connectionString }); const prisma = new PrismaClient({ adapter }); 2. Apply migrations Run the following command to create and apply a migration: npx prisma migrate dev 3. Manage your data View and edit your data locally by running this command: npx prisma studio ...or online in Console: https://console.prisma.io/cmhyn0uwl0q6903foel16ff31/cmhyn143t074tyLfoezs684ag/cmhyn143t074uylfon8hfre5z/studio 4. Send queries from your app If you already have an existing app with Prisma ORM, you can now run it and it will send queries against your newly created Prisma Postgres instance. 5. Learn more For more info, visit the Prisma Postgres docs: https://pris.ly/ppg-docs ``` -------------------------------- ### Get Projects List - Unauthorized Response (JSON) Source: https://www.prisma.io/docs/prisma-management-api.postman_collection.json Example of an error response when the authorization token is missing or invalid for retrieving projects. ```json { "error": { "code": "", "message": "", "hint": "" } } ``` -------------------------------- ### Get Projects List - Successful Response (JSON) Source: https://www.prisma.io/docs/prisma-management-api.postman_collection.json Example of a successful response when retrieving a list of projects, including project details and pagination information. ```json { "data": [ { "id": "", "type": "", "url": "", "name": "", "createdAt": "", "defaultRegion": "", "workspace": { "id": "", "url": "", "name": "" } }, { "id": "", "type": "", "url": "", "name": "", "createdAt": "", "defaultRegion": "", "workspace": { "id": "", "url": "", "name": "" } } ], "pagination": { "nextCursor": "", "hasMore": "" } } ``` -------------------------------- ### List Databases API Responses Source: https://www.prisma.io/docs/prisma-management-api.postman_collection.json Examples of responses from the GET /v1/databases endpoint, covering successful data retrieval, unauthorized access, and forbidden access scenarios. ```json { "data": [ { "id": "", "type": "", "url": "", "name": "", "status": "", "createdAt": "", "isDefault": "", "defaultConnectionId": "", "connections": [ { "id": "", "type": "", "url": "", "name": "", "createdAt": "", "kind": "", "endpoints": { "direct": { "host": "", "port": "", "connectionString": "" }, "pooled": { "host": "", "port": "", "connectionString": "" }, "accelerate": { "host": "", "port": "" } }, "database": { "id": "", "url": "", "name": "" }, "directConnection": { "host": "", "pass": "", "user": "" } } ], "project": { "id": "", "url": "", "name": "" }, "region": { "id": "", "name": "" }, "source": { "type": "" }, "branchId": "" } ], "pagination": { "nextCursor": "", "hasMore": "" } } ``` ```json { "error": { "code": "", "message": "", "hint": "" } } ``` ```json { "error": { "code": "", "message": "", "hint": "" } } ``` -------------------------------- ### Get Current Authenticated Principal - Success Response (JSON) Source: https://www.prisma.io/docs/prisma-management-api.postman_collection.json Example of a successful JSON response when retrieving details about the currently authenticated user, their workspace, and the credential used. ```json { "data": { "user": { "id": "", "email": "", "name": "" }, "workspace": { "id": "", "name": "" }, "credential": { "type": "", "id": "", "name": "" } } } ``` -------------------------------- ### Get Regions by Product - Success Response (JSON) Source: https://www.prisma.io/docs/prisma-management-api.postman_collection.json Example of a successful JSON response when retrieving regions, potentially filtered by product type. Returns an array of region objects. ```json { "data": [ { "id": "", "type": "", "name": "", "product": "", "status": "" }, { "id": "", "type": "", "name": "", "product": "", "status": "" } ] } ``` -------------------------------- ### Get Prisma Postgres Regions - Success Response (JSON) Source: https://www.prisma.io/docs/prisma-management-api.postman_collection.json Example of a successful JSON response when retrieving all available regions specifically for Prisma Postgres. Returns an array of region objects. ```json { "data": [ { "id": "", "type": "", "name": "", "status": "" }, { "id": "", "type": "", "name": "", "status": "" } ] } ``` -------------------------------- ### Commit Clerk Authentication Setup Source: https://www.prisma.io/docs/ai/tutorials/linktree-clone Stage all changes and commit the integration of Clerk authentication into the Next.js application after following the quickstart guide. ```bash git add . git commit -m "Add Clerk authentication setup" ``` -------------------------------- ### Install and Start ngrok Source: https://www.prisma.io/docs/guides/authentication/clerk/astro Installs ngrok globally and starts a local tunnel, forwarding HTTP traffic from a public URL to port 4321 on your local machine. ```bash npm install --global ngrok ngrok http 4321 ``` -------------------------------- ### Navigate and Start SvelteKit Development Server Source: https://www.prisma.io/docs/guides/frameworks/sveltekit Change into the project directory and launch the development server to begin local development. ```bash cd sveltekit-prisma bun run dev ``` ```bash cd sveltekit-prisma pnpm run dev ``` ```bash cd sveltekit-prisma yarn dev ``` ```bash cd sveltekit-prisma npm run dev ``` -------------------------------- ### Install Permit.io Prisma Extension Source: https://www.prisma.io/docs/guides/integrations/permit-io Install the `@permitio/permit-prisma` package to enable automatic ReBAC filtering for Prisma queries. ```bash bun add @permitio/permit-prisma ``` ```bash pnpm add @permitio/permit-prisma ``` ```bash yarn add @permitio/permit-prisma ``` -------------------------------- ### Verify Project Directory Structure Source: https://www.prisma.io/docs/orm/prisma-client/deployment/traditional/deploy-to-koyeb After downloading the example, use the `tree` command to confirm the expected directory and file structure. ```text . ├── README.md ├── package.json ├── prisma │   ├── migrations │   │   ├── 20210310152103_init │   │   │   └── migration.sql │   │   └── migration_lock.toml │   └── schema.prisma ├── public │   └── index.html └── src └── index.js 5 directories, 8 files ``` -------------------------------- ### Download Prisma Koyeb Example Application Source: https://www.prisma.io/docs/orm/prisma-client/deployment/traditional/deploy-to-koyeb Use these commands to create a project directory and download the example Prisma application from GitHub. ```bash mkdir prisma-on-koyeb cd prisma-on-koyeb curl https://github.com/koyeb/example-prisma/tarball/main/latest | tar xz --strip=1 ``` -------------------------------- ### Install Hono Source: https://www.prisma.io/docs/compute/image-transformations Installs the Hono web framework, which is used in Compute examples to build HTTP routes, including those for image transformations. ```bash bun add hono ``` -------------------------------- ### Start Prisma Studio with a Direct Database Connection String Source: https://www.prisma.io/docs/cli/studio Starts Prisma Studio by directly providing a database connection string via the `--url` option, overriding any configured URL. ```bash bunx prisma studio --url="postgresql://user:password@localhost:5432/dbname" ``` ```bash pnpm dlx prisma studio --url="postgresql://user:password@localhost:5432/dbname" ``` ```bash yarn dlx prisma studio --url="postgresql://user:password@localhost:5432/dbname" ``` ```bash npx prisma studio --url="postgresql://user:password@localhost:5432/dbname" ``` -------------------------------- ### Filter by JSON String Starts With Source: https://www.prisma.io/docs/orm/reference/prisma-client-reference Returns users where the nested 'favorites.catBreed' key value starts with 'Turkish'. Examples show path syntax for PostgreSQL and MySQL. ```ts const getUsers = await prisma.user.findMany({ where: { pets: { path: ["favorites", "catBreed"], string_starts_with: "Turkish" } } }); ``` ```ts const getUsers = await prisma.user.findMany({ where: { pets: { path: "$.favorites.catBreed", string_starts_with: "Turkish" } } }); ``` -------------------------------- ### Initialize Prisma project with custom client output path Source: https://www.prisma.io/docs/cli/init Sets up a new Prisma project, defining a custom output path for the generated Prisma Client. ```bash bunx --bun prisma init --output ./generated-client ``` ```bash pnpm dlx prisma init --output ./generated-client ``` ```bash yarn dlx prisma init --output ./generated-client ``` ```bash npx prisma init --output ./generated-client ``` -------------------------------- ### View Application Runtime Logs Source: https://www.prisma.io/docs/orm/prisma-client/deployment/traditional/deploy-to-koyeb These logs, accessible from the Koyeb control panel, show the application's startup process and confirm that the server is ready. ```bash node-72d14691 stdout > prisma-koyeb@1.0.0 start node-72d14691 stdout > node src/index.js node-72d14691 stdout 🚀 Server ready at: http://localhost:8080 node-72d14691 stdout ⭐️ See sample requests: http://pris.ly/e/ts/rest-express#3-using-the-rest-api ``` -------------------------------- ### Example CLI Output for Database Creation Source: https://www.prisma.io/docs/postgres/npx-create-db This shows the typical output after successfully running `npx create-db`, including the temporary database connection string and the claim URL. ```text ┌ 🚀 Creating a Prisma Postgres database │ │ Provisioning a temporary database in us-east-1... │ It will be automatically deleted in 24 hours, but you can claim it. ◇ Database created successfully! │ ● Database Connection │ Connection String: │ postgresql://:@db.prisma.io:5432/postgres │ ◆ Claim your database → │ Keep your database for free: │ https://create-db.prisma.io?projectID=proj_... └ ``` -------------------------------- ### AI Prompt for Prisma Query Insights Setup Source: https://www.prisma.io/docs/orm/prisma-client/queries/advanced/query-optimization-performance Use this prompt with an AI coding assistant to automate the installation and configuration of `@prisma/sqlcommenter-query-insights`. ```text Install and configure @prisma/sqlcommenter-query-insights in my project so I can see Prisma ORM queries in Query Insights. Docs: https://www.prisma.io/docs/query-insights ``` -------------------------------- ### Initialize Git Repository and Commit Initial Setup Source: https://www.prisma.io/docs/ai/tutorials/linktree-clone Initialize a new Git repository, stage all current files, and commit the initial Next.js app setup with Prisma. ```bash git init git add . git commit -m "Initial setup: Next.js app with Prisma" ``` -------------------------------- ### Initialize Deno Project Source: https://www.prisma.io/docs/guides/integrations/deno Use these commands to create a new Deno project with a basic structure and navigate into its directory. ```bash deno init prisma-postgres-deno-deploy cd prisma-postgres-deno-deploy ``` -------------------------------- ### Initial Prisma User Model Schema Source: https://www.prisma.io/docs/orm/prisma-migrate/workflows/patching-and-hotfixing Defines the starting `User` model in `schema.prisma` before any modifications, serving as a baseline for a migration failure example. ```prisma model User { id Int @id name String } ``` -------------------------------- ### Download and Navigate to Example Code Source: https://www.prisma.io/docs/orm/prisma-client/deployment/traditional/deploy-to-flyio Use curl to download the latest Prisma deployment example for Render, extract it, and then navigate into the project directory. ```bash curl https://codeload.github.com/prisma/prisma-examples/tar.gz/latest | tar -xz --strip=2 prisma-examples-latest/deployment-platforms/render cd render ``` -------------------------------- ### Example Project Tree with prisma.config.ts Source: https://www.prisma.io/docs/orm/reference/prisma-config-reference This project tree illustrates a setup where `prisma.config.ts` is at the root, and the Prisma schema is located in a custom `prisma-custom` directory. ```bash . ├── node_modules ├── package.json ├── prisma-custom │ └── schema.prisma ├── prisma.config.ts └── src ``` -------------------------------- ### Initialize Prisma and Create Database Source: https://www.prisma.io/docs/ai/prompts/nextjs Initialize Prisma to scaffold necessary files with a custom output path and then create a real Prisma Postgres database using `npx create-db`. ```bash npx prisma init --output ../app/generated/prisma ``` ```bash npx create-db ``` -------------------------------- ### Display fetched data in a TanStack Start component Source: https://www.prisma.io/docs/guides/frameworks/tanstack-start This example demonstrates how to iterate over the `todos` data obtained from the loader and render them as a list within the component. ```typescript import { createFileRoute } from '@tanstack/react-router'; import { createServerFn } from '@tanstack/react-start'; import { prisma } from '../db'; export const Route = createFileRoute('/')({ component: App, loader: () => getTodos(), }); const getTodos = createServerFn({ method: 'GET' }).handler(async () => { return prisma.todo.findMany(); }); function App() { const todos = Route.useLoaderData(); return (
    {todos.map(todo => (
  • {todo.title}
  • ))}
); } ``` -------------------------------- ### Deploy Applications with npm Source: https://www.prisma.io/docs/compute/getting-started Use `npx` to deploy applications with Prisma Compute, specifying the framework. Examples include Next.js, Hono, and TanStack Start. ```bash npx @prisma/cli@latest app deploy --framework nextjs npx @prisma/cli@latest app deploy --framework hono --entry src/index.ts npx @prisma/cli@latest app deploy --framework tanstack-start ``` -------------------------------- ### Initialize Prisma Project with Bun Source: https://www.prisma.io/docs/guides/integrations/deno Initializes a new Prisma project using `bunx`, creating the `prisma` directory and `schema.prisma` file. ```bash bunx --bun prisma init ``` -------------------------------- ### Get Database Backups 200 OK Response (JSON) Source: https://www.prisma.io/docs/prisma-management-api.postman_collection.json Successful JSON response detailing a list of database backups, including their IDs, types, creation dates, statuses, and sizes, along with metadata and pagination. ```json { "data": [ { "id": "", "backupType": "", "createdAt": "", "status": "", "size": "", "type": "" }, { "id": "", "backupType": "", "createdAt": "", "status": "", "size": "", "type": "" } ], "meta": { "backupRetentionDays": "" }, "pagination": { "hasMore": "", "limit": "" } } ``` -------------------------------- ### Initialize Prisma Project with Prompt Source: https://www.prisma.io/docs/orm/reference/prisma-cli-reference Initializes a new Prisma project, scaffolding a schema and deploying it to a Prisma Postgres instance, with a custom prompt. ```bash prisma init --prompt "Simple habit tracker application" ``` -------------------------------- ### GET /v1/databases Source: https://www.prisma.io/docs/prisma-management-api.postman_collection.json Retrieves a list of databases, optionally filtered by project, branch, or paginated. ```APIDOC ## GET /v1/databases ### Description Retrieves a list of databases, optionally filtered by project, branch, or paginated. ### Method GET ### Endpoint /v1/databases ### Parameters #### Query Parameters - **cursor** (string,null) - Optional - **limit** (number) - Optional - Default: 100 - **projectId** (string) - Optional - **branchId** (string) - Optional - **branchGitName** (string) - Optional ### Response #### Success Response (200) - **data** (array) - **id** (string) - **type** (string) - **url** (uri) - **name** (string) - **status** (string) - **createdAt** (dateTime) - **isDefault** (boolean) - **defaultConnectionId** (string,null) - **connections** (array) - **id** (string) - **type** (string) - **url** (uri) - **name** (string) - **createdAt** (dateTime) - **kind** (string) - **endpoints** (object) - **direct** (object) - **host** (string) - **port** (number) - **connectionString** (string) - **pooled** (object) - **host** (string) - **port** (number) - **connectionString** (string) - **accelerate** (object) - **host** (string) - **port** (number) - **connectionString** (string) - **database** (object) - **id** (string) - **url** (uri) - **name** (string) - **directConnection** (object) - **host** (string) - **pass** (string) - **user** (string) - **project** (object) - **id** (string) - **url** (uri) - **name** (string) - **region** (object) - **id** (string) - **name** (string) - **source** (object) - **type** (string) - **branchId** (string,null) - **pagination** (object) - **nextCursor** (string,null) - **hasMore** (boolean) #### Response Example { "data": [ { "id": "", "type": "", "url": "", "name": "", "status": "", "createdAt": "", "isDefault": "", "defaultConnectionId": "", "connections": [ { "id": "", "type": "", "url": "", "name": "", "createdAt": "", "kind": "", "endpoints": { "direct": { "host": "", "port": "", "connectionString": "" }, "pooled": { "host": "", "port": "", "connectionString": "" }, "accelerate": { "host": "", "port": "" } }, "database": { "id": "", "url": "", "name": "" }, "directConnection": { "host": "", "pass": "", "user": "" } } ], "project": { "id": "", "url": "", "name": "" }, "region": { "id": "", "name": "" }, "source": { "type": "" }, "branchId": "" } ], "pagination": { "nextCursor": "", "hasMore": "" } } #### Error Response (401) - **error** (object) - **code** (string) - **message** (string) - **hint** (string) #### Error Response (403) - **error** (object) - **code** (string) - **message** (string) - **hint** (string) #### Error Response Example (401) { "error": { "code": "", "message": "", "hint": "" } } #### Error Response Example (403) { "error": { "code": "", "message": "", "hint": "" } } ``` -------------------------------- ### Successful Get Integrations List Response, JSON Source: https://www.prisma.io/docs/prisma-management-api.postman_collection.json This JSON array contains a list of integration objects, each detailing its ID, URL, creation timestamp, scopes, client, and creating user. ```json { "data": [ { "id": "", "url": "", "createdAt": "", "scopes": [ "", "" ], "client": { "id": "", "name": "", "createdAt": "" }, "createdByUser": { "id": "", "email": "", "displayName": "" } }, { "id": "", "url": "", "createdAt": "", "scopes": [ "", "" ], "client": { "id": "", "name": "", "createdAt": "" }, "createdByUser": { "id": "", "email": "", "displayName": "" } } ] } ``` -------------------------------- ### Stop Local PostgreSQL Services Source: https://www.prisma.io/docs/guides/deployment/docker Use these commands to stop any locally running PostgreSQL services before starting the Docker setup to avoid port conflicts. ```bash sudo systemctl stop postgresql # Linux ``` ```bash brew services stop postgresql # macOS ``` ```bash net stop postgresql # Windows (Run as Administrator) ``` -------------------------------- ### Initialize Git and Commit Next.js Setup Source: https://www.prisma.io/docs/ai/tutorials/typefully-clone Initialize a Git repository, add all files, and make an initial commit for the Next.js application setup. ```bash git init git add . git commit -m "Initial setup: Next.js app" ``` -------------------------------- ### GET /v1/databases Source: https://www.prisma.io/docs/prisma-management-api.postman_collection.json Retrieves a list of all databases accessible by the current token. Results can be filtered by project ID, branch ID, or branch Git name. ```APIDOC ## GET /v1/databases ### Description Returns all databases the token has access to. Optionally filter by project ID. ### Method GET ### Endpoint /v1/databases ### Parameters #### Query Parameters - **cursor** (string) - Optional - A cursor for pagination. - **limit** (integer) - Optional - The maximum number of results to return. Default is 100. - **projectId** (string) - Optional - Filter databases by a specific project ID. - **branchId** (string) - Optional - Filter databases by a specific branch ID. - **branchGitName** (string) - Optional - Filter databases by a specific branch Git name. ### Response #### Success Response (200 OK) Returns the list of databases. (Response body truncated in source.) ``` -------------------------------- ### GET /v1/databases Source: https://www.prisma.io/docs/prisma-management-api.postman_collection.json Retrieves a list of databases, allowing filtering by project, branch, or cursor for pagination. Each database entry includes its status, connections, and associated project/region details. ```APIDOC ## GET /v1/databases ### Description Retrieves a list of databases, allowing filtering by project, branch, or cursor for pagination. ### Method GET ### Endpoint /v1/databases ### Parameters #### Query Parameters - **cursor** (string, null) - Optional - A cursor for pagination. - **limit** (number) - Optional - The maximum number of items to return (default: 100). - **projectId** (string) - Optional - Filters databases by a specific project ID. - **branchId** (string) - Optional - Filters databases by a specific branch ID. - **branchGitName** (string) - Optional - Filters databases by a specific branch Git name. ### Response #### Success Response (200) - **data** (array of objects) - A list of database objects. - **id** (string) - The unique identifier of the database. - **type** (string) - The type of the database. - **url** (uri) - The URL of the database. - **name** (string) - The name of the database. - **status** (string) - The current status of the database. - **createdAt** (dateTime) - The creation timestamp of the database. - **isDefault** (boolean) - Indicates if this is the default database. - **defaultConnectionId** (string, null) - The ID of the default connection, if any. - **connections** (array of objects) - List of connections associated with the database. - **id** (string) - Connection ID. - **type** (string) - Connection type. - **url** (uri) - Connection URL. - **name** (string) - Connection name. - **createdAt** (dateTime) - Connection creation timestamp. - **kind** (string) - Kind of connection (e.g., "direct", "pooled", "accelerate"). - **endpoints** (object) - Connection endpoints. - **direct** (object) - **host** (string) - **port** (number) - **pooled** (object) - **host** (string) - **port** (number) - **accelerate** (object) - **host** (string) - **port** (number) - **database** (object) - Associated database details. - **id** (string) - **url** (uri) - **name** (string) - **directConnection** (object) - Direct connection details. - **host** (string) - **pass** (string) - **user** (string) - **project** (object) - Associated project details. - **id** (string) - **url** (uri) - **name** (string) - **region** (object) - Associated region details. - **id** (string) - **name** (string) - **source** (object) - Source details. - **type** (string) - **branchId** (string, null) - The ID of the associated branch, if any. #### Response Example { "data": [ { "id": "", "type": "", "url": "", "name": "", "status": "", "createdAt": "", "isDefault": "", "defaultConnectionId": "", "connections": [ { "id": "", "type": "", "url": "", "name": "", "createdAt": "", "kind": "", "endpoints": { "direct": { "host": "", "port": "" }, "pooled": { "host": "", "port": "" }, "accelerate": { "host": "", "port": "" } }, "database": { "id": "", "url": "", "name": "" }, "directConnection": { "host": "", "pass": "", "user": "" } }, { "id": "", "type": "", "url": "", "name": "", "createdAt": "", "kind": "", "endpoints": { "direct": { "host": "", "port": "" }, "pooled": { "host": "", "port": "" }, "accelerate": { "host": "", "port": "" } }, "database": { "id": "", "url": "", "name": "" }, "directConnection": { "host": "", "pass": "", "user": "" } } ], "project": { "id": "", "url": "", "name": "" }, "region": { "id": "", "name": "" }, "source": { "type": "" }, "branchId": "" }, { "id": "", "type": "", "url": "", "name": "", "status": "", "createdAt": "", "isDefault": "", "defaultConnectionId": "", "connections": [ { "id": "", "type": "", "url": "", "name": "", "createdAt": "", "kind": "", "endpoints": { "direct": { "host": "", "port": "" }, "pooled": { "host": "", "port": "" }, "accelerate": { "host": "", "port": "" } }, "database": { "id": "", "url": "", "name": "" }, "directConnection": { "host": "", "pass": "", "user": "" } }, { "id": "", "type": "", "url": "", "name": "", "createdAt": "", "kind": "", "endpoints": { "direct": { "host": "", "port": "" }, "pooled": { "host": "", "port": "" }, "accelerate": { "host": "", "port": "" } }, "database": { "id": "", "url": "", "name": "" }, "directConnection": { "host": "", "pass": "", "user": "" } } ], "project": { "id": "", "url": "", "name": "" }, "region": { "id": "", "name": "" }, "source": { "type": "" }, "branchId": "" } ] } ``` -------------------------------- ### GET /v1/databases/:databaseId/usage Source: https://www.prisma.io/docs/prisma-management-api.postman_collection.json Returns usage metrics for the specified database. ```APIDOC ## GET /v1/databases/:databaseId/usage ### Description Returns usage metrics for the specified database. ### Method GET ### Endpoint /v1/databases/:databaseId/usage ### Parameters #### Path Parameters - **databaseId** (string) - Required - The ID of the database for which to retrieve usage metrics. #### Query Parameters - **startDate** (dateTime) - Optional - The start date for the usage metrics period. - **endDate** (dateTime) - Optional - The end date for the usage metrics period. ### Response #### Success Response (200 OK) - **period** (object) - The time period for which metrics are reported. - **start** (dateTime) - The start of the period. - **end** (dateTime) - The end of the period. - **metrics** (object) - The usage metrics. - **operations** (object) - Metrics related to operations. - **used** (number) - The number of operations used. - **unit** (string) - The unit for operations (e.g., "count"). - **storage** (object) - Metrics related to storage. - **used** (number) - The amount of storage used. - **unit** (string) - The unit for storage (e.g., "bytes"). - **generatedAt** (dateTime) - The timestamp when the metrics were generated. #### Response Example (200 OK) { "period": { "start": "", "end": "" }, "metrics": { "operations": { "used": "", "unit": "" }, "storage": { "used": "", "unit": "" } }, "generatedAt": "" } #### Error Response (400 Bad Request) - **error** (object) - Error details. - **code** (string) - A unique error code. - **message** (string) - A human-readable error message. - **hint** (string) - A hint for resolving the error. #### Error Response (401 Unauthorized) - **error** (object) - Error details. - **code** (string) - A unique error code. - **message** (string) - A human-readable error message. - **hint** (string) - A hint for resolving the error. #### Error Response (404 Not Found) - **error** (object) - Error details. - **code** (string) - A unique error code. - **message** (string) - A human-readable error message. - **hint** (string) - A hint for resolving the error. #### Error Response (500 Internal Server Error) - **error** (object) - Error details. - **code** (string) - A unique error code. - **message** (string) - A human-readable error message. - **hint** (string) - A hint for resolving the error. #### Error Response Example { "error": { "code": "", "message": "", "hint": "" } } ``` -------------------------------- ### GET /v1/workspaces Source: https://www.prisma.io/docs/prisma-management-api.postman_collection.json Retrieve a paginated list of all workspaces associated with the authenticated user. Supports filtering and pagination. ```APIDOC ## GET /v1/workspaces ### Description Returns all workspaces associated with the authenticated user. ### Method GET ### Endpoint /v1/workspaces ### Parameters #### Query Parameters - **cursor** (string, null) - Optional - A cursor for pagination. - **limit** (integer) - Optional - The maximum number of items to return. Default is 100. ### Response #### Success Response (200) - **data** (array) - A list of workspace objects. - **id** (string) - The unique identifier of the workspace. - **type** (string) - The type of the workspace. - **url** (uri) - The URL of the workspace. - **name** (string) - The name of the workspace. - **createdAt** (dateTime) - The creation timestamp of the workspace. - **pagination** (object) - Pagination details. - **nextCursor** (string, null) - The cursor for the next page, or null if no more pages. - **hasMore** (boolean) - Indicates if there are more pages available. #### Response Example ```json { "data": [ { "id": "", "type": "", "url": "", "name": "", "createdAt": "" }, { "id": "", "type": "", "url": "", "name": "", "createdAt": "" } ], "pagination": { "nextCursor": "", "hasMore": "" } } ``` #### Error Response (401) - **error** (object) - Error details. - **code** (string) - An error code. - **message** (string) - A human-readable error message. - **hint** (string) - A hint for resolving the error. #### Error Response Example (401) ```json { "error": { "code": "", "message": "", "hint": "" } } ``` ``` -------------------------------- ### Deploy Applications with Yarn Source: https://www.prisma.io/docs/compute/getting-started Use `yarn dlx` to deploy applications with Prisma Compute, specifying the framework. Examples include Next.js, Hono, and TanStack Start. ```bash yarn dlx @prisma/cli@latest app deploy --framework nextjs yarn dlx @prisma/cli@latest app deploy --framework hono --entry src/index.ts yarn dlx @prisma/cli@latest app deploy --framework tanstack-start ``` -------------------------------- ### Display Help for create-db CLI (bun) Source: https://www.prisma.io/docs/postgres/npx-create-db Use this command to view the available options and usage instructions for the `create-db` CLI tool when using bun. ```bash bunx create-db@latest --help ``` -------------------------------- ### Get Project API: Successful Response (200) Source: https://www.prisma.io/docs/prisma-management-api.postman_collection.json This JSON body shows the structure of a successful response when retrieving a project by its ID, including project details and associated workspace information. ```json { "data": { "id": "", "type": "", "url": "", "name": "", "createdAt": "", "defaultRegion": "", "workspace": { "id": "", "url": "", "name": "" } } } ``` -------------------------------- ### Initialize Prisma project with custom datasource URL Source: https://www.prisma.io/docs/cli/init Sets up a new Prisma project, providing a specific database connection URL directly. ```bash bunx --bun prisma init --url mysql://user:password@localhost:3306/mydb ``` ```bash pnpm dlx prisma init --url mysql://user:password@localhost:3306/mydb ``` ```bash yarn dlx prisma init --url mysql://user:password@localhost:3306/mydb ``` ```bash npx prisma init --url mysql://user:password@localhost:3306/mydb ```