prisma-postgres-setup

Provisions Prisma Postgres databases via the Management API and connects them to local projects.

Updated Aug 20, 2026
One-click install
npx skills add https://github.com/rhorba/RestoLedger --skill prisma-postgres-setup-rhorba
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-postgres-setup
Source: https://github.com/rhorba/RestoLedger/tree/main/api/.windsurf/skills/prisma-postgres-setup
Command: npx skills add https://github.com/rhorba/RestoLedger --skill prisma-postgres-setup-rhorba

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires prisma, @prisma/client, @prisma/adapter-pg, pg, dotenv, and includes references (resource) components.

What problem does it solve? Setting up a new Prisma Postgres database involves multiple manual steps: creating a service token, choosing a region, provisioning a project through the Management API, wiring the connection string into your local environment, and configuring Prisma 7 correctly. This Skill automates that entire workflow end-to-end so you get a working, verified database connection without reading API docs. ## Core Features & Use Cases - Guided API provisioning: Authenticates with a service token, lists available regions as an interactive menu, creates a project with a database, and polls until the database status is ready. - Local project configuration: Installs required packages (prisma, @prisma/client, @prisma/adapter-pg, pg, dotenv), writes the direct connection string to .env, and sets up prisma.config.ts following Prisma 7 conventions. - Schema and migration workflow: Offers starter schema options, runs prisma migrate dev, and verifies the connection with a test script before finishing. - Use Case: You start a new Node.js project and say "set up a Prisma Postgres database for this app" — the Skill provisions the database, configures your project, runs the initial migration, and confirms the connection works. ## Quick Start Ask the assistant to set up a new Prisma Postgres database and connect it to this project, providing your workspace service token if you have one.

Frequently Asked Questions about prisma-postgres-setup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up a Prisma Postgres database from the command line?

Use the Prisma Management API with a workspace service token: list available regions, create a project with createDatabase set to true, and extract the direct connection string from the response. Then write it to .env as DATABASE_URL and run prisma migrate dev to initialize the schema.

How do I get a Prisma Postgres connection string?

Create a project via POST /v1/projects with createDatabase enabled, then read data.database.connections[0].endpoints.direct.connectionString from the response. Use the direct endpoint, not the pooled or Accelerate endpoints, for new projects.

How do I instantiate PrismaClient in Prisma 7?

Create a pg.Pool with your DATABASE_URL, wrap it in a PrismaPg adapter from @prisma/adapter-pg, and pass { adapter } to the PrismaClient constructor. Import the client from ./generated/prisma/client.js and ensure package.json has "type": "module".

Why does new PrismaClient() throw an error in Prisma 7?

Prisma 7 requires a driver adapter, so calling new PrismaClient() with no arguments throws. The datasourceUrl option no longer exists either. Pass { adapter } with a PrismaPg adapter wrapping a pg.Pool instead.

What should I do when Prisma Postgres database creation hits a limit?

List your existing projects with GET /v1/projects, present them for selection, delete one with DELETE /v1/projects/{projectId}, then retry the creation request. Deleting a project also removes all its databases.

When should I not use the Management API for database setup?

Avoid it for CI/CD preview databases, multi-tenant provisioning inside an application, or databases that already exist and are connected. Those cases use dedicated CI/CD or integrator workflows, and existing databases only need standard Prisma CLI commands.