Skip to content

docs(docs): align quickstart prisma.config.ts with actual prisma init output#7927

Open
morgan-coded wants to merge 1 commit into
prisma:mainfrom
morgan-coded:docs/7818-align-prisma-config-output
Open

docs(docs): align quickstart prisma.config.ts with actual prisma init output#7927
morgan-coded wants to merge 1 commit into
prisma:mainfrom
morgan-coded:docs/7818-align-prisma-config-output

Conversation

@morgan-coded
Copy link
Copy Markdown

@morgan-coded morgan-coded commented May 29, 2026

What

The quickstart guides show the generated prisma.config.ts as:

import "dotenv/config";
import { defineConfig, env } from "prisma/config";
...
  datasource: { url: env("DATABASE_URL") }

But prisma init (standard npm/pnpm/yarn, i.e. the non-Bun runtime) actually
generates:

import "dotenv/config";
import { defineConfig } from "prisma/config";
...
  datasource: { url: process.env["DATABASE_URL"] }

The env() import/accessor is only emitted on the Bun runtime branch. In
packages/cli/src/Init.ts, defaultConfig picks the template with
runtime: isBun ? 'bun' : 'other', and the 'other' branch uses
import { defineConfig } + process.env["DATABASE_URL"]. The datasource
provider and --db flag don't change this. So the docs were incorrect for the
standard flow every quickstart describes (they all install via npm + dotenv).

Reported in #7818.

Change

Update the prisma.config.ts example to match the actual non-Bun output on the
7 single-block quickstarts: postgresql, prisma-postgres, mysql, sqlite,
sql-server, cockroachdb, planetscale.

mongodb is intentionally left out — it presents a different two-step
"generated, then add dotenv" narrative with engine: "classic", and should be
reviewed separately.

Testing

  • pnpm run lint:spellcheck — passes.
  • Verified the replacement against prisma/prisma packages/cli/src/Init.ts
    (defaultConfig, runtime: 'other' branch).

Closes #7818

Summary by CodeRabbit

  • Documentation
    • Updated Prisma quickstart guides across all supported databases: example config snippets now read DATABASE_URL directly from environment variables (removing a helper import) to simplify connection setup and make environment configuration clearer.

The quickstarts show the generated prisma.config.ts importing env from
prisma/config and using env("DATABASE_URL"), but prisma init (non-Bun runtime)
actually emits import { defineConfig } and url: process.env["DATABASE_URL"]
(see packages/cli/src/Init.ts defaultConfig, the runtime: "other" branch). The
runtime is bun only when the CLI itself runs under Bun, so every standard
npm/pnpm/yarn init produces the process.env form. Update the 7 single-block
quickstarts to match. mongodb is intentionally left out: it presents a
different two-step (generated then add dotenv) narrative with engine: "classic"
and needs a separate review.

Linear: N/A (external community contribution)
Copilot AI review requested due to automatic review settings May 29, 2026 15:16
@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

@morgan-coded is attempting to deploy a commit to the Prisma Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates Prisma ORM quickstart docs to use process.env for DATABASE_URL in prisma.config.ts examples instead of Prisma’s env() helper.

Changes:

  • Remove env import from prisma/config in multiple quickstart guides.
  • Replace env("DATABASE_URL") with process.env["DATABASE_URL"] in datasource configuration examples.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
apps/docs/content/docs/(index)/prisma-orm/quickstart/sqlite.mdx Adjusts prisma.config.ts snippet to read DATABASE_URL from process.env.
apps/docs/content/docs/(index)/prisma-orm/quickstart/sql-server.mdx Same env-var retrieval change in the SQL Server quickstart snippet.
apps/docs/content/docs/(index)/prisma-orm/quickstart/prisma-postgres.mdx Same env-var retrieval change in the Prisma Postgres quickstart snippet.
apps/docs/content/docs/(index)/prisma-orm/quickstart/postgresql.mdx Same env-var retrieval change in the PostgreSQL quickstart snippet.
apps/docs/content/docs/(index)/prisma-orm/quickstart/planetscale.mdx Same env-var retrieval change in the PlanetScale quickstart snippet.
apps/docs/content/docs/(index)/prisma-orm/quickstart/mysql.mdx Same env-var retrieval change in the MySQL quickstart snippet.
apps/docs/content/docs/(index)/prisma-orm/quickstart/cockroachdb.mdx Same env-var retrieval change in the CockroachDB quickstart snippet.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

```typescript title="prisma.config.ts"
import "dotenv/config";
import { defineConfig, env } from "prisma/config";
import { defineConfig } from "prisma/config";
},
datasource: {
url: env("DATABASE_URL"),
url: process.env["DATABASE_URL"],
```typescript title="prisma.config.ts"
import "dotenv/config";
import { defineConfig, env } from "prisma/config";
import { defineConfig } from "prisma/config";
},
datasource: {
url: env("DATABASE_URL"),
url: process.env["DATABASE_URL"],
@@ -98,15 +98,15 @@ The generated `prisma.config.ts` file looks like this:

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 919e789b-9e2d-4234-801f-01b42530980b

📥 Commits

Reviewing files that changed from the base of the PR and between 879940a and 1552505.

📒 Files selected for processing (7)
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/cockroachdb.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/mysql.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/planetscale.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/postgresql.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/prisma-postgres.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/sql-server.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/sqlite.mdx
✅ Files skipped from review due to trivial changes (2)
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/sql-server.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/sqlite.mdx
🚧 Files skipped from review as they are similar to previous changes (5)
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/prisma-postgres.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/mysql.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/cockroachdb.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/planetscale.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/postgresql.mdx

Walkthrough

This PR updates seven Prisma quickstart docs to align their prisma.config.ts examples with prisma init output by removing the env helper import and using process.env["DATABASE_URL"] for the datasource URL.

Changes

Database Quickstart Config Examples

Layer / File(s) Summary
Update quickstart config examples across all database providers
apps/docs/content/docs/(index)/prisma-orm/quickstart/cockroachdb.mdx, apps/docs/content/docs/(index)/prisma-orm/quickstart/mysql.mdx, apps/docs/content/docs/(index)/prisma-orm/quickstart/planetscale.mdx, apps/docs/content/docs/(index)/prisma-orm/quickstart/postgresql.mdx, apps/docs/content/docs/(index)/prisma-orm/quickstart/prisma-postgres.mdx, apps/docs/content/docs/(index)/prisma-orm/quickstart/sql-server.mdx, apps/docs/content/docs/(index)/prisma-orm/quickstart/sqlite.mdx
Each quickstart prisma.config.ts example removes the env import (imports only defineConfig, plus import "dotenv/config"; where present) and sets datasource.url to process.env["DATABASE_URL"] instead of env("DATABASE_URL").

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: aligning quickstart prisma.config.ts examples with actual prisma init output.
Linked Issues check ✅ Passed The PR successfully addresses issue #7818 by updating all seven quickstart examples to match the actual prisma init output, replacing env() helper with process.env.
Out of Scope Changes check ✅ Passed All changes are narrowly focused on updating prisma.config.ts examples to match actual prisma init output; MongoDB quickstart correctly excluded due to different generation flow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@morgan-coded morgan-coded force-pushed the docs/7818-align-prisma-config-output branch from 879940a to 1552505 Compare June 4, 2026 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prisma init ... command generates different output, than what is shown in the docs

2 participants