prisma-postgres
Setup and programmatic management of Prisma Postgres databases across Console, CLI, and APIs.
- Four core workflows: manual Console setup, instant provisioning via
create-dbCLI, REST API integration with service tokens or OAuth, and type-safe TypeScript integration via@prisma/management-api-sdk - Supports temporary database creation with auto-deletion after ~24 hours, claim URLs for persistence, and region selection
- Management API available at
https://api.prisma.io/v1with OpenAPI docs and Swagger Editor for endpoint exploration - Handles connection strings, workspace/project management, and token storage for both server-to-server and user-delegated authentication flows
Prisma Postgres
Guidance for creating, managing, and integrating Prisma Postgres across interactive and programmatic workflows.
When to Apply
Reference this skill when:
- Setting up Prisma Postgres from Prisma Console
- Provisioning instant temporary databases with
create-db - Linking an existing local project with
prisma postgres link - Managing Prisma Postgres resources via Management API
- Using
@prisma/management-api-sdkin TypeScript/JavaScript - Handling claim URLs, connection strings, regions, and auth flows
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | CLI Provisioning | CRITICAL | create-db-cli |
| 2 | Management API | CRITICAL | management-api |
| 3 | Management API SDK | HIGH | management-api-sdk |
| 4 | Console and Connections | HIGH | console-and-connections |
Quick Reference
create-db-cli- instant databases and current CLI flags (--ttl,--copy,--quiet,--open)management-api- service token and OAuth API workflowsmanagement-api-sdk- typed SDK usage with token storageconsole-and-connections- Console operations,prisma postgres link, direct TCP connections, and serverless-driver choices
Core Workflows
1. Console-first workflow
Use Prisma Console for manual setup and operations:
- Open
https://console.prisma.io - Create/select workspace and project
- Use Studio in the project sidebar to view/edit data
- Retrieve direct connection details from the project UI
2. Quick provisioning with create-db
Use create-db when you need a database immediately:
npx create-db@latest
Aliases:
npx create-pg@latest
npx create-postgres@latest
For app integrations, you can also use the programmatic API (create() / regions()) from the create-db npm package.
Temporary databases auto-delete after ~24 hours unless claimed.
3. Link an existing local project
Use prisma postgres link when the database already exists and you want to wire a local project to it:
prisma postgres link
For CI or other non-interactive environments:
prisma postgres link --api-key "<your-api-key>" --database "db_..."
This flow updates your local .env with DATABASE_URL, then you can run prisma generate and prisma migrate dev.
4. Programmatic provisioning with Management API
Use API endpoints on:
https://api.prisma.io/v1
Explore the schema and endpoints using:
- OpenAPI docs:
https://api.prisma.io/v1/doc - Swagger Editor:
https://api.prisma.io/v1/swagger-editor
Auth options:
- Service token (workspace server-to-server)
- OAuth 2.0 (act on behalf of users)
5. Type-safe integration with Management API SDK
Install and use:
npm install @prisma/management-api-sdk
Use createManagementApiClient for existing tokens, or createManagementApiSdk for OAuth + token refresh.
Rule Files
Detailed guidance lives in:
references/console-and-connections.md
references/create-db-cli.md
references/management-api.md
references/management-api-sdk.md
How to Use
Start with references/create-db-cli.md for fast setup, then switch to references/management-api.md or references/management-api-sdk.md when you need programmatic provisioning.
More from prisma/skills
prisma-database-setup
Guides for configuring Prisma with different database providers (PostgreSQL, MySQL, SQLite, MongoDB, etc.). Use when setting up a new project, changing databases, or troubleshooting connection issues. Triggers on "configure postgres", "connect to mysql", "setup mongodb", "sqlite setup".
8.4Kprisma-client-api
Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".
7.8Kprisma-cli
Prisma CLI commands reference covering all available commands, options, and usage patterns. Use when running Prisma CLI commands, setting up projects, generating client, running migrations, managing databases, or starting Prisma's MCP server. Triggers on "prisma init", "prisma generate", "prisma migrate", "prisma db", "prisma studio", "prisma mcp".
6.9Kprisma-upgrade-v7
Complete migration guide from Prisma ORM v6 to v7 covering all breaking changes. Use when upgrading Prisma versions, encountering v7 errors, or migrating existing projects. Triggers on "upgrade to prisma 7", "prisma 7 migration", "prisma-client generator", "driver adapter required".
2.9Kprisma-driver-adapter-implementation
Required reference for Prisma v7 driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter/Transaction interfaces. Contains critical contract details not inferable from code examples — including the transaction lifecycle protocol, error mapping requirements, and verification checklist. Existing implementations do not replace this skill.
2.8Kprisma-postgres-setup
Set up a new Prisma Postgres database and connect it to a local project using the Management API. Use when asked to "set up a database", "create a Prisma Postgres project", "get a connection string", "connect my app to Prisma Postgres", or "provision a database".
1.3K