prisma-postgres-setup

Provisions a Prisma Postgres database via the Management API and connects it to a local project.

Updated Jul 28, 2026
One-click install
npx skills add https://github.com/ArvindIyer1/prediction-market-project --skill prisma-postgres-setup-arvindiyer1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-postgres-setup
Source: https://github.com/ArvindIyer1/prediction-market-project/tree/main/packages/.windsurf/skills/prisma-postgres-setup
Command: npx skills add https://github.com/ArvindIyer1/prediction-market-project --skill prisma-postgres-setup-arvindiyer1

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 app, and configuring Prisma 7's new client adapter pattern. This Skill automates that entire workflow end-to-end. ## Core Features & Use Cases - API-driven provisioning: Authenticates with a service token, lists available regions, and creates a project with a database through the Prisma Management API, extracting the direct connection string. - Local project configuration: Installs required packages (prisma, @prisma/client, @prisma/adapter-pg, pg, dotenv), writes DATABASE_URL to .env, and sets up prisma.config.ts following Prisma 7 conventions. - Schema and verification workflow: Offers starter schema options, runs prisma migrate dev, and verifies the connection with a test script using the PrismaPg adapter. - Use Case: You just scaffolded a new Node.js app and need a hosted Postgres database. Ask the agent to set up Prisma Postgres, pick a region from the interactive menu, and get a working, verified database connection with migrations in minutes. ## Quick Start Set up a new Prisma Postgres database for this project and connect my app to it.

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 for a new project?

Authenticate with a workspace service token, create a project via POST /v1/projects with createDatabase set to true, and extract the direct connection string from the response. Then write it to .env as DATABASE_URL, install prisma, @prisma/client, @prisma/adapter-pg, pg, and dotenv, and run prisma migrate dev.

How do I authenticate with the Prisma Management API?

Create a service token in Prisma Console under Workspace Settings, then Service Tokens. Include it as a Bearer token in the Authorization header of every API request. Tokens are workspace-scoped and grant access to all projects and databases in that workspace.

How do I instantiate PrismaClient in Prisma 7?

Create a pg.Pool with your DATABASE_URL, wrap it in a PrismaPg adapter, and pass { adapter } to the PrismaClient constructor. Import the client from ./generated/prisma/client.js, and note that calling new PrismaClient() with no arguments or with datasourceUrl throws in Prisma 7.

Why does Prisma 7 not use a url in schema.prisma?

Prisma 7 moves connection URLs out of the schema into prisma.config.ts, which loads DATABASE_URL from the environment via dotenv. The datasource block in schema.prisma only declares the postgresql provider with no url or directUrl fields.

What should I do when Prisma API returns a 401 or 429 error?

A 401 authentication-failed error means the service token is invalid or expired, so create a new one in Console under Workspace Settings. A 429 rate-limit-exceeded error means you should wait two to five seconds and retry, increasing the backoff if it repeats.

When should I not use this database setup workflow?

Do not use it for CI/CD preview databases, which belong to the prisma-postgres-cicd skill, or for building multi-tenant provisioning into an app, which belongs to prisma-postgres-integrator. Databases that already exist and are connected only need standard Prisma CLI migration tasks.