# PostgreSQL (/docs/prisma-orm/quickstart/postgresql)

> 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.

Create a new Prisma ORM project with PostgreSQL using create-prisma@latest.

Location: Prisma ORM > Quickstart > PostgreSQL

Create a Prisma ORM app with PostgreSQL and run your first query against seeded data.

> [!NOTE]
> Using Prisma ORM 7?
> 
> Prisma ORM 8 is the current release, as a release candidate. Prisma ORM 7 remains fully supported; its docs live at [/orm/v7](https://www.prisma.io/docs/orm/v7) and its setup paths at [/v7/getting-started](https://www.prisma.io/docs/v7/getting-started).
> 
> For what release candidate means, when the final release is expected, and how to stay on version 7, see [Release status](https://www.prisma.io/docs/prisma-orm/release-status). For the Prisma ORM 8 name of every Prisma ORM 7 API, see [Coming from Prisma ORM 7](https://www.prisma.io/docs/orm/coming-from-prisma-orm-7).

## Quick start [#quick-start]

  

#### bun

```bash
bun create prisma@latest --provider postgres
```

#### pnpm

```bash
pnpm create prisma@latest --provider postgres
```

#### yarn

```bash
yarn create prisma@latest --provider postgres
```

#### npm

```bash
npm create prisma@latest -- --provider postgres
```

Run this from a Node.js 22.18 or newer (on the 24 line, 24.11 or newer) environment; Node.js 24 is recommended. The command preselects PostgreSQL and prompts you for the contract authoring style (PSL or TypeScript) and your package manager.

Setup gives you the app template, a starter contract, `prisma-8.md`, project-level Prisma ORM skills for your coding agent, and package scripts for the database steps below. Answer no at the skills prompt, or pass `--skills none`, to skip the agent skill files; to remove them later, see [`skills sync`](https://www.prisma.io/docs/cli/skills) and the [`skills` config section](https://www.prisma.io/docs/cli/configuration#agent-skills). Sample users are seeded automatically the first time the app queries the database, so there is no separate seed step.

From here you have two paths: let [Prisma Composer](https://www.prisma.io/docs/composer) run a local Prisma Postgres database for you, or connect a PostgreSQL database you provide.

## Path A: Run with a local database [#path-a-run-with-a-local-database]

Composer builds the app, starts a local Prisma Postgres database, and applies the starter contract for you, so you do not need a connection string.

  

#### bun

```bash
bun run dev:composer
```

#### pnpm

```bash
pnpm run dev:composer
```

#### yarn

```bash
yarn dev:composer
```

#### npm

```bash
npm run dev:composer
```

Open the URL the command prints. You should see the seeded users returned from PostgreSQL.

## Path B: Connect your own database [#path-b-connect-your-own-database]

### 1. Set the database connection [#1-set-the-database-connection]

Export `DATABASE_URL` in the shell you run the commands from. The generated scripts read the variable from the environment, not from `.env`.

```bash
export DATABASE_URL="postgresql://username:password@host:5432/database?sslmode=require"
```

If you don't have a PostgreSQL database yet, `npx create-db@latest` creates a temporary Prisma Postgres database and prints its connection string, plus a claim URL if you want to keep it.

### 2. Initialize the database [#2-initialize-the-database]

From the generated project directory, run `db:init` to apply the starter contract to PostgreSQL and sign the database.

  

#### bun

```bash
bun run db:init
```

#### pnpm

```bash
pnpm run db:init
```

#### yarn

```bash
yarn db:init
```

#### npm

```bash
npm run db:init
```

The output ends with a summary like `Applied 5 operation(s) across 1 space(s), database signed`.

### 3. Run the app [#3-run-the-app]

Start the app and confirm the sample query runs successfully.

  

#### bun

```bash
bun run dev
```

#### pnpm

```bash
pnpm run dev
```

#### yarn

```bash
yarn dev
```

#### npm

```bash
npm run dev
```

Use the URL or terminal output shown by your template. You should see the seeded users returned from PostgreSQL. If the response is `Could not query users yet`, `DATABASE_URL` is not set in the environment the app runs in; export it in the same shell and restart.

## Next steps [#next-steps]

* Open `src/prisma/contract.prisma` or `src/prisma/contract.ts` and change the starter model.
* Use the [PostgreSQL existing-project guide](https://www.prisma.io/docs/prisma-orm/add-to-existing-project/postgresql) if you already have an app and database.
* Read the [Prisma ORM overview](https://www.prisma.io/docs/orm) when you want the concepts behind contracts, query APIs, and migrations.

## Related pages

- [`MongoDB`](https://www.prisma.io/docs/prisma-orm/quickstart/mongodb): Create a new Prisma ORM project with MongoDB using create-prisma@latest.