Repository navigation
docs(prisma): update the Prisma guide to Prisma ORM 8 and fix dead links - #9357
Merged
Merged
Conversation
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.
|
This was referenced Nov 2, 2026
ankur-arch
marked this pull request as ready for review
November 3, 2026 14:53
Varixo
reviewed
Nov 3, 2026
Varixo
left a comment
Member
There was a problem hiding this comment.
Hello! Thanks for the PR. Added small question
Varixo
enabled auto-merge
November 4, 2026 08:17
@qwik.dev/core
@qwik.dev/router
@qwik.dev/utils
eslint-plugin-qwik
create-qwik
@qwik.dev/optimizer
@qwik.dev/devtools
@qwik.dev/mcp
commit: |
3 tasks done
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is it?
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
npx prisma@latest orm init, which writes the contract file, a shared database client (src/prisma/db.ts) andprisma.config.ts. A note explains thatqwik add prismastill installs the older Prisma ORM 5 starter with SQLite.npx create-db@latest --env .envcreates a temporary Prisma Postgres database without an account.dbclient 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)).fail(409, ...)on a duplicate email instead of a 500, shows that message or thezod$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$andzare imported from@qwik.dev/router, which the starter installs.@qwik.dev/utilsis not in the starter's dependencies.src/prisma/contract.d.tshas to be added to the eslint ignores, otherwisenpm run buildfails at the starter's lint step.contract emit+db update) and on production env vars, including theORIGINnote from the Node middleware page./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 -- emptyapp (Qwik 2.0.0-rc.4, Node 24.11), with the route files copied out of this.mdxfile:tsc --noEmit,eslint "src/**/*.ts*"andnpm run buildpass.npm run dev, against acreate-dbPrisma Postgres database: create returns 200 and the user shows up in/usersand/users/1; a duplicate email returns 409 with the message; an invalid email returns 400;/users/999returns 404. Also clicked through the form in Chrome with JavaScript on.contract emit+db update, adds the column.node-serveradapter and deployed it to a Node hosting environment (Prisma Compute) withDATABASE_URLandORIGINset. Writes and reads worked against the hosted database and the data survived a redeploy. WithoutORIGIN, 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 andorm initfailed at its emit step (prisma/prisma-cli#382, now closed).prisma@8.0.0-rc.30fixes that. I repeated every step on the page on a newnpm create qwik@rc -- emptyapp with the publishedlatesttags, no pins:orm init,create-db,contract emit,db init, the three routes,npm run build, and the same 200/409/400/404 checks withnpm run dev. All pass, so this is ready for review.The prisma.io links on the page carry
utm_source=qwik&utm_medium=docsso 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 prismastarter is updated to Prisma ORM 8 in #9358; once both land, the note above aboutqwik add prismawill change to point at it.Checklist