prisma-postgres-setup

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

Updated Jun 9, 2026
One-click install
npx skills add https://github.com/dlptho356/TTTN --skill prisma-postgres-setup-dlptho356
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-postgres-setup
Source: https://github.com/dlptho356/TTTN/tree/main/DATN/backend/.windsurf/skills/prisma-postgres-setup
Command: npx skills add https://github.com/dlptho356/TTTN --skill prisma-postgres-setup-dlptho356

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 a local project, 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, creates a project with a database, and polls until the database status is ready. - Local project configuration: Installs required packages, writes the direct connection string to .env, scaffolds prisma/schema.prisma and prisma.config.ts, and runs prisma migrate dev. - Connection verification: Generates and runs a test script using the Prisma 7 pg adapter to confirm end-to-end connectivity before finishing. - Use Case: A developer starting a new Node.js app asks to "set up a database" and receives a fully provisioned Prisma Postgres instance with migrations, generated client, and a verified connection. ## Quick Start Ask the agent to set up a new Prisma Postgres database for this project and connect it locally using your workspace service token.

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 regions via GET /v1/regions/postgres, then POST /v1/projects with createDatabase set to true. Extract the direct connection string from the response and store it as DATABASE_URL in your .env file.

How do I get a Prisma Postgres connection string?

Create a project with createDatabase enabled and read data.database.connections[0].endpoints.direct.connectionString from the API response. Use the direct endpoint, not the pooled or accelerate endpoints, which are intended for legacy Accelerate setups.

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. Calling new PrismaClient() with no arguments or with datasourceUrl throws in Prisma 7.

Where does the database URL go in Prisma 7, schema.prisma or prisma.config.ts?

In Prisma 7 the connection URL belongs in prisma.config.ts via the datasource url field, loaded from process.env with dotenv. The schema.prisma datasource block should only declare provider = "postgresql" with no url or directUrl.

Why does Prisma Management API return 401 authentication-failed?

A 401 means the service token is missing, invalid, or expired. Create a new token in Prisma Console under Workspace Settings, Service Tokens, and pass it as a Bearer token in the Authorization header of every request.

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 multi-tenant provisioning inside an app, which belongs to prisma-postgres-integrator. Existing connected databases only need standard Prisma CLI migration commands.