# 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 managed PostgreSQL 17 with PgBouncer pooling on every plan and daily backups on paid plans, taken only on days the database has activity; host the app next to it on [Prisma Compute](https://www.prisma.io/docs/compute), or connect from any Postgres client. Prisma Postgres autoscales: there is no instance to size or upgrade, and you pay for operations and storage. Coding agents can create databases, change the schema, run SQL and restore a backup into a new database through the [Prisma MCP server](https://www.prisma.io/docs/ai/tools/mcp-server). 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 and claim it with a free Prisma account 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/postgres) (`npx prisma postgres create`). If your data already lives in a PostgreSQL database on your laptop or another host, [migrate it to Prisma Postgres](https://www.prisma.io/docs/postgres/import-from-existing-database) in three steps: create the database, `pg_dump`, `pg_restore`. ### 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 ORM quickstart](https://www.prisma.io/docs/prisma-postgres/quickstart/prisma-orm): Define a data contract and query with Prisma ORM. - [Prisma ORM 7 quickstart](https://www.prisma.io/docs/v7/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. If you work 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 (claiming needs a free Prisma account). Current docs: https://www.prisma.io/docs/postgres.md. ``` ### Already have a Prisma schema? [#already-have-a-prisma-schema] If your project already has a `prisma/schema.prisma` file for PostgreSQL (Prisma ORM 7 or earlier), skip the quickstarts and apply your schema to a new database. These steps create the tables, not the rows: to bring existing data from another PostgreSQL database, local or hosted, follow [Import from PostgreSQL](https://www.prisma.io/docs/prisma-postgres/import-from-existing-database-postgresql) instead. Install the project's dependencies first, so `npx prisma` runs the project's Prisma CLI. If `package.json` lists `@prisma/client` but not `prisma`, add `prisma` as a dev dependency at the same version as `@prisma/client`. 1. Create the database and write its connection string to `.env`. `create-db` needs Node.js 20.12 or later; on an older Node.js, create the database in the [Console](https://console.prisma.io/?utm_source=docs\&utm_medium=content\&utm_content=postgres) and copy its direct connection string into `.env` instead. #### bun ```bash bunx create-db@latest --env .env ``` #### pnpm ```bash pnpm dlx create-db@latest --env .env ``` #### yarn ```bash yarn dlx create-db@latest --env .env ``` #### npm ```bash npx create-db@latest --env .env ``` `--env .env` appends `DATABASE_URL` and `CLAIM_URL` to `.env`. If the file already had either line, delete the older one, so the claim URL you open belongs to the new database. In a Prisma ORM 6 project, also remove `DATABASE_URL` from `prisma/.env` if that file sets it: Prisma ORM 6 stops with an error when both files set the same variable. The connection string uses the direct host, `db.prisma.io`, which is the one migrations need. 2. Point the Prisma CLI at the new database before you run a migration: * If the config or the schema's `datasource` block reads another variable for migrations, such as `DIRECT_URL`, set it to the same connection string. * If your shell already sets `DATABASE_URL` or that variable, unset it: a value set in the shell is used instead of the one in `.env`. * If the project has a `prisma.config.ts` (every Prisma ORM 7 project does), it loads `.env` only when it starts with `import "dotenv/config"`, with `dotenv` installed. Add the line if it is missing ([Prisma Config reference](https://www.prisma.io/docs/orm/v7/reference/prisma-config-reference)). 3. Apply the schema: #### bun ```bash bunx prisma migrate deploy ``` #### pnpm ```bash pnpm prisma migrate deploy ``` #### yarn ```bash yarn prisma migrate deploy ``` #### npm ```bash npx prisma migrate deploy ``` `migrate deploy` applies the migrations in the project's migrations folder that the database has not run yet: `prisma/migrations`, unless `prisma.config.ts` sets another `migrations.path`. It applies nothing else, so if the schema has changes that no migration contains yet, create that migration first with `npx prisma migrate dev` against a development database. If the project has never used Prisma Migrate and has no migrations folder, `npx prisma db push` creates the tables from the schema instead. Before the database serves production traffic: * Open `CLAIM_URL` and claim the database with a free Prisma account. Unclaimed databases are deleted after 24 hours. * Give the app the pooled connection string in `DATABASE_URL`, and put the direct one in a separate variable, such as `DIRECT_URL`, that the Prisma CLI reads for migrations. Migrations through the pooler can fail with lock or prepared-statement errors ([Recommended setups](https://www.prisma.io/docs/postgres/database/connecting-to-your-database#recommended-setups)). * Pick a plan with backups: daily backups are kept for 7 days on Starter and Pro and for 30 days on Business. The Free plan has no backups. ## 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). * **Edge and serverless support**: connect from Cloudflare Workers, Vercel Functions on the Edge runtime, 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** (Starter, Pro, and Business plans): daily snapshots, taken only on days the database has activity, kept for 7 or 30 days depending on the plan. The Console restores one in place, keeping the connection strings, or into a new database; the Prisma CLI and the REST API's restore endpoint restore in place, and the REST API and the MCP server can also restore into a new database. Point-in-time recovery is coming in November 2026. 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 Postgres](https://www.prisma.io/docs/local-development/postgres) ## Use with the rest of Prisma [#use-with-the-rest-of-prisma] Each integration is optional, and Prisma Postgres works with any PostgreSQL client. * If you use [Prisma ORM](https://www.prisma.io/docs/prisma-orm), the quickstart provisions a database and connects it to your data contract. * If you deploy 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). * For 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. Comparing hosts? [Neon alternatives with app hosting and Postgres in one place](https://www.prisma.io/blog/neon-vs-prisma-postgres-app-hosting-in-one-place?utm_source=docs) and [App hosting platforms with managed Postgres compared (2026)](https://www.prisma.io/blog/app-hosting-platforms-with-managed-postgres-2026?utm_source=docs) compare Prisma Postgres + Prisma Compute with other app and database hosts. ## 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) * [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. ![Billing and Usage dashboard metrics.](https://www.prisma.io/img/postgres/billing-metrics.png) ## 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 - [`Choose a Prisma ORM setup path`](https://www.prisma.io/docs/getting-started): Choose the fastest path to try Prisma ORM in a new or existing project. - [`Console`](https://www.prisma.io/docs/console): Learn how to use the Console to manage and integrate Prisma products into your application. - [`Introduction to Prisma ORM`](https://www.prisma.io/docs/prisma-orm): Prisma ORM 8 is a release candidate. - [`Local development`](https://www.prisma.io/docs/local-development): Run the whole Prisma stack on your machine, with your app on Bun, a local Prisma Postgres database, and local object storage. - [`Overview`](https://www.prisma.io/docs/cli): Prisma CLI reference