Skip to content

docs(prisma): update the Prisma guide to Prisma ORM 8 and fix dead links - #9357

Merged
Varixo merged 4 commits into
QwikDev:mainfrom
ankur-arch:docs/prisma-orm-8
Nov 4, 2026
Merged

Varixo merged 4 commits into
QwikDev:mainfrom
ankur-arch:docs/prisma-orm-8

Conversation

@ankur-arch

@ankur-arch ankur-arch commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

What is it?

  • Docs / tests / types / typos

Description

The Prisma integration page was last updated in October 2023. Its examples use the Prisma ORM 5 API (new PrismaClient() per request), and its two Prisma docs links now redirect. This PR moves the page to Prisma ORM 8 with PostgreSQL and keeps the same three examples: list users, show a user, add a user.

What changed

  • Setup now uses npx prisma@latest orm init, which writes the contract file, a shared database client (src/prisma/db.ts) and prisma.config.ts. A note explains that qwik add prisma still installs the older Prisma ORM 5 starter with SQLite.
  • A short "Create a database" section: any PostgreSQL 15+ connection string works, or npx create-db@latest --env .env creates a temporary Prisma Postgres database without an account.
  • The examples import one shared db client instead of creating a client in every loader and action, and use the Prisma ORM 8 query API (db.orm.public.User.all(), .where({ id }).first(), .create(data)).
  • The create example returns fail(409, ...) on a duplicate email instead of a 500, shows that message or the zod$ field error for the email, and only shows the success message when the action did not fail. Before, a failed zod validation also showed "User created successfully!".
  • zod$ and z are imported from @qwik.dev/router, which the starter installs. @qwik.dev/utils is not in the starter's dependencies.
  • The generated src/prisma/contract.d.ts has to be added to the eslint ignores, otherwise npm run build fails at the starter's lint step.
  • Short sections on changing the data model (contract emit + db update) and on production env vars, including the ORIGIN note from the Node middleware page.
  • Fixed the two redirecting links (/docs/concepts/database-connectors/...).

How I tested it

Every command and code block on the page was run on a fresh npm create qwik@rc -- empty app (Qwik 2.0.0-rc.4, Node 24.11), with the route files copied out of this .mdx file:

  • tsc --noEmit, eslint "src/**/*.ts*" and npm run build pass.
  • With npm run dev, against a create-db Prisma Postgres database: create returns 200 and the user shows up in /users and /users/1; a duplicate email returns 409 with the message; an invalid email returns 400; /users/999 returns 404. Also clicked through the form in Chrome with JavaScript on.
  • Adding a field, then contract emit + db update, adds the column.
  • Separately, I built the app with the node-server adapter and deployed it to a Node hosting environment (Prisma Compute) with DATABASE_URL and ORIGIN set. Writes and reads worked against the hosted database and the data survived a redeploy. Without ORIGIN, form posts failed the CSRF check, which is why the page mentions it.

Rerun on the released versions (2026-11-03)

The first version of this PR was a draft because the published prisma@latest (8.0.0-rc.29) and @prisma/orm-postgres@latest (8.0.0-rc.22) were out of step and orm init failed at its emit step (prisma/prisma-cli#382, now closed). prisma@8.0.0-rc.30 fixes that. I repeated every step on the page on a new npm create qwik@rc -- empty app with the published latest tags, no pins: orm init, create-db, contract emit, db init, the three routes, npm run build, and the same 200/409/400/404 checks with npm run dev. All pass, so this is ready for review.

The prisma.io links on the page carry utm_source=qwik&utm_medium=docs so we can see how many readers the Qwik docs send over. Happy to drop them if you prefer plain links.

Disclosure: I work at Prisma. Happy to trim or reword anything. The qwik add prisma starter is updated to Prisma ORM 8 in #9358; once both land, the note above about qwik add prisma will change to point at it.

Checklist

The page still used the Prisma ORM 5 API and created a new client in
every loader and action. It now sets up Prisma ORM 8 with orm init,
shares one client from src/prisma/db.ts, shows how to create a Prisma
Postgres or other PostgreSQL database, and handles duplicate emails in
the create example. The two Prisma docs links that redirected now point
at current pages.
@changeset-bot

changeset-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 99035aa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5157d4fd-b3d8-4278-add6-d102ed31bd76
Commits

Reviewing files that changed from the base of the PR and between 77f6cae and 99035aa.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The Prisma integration guide now covers Prisma ORM 8 with PostgreSQL. It documents database and contract setup, user queries and creation, contract updates, and deployment configuration.

Changes: Prisma integration guide

Layer / File(s) Summary
PostgreSQL and contract setup
packages/docs/src/routes/docs/integrations/prisma/index.mdx
The guide documents PostgreSQL initialization, a shared server-side database client, the User contract, and commands to emit and initialize the contract.
Contract-based user queries
packages/docs/src/routes/docs/integrations/prisma/index.mdx
The list and detail examples query through db.orm.public.User. The detail example uses .first() and documents its null result when no row matches.
User creation and deployment
packages/docs/src/routes/docs/integrations/prisma/index.mdx
The create example handles PostgreSQL unique-constraint errors and displays form results. The guide adds instructions for contract updates and deployment environment variables.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: gioboa, varixo

Merge Risk: Minimal · previous review 77f6c

The PostgreSQL setup and user examples are consistent, with no identified issue blocking merge.

Architecture risk: Low · up to 77f6c

The change affects 1 system.

Changed systems: packages/docs

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — packages/docs (api) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in packages/docs/src/routes/docs/integrations/prisma/index.mdx: The guide replaces the Qwik CLI/Prisma Client setup instructions with Prisma ORM 8 initialization for PostgreSQL. It documents the generated contract, database client, and CLI configuration files; a server-wide client using DATABASE_URL; and adding the generated declaration file to ESLint ignores.
  • observed — Modified behavior in packages/docs/src/routes/docs/integrations/prisma/index.mdx: The setup now requires PostgreSQL 15 or newer, documents creating a temporary Prisma Postgres database or configuring another database URL, and replaces the previous generic database/schema guidance with a User contract and contract emit/db init commands. It states that emission writes contract files and initialization creates the table and records the contract.
  • observed — Modified behavior in packages/docs/src/routes/docs/integrations/prisma/index.mdx: The user-list example replaces PrismaClient construction and prisma.user.findMany() with db.orm.public.User.all() in the route loader; the text identifies the PostgreSQL schema-qualified model path.
  • observed — Modified behavior in packages/docs/src/routes/docs/integrations/prisma/index.mdx: The listing markup now formats the returned JSX with a multiline user link, and the guide adds that returned rows are typed from the contract. The detail example replaces PrismaClient.findUnique() with db.orm.public.User.where({ id: userId }).first() and documents that first() returns null when no row matches.
Pre-merge checks: Passed 4
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change, which is updating the Prisma integration guide from Prisma ORM 5 to Prisma ORM 8. It also names the second change, fixing dead links. The raw summary and PR objectives…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change, which is updating the Prisma integration guide from Prisma ORM 5 to Prisma ORM 8. It also names the second change, fixing dead links. The raw summary and PR objectives both describe these changes, and the title uses the docs scope with a conventional commit style. The title is 72 characters, which is within a normal single-line length, and it is specific enough for a teammate to identify the primary change.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 721d1ef4-0168-49ff-81ff-b75e8b8beb26
Commits

Reviewing files that changed from the base of the PR and between 5958a0c and 77f6cae.

Files selected for processing: 1
  • packages/docs/src/routes/docs/integrations/prisma/index.mdx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@ankur-arch
ankur-arch marked this pull request as ready for review November 3, 2026 14:53
@ankur-arch
ankur-arch requested a review from a team as a code owner November 3, 2026 14:53

@Varixo Varixo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hello! Thanks for the PR. Added small question

@Varixo Varixo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for the PR

@Varixo
Varixo enabled auto-merge November 4, 2026 08:17
@pkg-pr-new

pkg-pr-new Bot commented Nov 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

@qwik.dev/core

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@9357

@qwik.dev/router

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/router@9357

@qwik.dev/utils

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/utils@9357

eslint-plugin-qwik

npm i https://pkg.pr.new/QwikDev/qwik/eslint-plugin-qwik@9357

create-qwik

npm i https://pkg.pr.new/QwikDev/qwik/create-qwik@9357

@qwik.dev/optimizer

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/optimizer@9357

@qwik.dev/devtools

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/devtools@9357

@qwik.dev/mcp

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/mcp@9357

commit: 99035aa

@Varixo
Varixo merged commit fc71359 into QwikDev:main Nov 4, 2026
55 checks passed
Varixo pushed a commit that referenced this pull request Nov 4, 2026
…greSQL

The qwik add prisma starter installed Prisma ORM 5.3.1 with SQLite and
created a new PrismaClient in every loader and action. It now adds
Prisma ORM 8 with a PostgreSQL contract, one shared database client in
prisma/db.ts, and the three demo routes on the ORM 8 query API. The
post-install step is prisma contract emit, and prisma:db:init and
prisma:db:update scripts apply the contract to the database.

Generated files stay in prisma/ so the starter's lint step does not
pick up the generated contract.d.ts.

Related: #9357
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.

2 participants