# Prisma Postgres (/docs/postgres)

> For the complete Prisma documentation index, see [llms.txt](https://www.prisma.io/docs/llms.txt). A markdown version of any docs page is available by appending `.md` to its URL.

Connect to Prisma Postgres from Prisma ORM, serverless runtimes, and PostgreSQL clients.

Location: Prisma Postgres

[Prisma Postgres](https://www.prisma.io/postgres?utm_source=docs) is a managed PostgreSQL database with built-in connection pooling, query caching, and edge runtime support.

To your application it is a regular PostgreSQL database behind a connection string:

```text no-copy
Your application
      ↓ DATABASE_URL
Prisma Postgres
```

Any PostgreSQL client works: Prisma ORM, `psql`, Kysely, Drizzle, `node-postgres`, or anything else that speaks Postgres.

## Getting started [#getting-started]

### 1. Create a database [#1-create-a-database]

The fastest way, with no account required:

  

#### bun

```bash
bunx create-db@latest
```

#### pnpm

```bash
pnpm dlx create-db@latest
```

#### yarn

```bash
yarn dlx create-db@latest
```

#### npm

```bash
npx create-db@latest
```

`create-db` creates a temporary Prisma Postgres database and prints a connection string plus a claim URL. Open the claim URL to keep the database in your workspace. See [create-db](https://www.prisma.io/docs/postgres/npx-create-db) for details. You can also create databases in the [Console](https://console.prisma.io/?utm_source=docs\&utm_medium=content\&utm_content=postgres) or with the [Prisma CLI](https://www.prisma.io/docs/cli/v8/postgres) (`npx prisma@next postgres create`).

### 2. Copy the connection string [#2-copy-the-connection-string]

`create-db` prints it once. For an existing database, open it in [Prisma Console](https://console.prisma.io/?utm_source=docs\&utm_medium=content\&utm_content=postgres) and click **Connect to your database**. Store it where your app reads configuration:

```text title=".env"
DATABASE_URL="postgres://...@db.prisma.io:5432/postgres?sslmode=require"
```

### 3. Connect and run a query [#3-connect-and-run-a-query]

Pick the client you use; each quickstart takes you from connection string to a first query:

- [Prisma 8 quickstart](https://www.prisma.io/docs/prisma-postgres/quickstart/prisma-next): Define a data contract and query with Prisma 8 (Release Candidate).

- [Prisma ORM 7 quickstart](https://www.prisma.io/docs/prisma-orm/quickstart/prisma-postgres): Connect with the current GA release of Prisma ORM.

- [Kysely quickstart](https://www.prisma.io/docs/prisma-postgres/quickstart/kysely): Connect Prisma Postgres from Kysely.

- [Drizzle ORM quickstart](https://www.prisma.io/docs/prisma-postgres/quickstart/drizzle-orm): Connect Prisma Postgres from Drizzle ORM.

Also available: the [TypeORM quickstart](https://www.prisma.io/docs/prisma-postgres/quickstart/typeorm) and [Connecting to your database](https://www.prisma.io/docs/postgres/database/connecting-to-your-database), which covers connection strings for `psql`, GUI tools, and serverless runtimes.

Working with a coding agent? Copy this prompt:

```text
Create a Prisma Postgres database for this project.

1. Run `npx create-db@latest`. It creates a temporary Prisma Postgres database without an account and prints a connection string plus a claim URL.
2. Put the connection string in `.env` as DATABASE_URL and wire it into whichever of Prisma ORM, Kysely, Drizzle, TypeORM, or node-postgres the project already uses (detect it from package.json; if none, ask me). Verify the connection with one trivial query such as `select 1`.
3. Remind me to open the claim URL to keep the database in my Prisma workspace.

Current docs: https://www.prisma.io/docs/postgres.md.
```

## What's included [#whats-included]

Each Prisma Postgres database includes the following, with no extra services to configure:

* **Connection pooling**: a dedicated PgBouncer instance runs alongside your database, with nothing to set up or manage. It also works for serverless and edge deployments. See [Connection pooling](https://www.prisma.io/docs/postgres/database/connection-pooling).
* **Query caching**: add a `cacheStrategy` to any Prisma ORM query to cache results at the edge, using TTL or stale-while-revalidate. See [Caching](https://www.prisma.io/docs/accelerate/caching).
* **Edge and serverless support**: connect from Cloudflare Workers, Vercel Edge Functions, and other edge runtimes via the [serverless driver](https://www.prisma.io/docs/postgres/database/serverless-driver), which uses HTTP instead of TCP.
* **Automated backups**: daily backups with point-in-time recovery. See [Backups](https://www.prisma.io/docs/postgres/database/backups).

## Local development [#local-development]

Run Prisma Postgres locally with `prisma dev`, then switch to cloud when ready.

* [Local development](https://www.prisma.io/docs/postgres/database/local-development)

## Use with the rest of Prisma [#use-with-the-rest-of-prisma]

Each integration is optional. Prisma Postgres works with any PostgreSQL client.

* Using [Prisma 8](https://www.prisma.io/docs/v8)? The quickstart provisions a database and connects it to your data contract.
* Deploying on [Prisma Compute](https://www.prisma.io/docs/compute)? Each branch of a Compute project can have its own Prisma Postgres database; pass the connection string through [environment variables](https://www.prisma.io/docs/compute/environment-variables).
* Building a multi-service application? [Prisma Composer](https://www.prisma.io/docs/composer/databases) declares a database as a service dependency and injects the connection at runtime.

## Manage [#manage]

* [Connecting to your database](https://www.prisma.io/docs/postgres/database/connecting-to-your-database)
* [Connection pooling](https://www.prisma.io/docs/postgres/database/connection-pooling)
* [Caching](https://www.prisma.io/docs/accelerate/caching)
* [Backups](https://www.prisma.io/docs/postgres/database/backups)
* [PostgreSQL extensions](https://www.prisma.io/docs/postgres/database/postgres-extensions)
* [Troubleshooting](https://www.prisma.io/docs/postgres/troubleshooting)
* [FAQ](https://www.prisma.io/docs/postgres/faq)

## Billing and limits [#billing-and-limits]

Prisma Postgres uses usage-based pricing and includes spend controls.

* [Pricing](https://www.prisma.io/pricing)
* [Operations-based billing explained](https://www.prisma.io/blog/operations-based-billing?utm_source=docs)
* [FAQ: estimating costs](https://www.prisma.io/docs/postgres/faq#is-there-a-sample-workload-to-estimate-my-expected-charges)

In Prisma Console, you can track usage, set spend limits, and view billing details.

<img alt="Billing and Usage dashboard metrics." src="/img/postgres/billing-metrics.png" width="1920" height="1080" />

## Technical details [#technical-details]

Prisma Postgres is based on **PostgreSQL v17** and uses a unikernel-based architecture.

Learn more: [Prisma Postgres: Building a modern PostgreSQL service](https://pris.ly/ppg-early-access?utm_source=docs).

> [!NOTE]
> Note
> 
> Postgres, PostgreSQL, and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada and are used with permission.

## Related pages

- [`Build faster with Prisma + AI`](https://www.prisma.io/docs/ai): Build faster with Prisma and AI coding tools like Cursor, Codex, and ChatGPT
- [`CLI Overview`](https://www.prisma.io/docs/cli): The Prisma CLI is the command-line interface for Prisma ORM. Use it to initialize projects, generate Prisma Client, manage databases, run migrations, and more
- [`Console`](https://www.prisma.io/docs/console): Learn how to use the Console to manage and integrate Prisma products into your application.
- [`Guides`](https://www.prisma.io/docs/guides): A collection of guides for various tasks and workflows
- [`Introduction to Prisma 8`](https://www.prisma.io/docs/v8): Prisma 8 is the next major version of Prisma ORM, available as a Release Candidate.