# init (/docs/cli/init)

Location: CLI > init

The `prisma init` command bootstraps a fresh Prisma project within the current directory.

Usage [#usage]

```bash
prisma init [options]
```

The command creates a `prisma` directory containing a `schema.prisma` file. By default, the project is configured for [local Prisma Postgres](/postgres/database/local-development), but you can choose a different database using the `--datasource-provider` option.

Options [#options]

| Option                  | Description                                                                                               |
| ----------------------- | --------------------------------------------------------------------------------------------------------- |
| `-h`, `--help`          | Display help message                                                                                      |
| `--db`                  | Provision a fully managed Prisma Postgres database on the Prisma Data Platform                            |
| `--datasource-provider` | Define the datasource provider: `postgresql`, `mysql`, `sqlite`, `sqlserver`, `mongodb`, or `cockroachdb` |
| `--generator-provider`  | Define the generator provider to use (default: `prisma-client`)                                           |
| `--preview-feature`     | Define a preview feature to use (can be specified multiple times)                                         |
| `--output`              | Define Prisma Client generator output path                                                                |
| `--url`                 | Define a custom datasource URL                                                                            |

Flags [#flags]

| Flag           | Description                                     |
| -------------- | ----------------------------------------------- |
| `--with-model` | Add an example model to the created schema file |

Examples [#examples]

Set up a new Prisma project (default) [#set-up-a-new-prisma-project-default]

Sets up a new project configured for local Prisma Postgres:

  

#### npm

```bash
npx prisma init
```

#### pnpm

```bash
pnpm dlx prisma init
```

#### yarn

```bash
yarn dlx prisma init
```

#### bun

```bash
bunx --bun prisma init
```

Specify a datasource provider [#specify-a-datasource-provider]

Set up a new project with MySQL as the datasource provider:

  

#### npm

```bash
npx prisma init --datasource-provider mysql
```

#### pnpm

```bash
pnpm dlx prisma init --datasource-provider mysql
```

#### yarn

```bash
yarn dlx prisma init --datasource-provider mysql
```

#### bun

```bash
bunx --bun prisma init --datasource-provider mysql
```

Specify a generator provider [#specify-a-generator-provider]

Set up a project with the legacy `prisma-client-js` generator instead of the default `prisma-client` generator:

  

#### npm

```bash
npx prisma init --generator-provider prisma-client-js
```

#### pnpm

```bash
pnpm dlx prisma init --generator-provider prisma-client-js
```

#### yarn

```bash
yarn dlx prisma init --generator-provider prisma-client-js
```

#### bun

```bash
bunx --bun prisma init --generator-provider prisma-client-js
```

Specify preview features [#specify-preview-features]

Set up a project with specific preview features enabled:

  

#### npm

```bash
npx prisma init --preview-feature metrics
```

#### pnpm

```bash
pnpm dlx prisma init --preview-feature metrics
```

#### yarn

```bash
yarn dlx prisma init --preview-feature metrics
```

#### bun

```bash
bunx --bun prisma init --preview-feature metrics
```

Multiple preview features:

  

#### npm

```bash
npx prisma init --preview-feature views --preview-feature metrics
```

#### pnpm

```bash
pnpm dlx prisma init --preview-feature views --preview-feature metrics
```

#### yarn

```bash
yarn dlx prisma init --preview-feature views --preview-feature metrics
```

#### bun

```bash
bunx --bun prisma init --preview-feature views --preview-feature metrics
```

Specify a custom output path [#specify-a-custom-output-path]

Set up a project with a custom output path for Prisma Client:

  

#### npm

```bash
npx prisma init --output ./generated-client
```

#### pnpm

```bash
pnpm dlx prisma init --output ./generated-client
```

#### yarn

```bash
yarn dlx prisma init --output ./generated-client
```

#### bun

```bash
bunx --bun prisma init --output ./generated-client
```

Specify a custom datasource URL [#specify-a-custom-datasource-url]

Set up a project with a specific database URL:

  

#### npm

```bash
npx prisma init --url mysql://user:password@localhost:3306/mydb
```

#### pnpm

```bash
pnpm dlx prisma init --url mysql://user:password@localhost:3306/mydb
```

#### yarn

```bash
yarn dlx prisma init --url mysql://user:password@localhost:3306/mydb
```

#### bun

```bash
bunx --bun prisma init --url mysql://user:password@localhost:3306/mydb
```

Add an example model [#add-an-example-model]

Set up a project with an example `User` model:

  

#### npm

```bash
npx prisma init --with-model
```

#### pnpm

```bash
pnpm dlx prisma init --with-model
```

#### yarn

```bash
yarn dlx prisma init --with-model
```

#### bun

```bash
bunx --bun prisma init --with-model
```

Provision a Prisma Postgres database [#provision-a-prisma-postgres-database]

Create a new project with a managed Prisma Postgres database:

  

#### npm

```bash
npx prisma init --db
```

#### pnpm

```bash
pnpm dlx prisma init --db
```

#### yarn

```bash
yarn dlx prisma init --db
```

#### bun

```bash
bunx --bun prisma init --db
```

This requires authentication with the [Prisma Data Platform Console](https://console.prisma.io/?utm_source=docs\&utm_medium=content\&utm_content=cli).

Generated files [#generated-files]

After running `prisma init`, you'll have the following files:

prisma/schema.prisma [#prismaschemaprisma]

The Prisma schema file where you define your data model:

```prisma
generator client {
  provider = "prisma-client"
  output   = "../generated/prisma"
}

datasource db {
  provider = "postgresql"
}
```

prisma.config.ts [#prismaconfigts]

A TypeScript configuration file for Prisma:

```typescript
import "dotenv/config";
import { defineConfig, env } from "prisma/config";

export default defineConfig({
  schema: "prisma/schema.prisma",
  migrations: {
    path: "prisma/migrations",
  },
  datasource: {
    url: env("DATABASE_URL"),
  },
});
```

.env [#env]

Environment variables file for your project:

```bash
DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
```

.gitignore [#gitignore]

Git ignore file configured for Prisma projects:

```bash
node_modules
.env
/generated/prisma
```

## Related pages

- [`db`](https://www.prisma.io/docs/cli/db): Manage your database schema and lifecycle during development
- [`debug`](https://www.prisma.io/docs/cli/debug): Display Prisma debug information including schema paths, engine binaries, environment variables, and cache directories for troubleshooting
- [`dev`](https://www.prisma.io/docs/cli/dev): Start a local Prisma Postgres server for development
- [`format`](https://www.prisma.io/docs/cli/format): Format and validate your Prisma schema file with consistent structure
- [`generate`](https://www.prisma.io/docs/cli/generate): Generate artifacts like Prisma Client based on your Prisma schema