Skip to content

docs(guides): Prisma Next guides with a Guides version dropdown (DR-8689)#8022

Open
ankur-arch wants to merge 1 commit into
mainfrom
pn-guides-DR-8689
Open

docs(guides): Prisma Next guides with a Guides version dropdown (DR-8689)#8022
ankur-arch wants to merge 1 commit into
mainfrom
pn-guides-DR-8689

Conversation

@ankur-arch

@ankur-arch ankur-arch commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Adds the Prisma Next guides section behind a new Guides version dropdown, with the first tested batch of converted guides and the documented plan for the future URL cutover.

Linear: DR-8689

Version dropdown

The guides section now versions the same way the CLI section does: /guides stays the Prisma 7 tree, /guides/next holds the Prisma Next tree, and the sidebar shows a "Guides version" dropdown on both. Implemented in version.ts (pathname detection, switch-path mapping with available-path fallback, versioned nav), the VersionSwitcher, and versioned-sidebar-tree.ts (each version's sidebar hides the other tree). Verified in the rendered HTML: the latest view has zero anchors into /guides/next, and the next view scopes to its own tree.

Converted guides (batch 1, every flow run end to end)

Each guide was executed against a live Prisma Postgres database (bunx create-db) before writing; the outputs shown in the pages are captured from those runs.

Guide What was tested
Bun (/guides/next/bun) create-prisma scaffold with Bun, contract:emit, db:init ("Applied 5 operation(s)... database signed"), first typed query via bun run dev with its output
Deno (/guides/next/deno) Same flow via deno run -A npm:prisma-next ...; both Deno-specific gotchas were hit for real and documented: relative imports need the .ts extension, and the tsconfig options warning is harmless
Hono (/guides/next/hono) --template hono scaffold, seed, GET /users served over HTTP with the JSON captured, plus an added POST /users route returning the created row (201)

The guides are honest about one template issue: the generated seed.ts/users.ts still use the flat db.orm.User form, which crashes on 0.14.0, so each guide includes the one-line fix (db.orm.public.User) with a note that the step disappears when the templates are fixed (tracked alongside prisma-next#917).

Conversion scope and queue

This is deliberately an incremental first batch per DR-8689 ("guides land one at a time, each tested before it ships"). The /guides/next index page lists the queue: migration from Prisma 7, deployment targets, the remaining frameworks (Next.js, NestJS, SvelteKit, Astro, Nuxt, TanStack Start, Elysia), testing, patterns, performance, and operations. Converting the remaining Prisma 7 guides without running them would break the tested-examples bar this docs effort has held so far; each next batch follows this PR's pattern.

Future redirects ("/" becomes "/v7")

Documented as a commented, reviewable block in next.config.mjs ("Guides URL cutover"): at the cutover, /guides/next/* is promoted to /guides/* and each converted Prisma 7 guide is parked under /guides/v7/* (unconverted guides keep their URLs). The per-guide pairs for bun, deno, and hono are already in the block; each future conversion appends its pair in the same PR. Nothing redirects today.

Notes for reviewers

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a new Prisma Next Guides section with an index page and dedicated guides for Bun, Deno, and Hono.
    • Added support for switching between latest and next guides versions from the docs UI.
    • Updated sidebar and navigation behavior so Guides pages show the correct version and content.
    • Added guidance pages covering setup, running, and common gotchas for the new guides.

…DR-8689)

- Add a "Guides version" dropdown to the guides section, mirroring the
  CLI pattern: /guides stays the Prisma 7 tree, /guides/next holds the
  Prisma Next tree. version.ts, the version switcher, and the versioned
  sidebar tree gain guides handling; the latest sidebar hides the next
  tree and vice versa (verified via rendered anchors).
- First converted batch, every flow run end to end against live Prisma
  Postgres databases before writing: Bun (scaffold, emit, db init,
  first typed query with real output), Deno (same flow plus the .ts
  import-extension and permission-flag differences, both hit and
  documented), and Hono (template scaffold, seed, GET /users served
  over HTTP, plus an added POST route returning the created row).
  Outputs in the guides are captured from the runs.
- Each guide documents the template's flat-model-path issue honestly
  (db.orm.User -> db.orm.public.User) until the templates are fixed.
- Document the future guides URL cutover ("/" becomes /v7) as a
  commented, reviewable block in next.config.mjs: promote
  /guides/next/* to /guides/*, park converted Prisma 7 guides under
  /guides/v7/*, per-guide pairs appended as each conversion lands.
- /guides/next index explains what is converted, what lands next per
  DR-8689, and where to go meanwhile.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Jul 6, 2026 11:50pm
docs Ready Ready Preview, Comment Jul 6, 2026 11:50pm
eclipse Ready Ready Preview, Comment Jul 6, 2026 11:50pm
site Ready Ready Preview, Comment Jul 6, 2026 11:50pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR adds a new "Prisma Next" guides section with pages for Bun, Deno, and Hono runtimes plus an index page, wired into meta.json files. It also extends version-routing and sidebar-tree logic across version.ts, versioned-sidebar-tree.ts, and version-switcher.tsx to support a new "Guides version" scope, plus a commented future redirect plan in next.config.mjs.

Changes

Prisma Next Guides Documentation

Layer / File(s) Summary
Guides index and metadata wiring
apps/docs/content/docs/guides/meta.json, apps/docs/content/docs/guides/next/meta.json, apps/docs/content/docs/guides/next/index.mdx, apps/docs/next.config.mjs
New index page introduces the guides concept and version-switching, meta.json files register the new "next" section with runtime/framework categories, and a commented future redirect cutover plan is added.
Bun guide content
apps/docs/content/docs/guides/next/bun.mdx
Full guide covering scaffolding, contract emission, DB init, a typed query example, running dev server, gotchas, and next steps.
Deno guide content
apps/docs/content/docs/guides/next/deno.mdx
Full guide covering Deno scaffolding, contract/DB setup, Deno-specific import/permission notes, typed queries, dev task execution, and gotchas.
Hono guide content
apps/docs/content/docs/guides/next/hono.mdx
Full guide covering scaffolding, template model-access fixes, seeding, verifying GET /users, adding a POST /users route, and gotchas.

Guides Version Routing

Layer / File(s) Summary
Guides pathname detection and switch logic
apps/docs/src/lib/version.ts
Adds guides root constants, pathname classifiers, switch-pathname resolution, and redirect handling for the guides "next"/"latest" roots.
Guides sidebar tree filtering
apps/docs/src/lib/versioned-sidebar-tree.ts
Adds Guides node predicates and filtering/collapsing helpers, integrated into getVersionedSidebarTree.
Version switcher UI updates
apps/docs/src/components/version-switcher.tsx
Detects Guides pathnames, includes them in scoped-version filtering, and displays a "Guides version" label.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • prisma/web#7933: Both touch version.ts and versioned-sidebar-tree.ts for routing/scoping Prisma Next paths.
  • prisma/web#7999: Both extend the same version-routing files and version-switcher.tsx to add navigation scopes.

Alright, let's play detective — this PR is basically two well-separated changes stitched together, and both are clean: a batch of new guide pages (nicely repetitive, low logic density), and a genuinely new "Guides version" layer bolted onto existing routing plumbing with matching predicate/filter functions across three files. Nothing structurally surprising, just make sure the new Guides predicates don't accidentally shadow the existing ORM version logic when both are present.

🚥 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 summarizes the main change: adding Prisma Next guides with a Guides version dropdown.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🍈 Lychee Link Check Report

17 links: ✅ 4 OK | 🚫 0 errors | 🔀 0 redirects | 👻 13 excluded

✅ All links are working!


Full Statistics Table
Status Count
✅ Successful 4
🔀 Redirected 0
👻 Excluded 13
🚫 Errors 0
⛔ Unsupported 0
⏳ Timeouts 0
❓ Unknown 0

@argos-ci

argos-ci Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Jul 6, 2026, 11:58 PM

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/docs/src/lib/version.ts (1)

236-261: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Fallback for unsupported guides target-version returns an ORM path.

If targetVersion is anything other than latest/next, this returns getVersionRoot(targetVersion) (an /orm/... path) instead of a guides path. Today the UI only offers latest/next in the Guides dropdown, so this is unreachable — but the PR objectives themselves describe a near-term plan to park converted guides under /guides/v7/*. When that version is introduced, this branch will silently route a "Guides version" switch into the ORM docs instead of /guides/v7, which will be a confusing regression to debug later.

♻️ Suggested fix
   if (targetVersion !== LATEST_VERSION && targetVersion !== "next") {
-    return getVersionRoot(targetVersion);
+    return `${LATEST_GUIDES_ROOT}/${targetVersion}`;
   }

Please confirm whether sibling functions like getCliSwitchPathname/getGettingStartedSwitchPathname use the same ORM-root fallback convention intentionally — if so this may just need the same fix applied consistently there too.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/docs/src/lib/version.ts` around lines 236 - 261, The fallback in
getGuidesSwitchPathname routes unsupported non-latest/non-next versions through
getVersionRoot(targetVersion), which sends Guides switches to an ORM path
instead of a guides path. Update this branch to return the appropriate guides
root for converted versions (for example the planned /guides/v7-style root) and
keep the fallback consistent with the other switch helpers like
getCliSwitchPathname and getGettingStartedSwitchPathname if they share the same
convention.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/docs/content/docs/guides/next/hono.mdx`:
- Around line 74-80: The sample data in the Hono guide uses inconsistent `id`
types between the `GET /users` and `POST /users` examples. Update the example in
the `hono.mdx` content so the `id` shape matches the rest of the docs, using the
same representation in the response samples and related `users`/`createUser`
snippets to avoid implying different schemas.
- Around line 18-25: The setup section is inconsistent with the runtime note
because it mentions Node.js/npm support but only shows the Bun-based scaffold
command. Update the Hono guide example to match the stated runtimes by either
adding the equivalent npx-based scaffold command alongside the existing bunx
create-prisma@next example, or by narrowing the prerequisite text to Bun only;
keep the change centered around the scaffold instructions in the Hono guide.

---

Nitpick comments:
In `@apps/docs/src/lib/version.ts`:
- Around line 236-261: The fallback in getGuidesSwitchPathname routes
unsupported non-latest/non-next versions through getVersionRoot(targetVersion),
which sends Guides switches to an ORM path instead of a guides path. Update this
branch to return the appropriate guides root for converted versions (for example
the planned /guides/v7-style root) and keep the fallback consistent with the
other switch helpers like getCliSwitchPathname and
getGettingStartedSwitchPathname if they share the same convention.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b39d6edd-d91e-4ac3-940a-982b370c4a20

📥 Commits

Reviewing files that changed from the base of the PR and between f74f219 and 7c8ab87.

📒 Files selected for processing (10)
  • apps/docs/content/docs/guides/meta.json
  • apps/docs/content/docs/guides/next/bun.mdx
  • apps/docs/content/docs/guides/next/deno.mdx
  • apps/docs/content/docs/guides/next/hono.mdx
  • apps/docs/content/docs/guides/next/index.mdx
  • apps/docs/content/docs/guides/next/meta.json
  • apps/docs/next.config.mjs
  • apps/docs/src/components/version-switcher.tsx
  • apps/docs/src/lib/version.ts
  • apps/docs/src/lib/versioned-sidebar-tree.ts

Comment on lines +18 to +25
- Node.js 24 or later, or [Bun](https://bun.sh/) (this guide uses Bun for speed; npm works the same)
- A PostgreSQL connection string, or nothing at all: the scaffold can create a [Prisma Postgres](/postgres) database for you

## 1. Scaffold the project

```bash
bunx create-prisma@next create my-hono-api --provider postgres --template hono
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

sed -n '1,120p' apps/docs/content/docs/guides/next/hono.mdx

Repository: prisma/web

Length of output: 4123


🏁 Script executed:

rg -n "create-prisma@next create|bunx create-prisma|npx create-prisma|pnpm dlx create-prisma|npm create-prisma" apps docs . --glob '!**/node_modules/**'

Repository: prisma/web

Length of output: 4297


🏁 Script executed:

sed -n '1,120p' apps/docs/content/docs/guides/next/bun.mdx && printf '\n---\n' && sed -n '1,120p' apps/docs/content/docs/guides/next/deno.mdx && printf '\n---\n' && sed -n '1,80p' apps/docs/content/docs/(index)/next/getting-started.mdx

Repository: prisma/web

Length of output: 453


🏁 Script executed:

sed -n '1,120p' 'apps/docs/content/docs/guides/next/bun.mdx' && printf '\n---\n' && sed -n '1,120p' 'apps/docs/content/docs/guides/next/deno.mdx' && printf '\n---\n' && sed -n '1,80p' 'apps/docs/content/docs/(index)/next/getting-started.mdx'

Repository: prisma/web

Length of output: 10156


🏁 Script executed:

rg -n --fixed-strings -- "template hono" apps/docs/content docs apps/site | sed -n '1,120p'

Repository: prisma/web

Length of output: 665


Make the setup path consistent with the runtime note. The prerequisite says Node.js/npm works too, but the scaffold example is Bun-specific (bunx ...). Either show the npx form here as well or narrow the guide to Bun.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/docs/content/docs/guides/next/hono.mdx` around lines 18 - 25, The setup
section is inconsistent with the runtime note because it mentions Node.js/npm
support but only shows the Bun-based scaffold command. Update the Hono guide
example to match the stated runtimes by either adding the equivalent npx-based
scaffold command alongside the existing bunx create-prisma@next example, or by
narrowing the prerequisite text to Bun only; keep the change centered around the
scaffold instructions in the Hono guide.

Comment on lines +74 to +80
```json no-copy
[
{ "id": "1", "email": "alice@prisma.io", "username": "alice", "name": "Alice", "createdAt": "2026-07-06T23:37:32.440Z" },
{ "id": "2", "email": "bob@prisma.io", "username": "bob", "name": "Bob", "createdAt": "2026-07-06T23:37:32.474Z" },
{ "id": "3", "email": "carol@prisma.io", "username": "carol", "name": "Carol", "createdAt": "2026-07-06T23:37:32.507Z" }
]
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Normalize the sample id type.

The captured JSON flips between quoted ids in GET /users and a numeric id in POST /users. Please make the examples match the same schema shape so readers don't infer two different models.

Also applies to: 108-110

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/docs/content/docs/guides/next/hono.mdx` around lines 74 - 80, The sample
data in the Hono guide uses inconsistent `id` types between the `GET /users` and
`POST /users` examples. Update the example in the `hono.mdx` content so the `id`
shape matches the rest of the docs, using the same representation in the
response samples and related `users`/`createUser` snippets to avoid implying
different schemas.

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.

1 participant