# prisma-next db init (/docs/cli/next/db-init)

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

Initialize a database from the current Prisma Next contract.

Location: CLI > Next > prisma-next db init

`prisma-next db init` creates missing database structures from the current emitted contract and signs the database.

Use it for first setup of a database that should match your current contract.

## Usage [#usage]

```bash
prisma-next db init --db "$DATABASE_URL"
```

## Options [#options]

| Option            | What it does                                    |
| ----------------- | ----------------------------------------------- |
| `--db <url>`      | Connects to the database.                       |
| `--config <path>` | Reads a specific `prisma-next.config.ts` file.  |
| `--dry-run`       | Shows planned operations without applying them. |
| `--json`          | Prints a machine-readable result.               |

## Behavior [#behavior]

`db init` is intended for bootstrap work. It creates missing structures needed by the contract and writes the contract marker after the database matches.

Run a dry run first when you are not working with a disposable local database:

```bash
prisma-next db init --db "$DATABASE_URL" --dry-run
```

## Examples [#examples]

```bash
prisma-next contract emit
prisma-next db init --db "$DATABASE_URL"
prisma-next db verify --db "$DATABASE_URL"
```

```bash
prisma-next db init --db "$DATABASE_URL" --dry-run --json
```

## When to use db update instead [#when-to-use-db-update-instead]

Use [`prisma-next db update`](https://www.prisma.io/docs/cli/next/db-update) when the database already exists and you want Prisma Next to reconcile it with a changed contract. Use [`prisma-next migration plan`](https://www.prisma.io/docs/cli/next/migration-plan) when you want a reviewable migration package in version control.

## Related pages

- [`CLI configuration`](https://www.prisma.io/docs/cli/next/configuration): Configure Prisma Next CLI commands with prisma-next.config.ts and global flags.
- [`prisma-next contract emit`](https://www.prisma.io/docs/cli/next/contract-emit): Emit Prisma Next contract artifacts.
- [`prisma-next contract infer`](https://www.prisma.io/docs/cli/next/contract-infer): Infer a starter contract from an existing database.
- [`prisma-next db schema`](https://www.prisma.io/docs/cli/next/db-schema): Inspect a live database schema.
- [`prisma-next db sign`](https://www.prisma.io/docs/cli/next/db-sign): Sign a database with the current Prisma Next contract.