Skip to content

🚧 Work in Progress: Update Next.js pages router and other Next.js docs#741

Open
tamalchowdhury wants to merge 2 commits into
mainfrom
tamal/update/nextjs-pages-router-overhaul
Open

🚧 Work in Progress: Update Next.js pages router and other Next.js docs#741
tamalchowdhury wants to merge 2 commits into
mainfrom
tamal/update/nextjs-pages-router-overhaul

Conversation

@tamalchowdhury
Copy link
Copy Markdown
Collaborator

@tamalchowdhury tamalchowdhury commented May 30, 2026

This PR makes updates and improvements to the existing Next.js pages router and other legacy Nextjs pages.

Description (required)

Related issues & labels (optional)

  • Closes #
  • Suggested label:

Summary by CodeRabbit

Documentation

  • Designated Next.js Pages Router SDK as deprecated with updated migration guidance and revised quickstart examples for legacy router setup
  • Updated property naming conventions in API response examples for consistency and accuracy

Review Change Stack

@tamalchowdhury tamalchowdhury requested a review from a team as a code owner May 30, 2026 17:42
@github-actions github-actions Bot added the sdk label May 30, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 30, 2026

Walkthrough

This PR updates Kinde's Next.js SDK documentation across two main areas: marking the legacy Pages Router SDK as officially deprecated with a completely rewritten guide, and updating the modern App Router SDK's example property key naming. The Pages Router guide is restructured for clarity with deprecation notices, updated quickstart instructions, reorganized auth reference sections, and clarified route protection patterns. The App Router SDK example is updated to reflect the kp_usr_* property key prefix.

Changes

Legacy Pages Router SDK Deprecation and Rewrite

Layer / File(s) Summary
Legacy marking and metadata
src/content/docs/developer-tools/sdks/backend/nextjs-prev-sdk.mdx, src/content/docs/developer-tools/sdks/backend/nextjs-prev-sdkv1.mdx
Frontmatter and document metadata across both Pages Router SDK docs are updated to explicitly mark pages as legacy with updated descriptions and titles.
Deprecation notice, migration guidance, and quickstart
src/content/docs/developer-tools/sdks/backend/nextjs-prev-sdk.mdx
Large rewrite introduces AI-generated deprecation summary, Pages Router vs App Router clarification, updates migration guidance to promise-based getKindeServerSession patterns, and completely rewrites quickstart for Pages Router setup including auth route handler at pages/api/auth/[...kindeAuth].ts, KindeProvider in pages/_app.tsx, and client UI examples.
Auth reference examples
src/content/docs/developer-tools/sdks/backend/nextjs-prev-sdk.mdx
Server-side and client-side auth examples reorganized with dedicated headings; client-side example updated to show simplified useKindeAuth destructuring with subset of returned values.
Route protection and advanced patterns
src/content/docs/developer-tools/sdks/backend/nextjs-prev-sdk.mdx
Route protection documentation restructured with clearer headings; server-side protected page converted to non-async component, LoginLink import updated to main entry point, and client-side redirect example rewritten with useEffect and router navigation.
Supporting fixes and configuration
src/content/docs/developer-tools/sdks/backend/nextjs-prev-sdk.mdx
Management API example corrected, "Audience" section refined, "Debug mode" updated with clean .env snippet, and "Next steps" refreshed with updated migration guidance.

App Router SDK Property Key Update

Layer / File(s) Summary
Property key naming update
src/content/docs/developer-tools/sdks/backend/nextjs-sdk.mdx
User property keys in getUser example response renamed from usr_city/usr_industry/etc. to kp_usr_city/kp_usr_industry/etc., reflecting updated property key naming convention.

🎯 2 (Simple) | ⏱️ ~12 minutes


🐰 The Pages Router bows with grace,
Marked legacy in its rightful place,
While App Router keys now shine so bright,
With kp_usr_ prefix, all is right!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title uses a WIP emoji and vague language ('Update Next.js pages router and other Next.js docs') that doesn't clearly convey the main purpose of the comprehensive restructuring and legacy deprecation. Clarify the title to reflect the primary change—deprecating Next.js Pages Router docs and directing users to the App Router SDK. Consider: 'Mark Next.js Pages Router docs as legacy with updated migration guide'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tamal/update/nextjs-pages-router-overhaul

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 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 `@src/content/docs/developer-tools/sdks/backend/nextjs-prev-sdk.mdx`:
- Line 256: Replace the user-facing phrase "sign up page" with the hyphenated
form "sign-up page" in the sentence that reads "You will be redirected to the
Kinde hosted sign up page." (look for that exact sentence in the Next.js SDK
docs content).
- Line 53: The sentence "If you are using Next.js 13 or earlier, refer to the
earlier version [Next.js Pages Router
v1](/developer-tools/sdks/backend/nextjs-prev-sdkv1/)." incorrectly redirects
Next.js 13 users to v1; change the wording to target the true legacy cutoff
(e.g., "If you are using Next.js 12 or earlier" or "If you are using the Pages
Router (Next.js 12 or earlier)"), update the link/display text referencing
"Next.js Pages Router v1" and the URL
"/developer-tools/sdks/backend/nextjs-prev-sdkv1/" accordingly, or alternatively
add a short clarifier that distinguishes the App Router (Next.js 13+) from the
Pages Router so readers know which page to follow.
- Around line 768-772: In the env code block containing the KINDE_DEBUG_MODE
example, replace the invalid JavaScript-style comment "// .env" with a valid
dotenv comment "# .env" (or remove the comment line entirely) so the snippet
uses correct .env syntax; update the triple-backtick block that starts with
```env and the line containing "// .env" accordingly.

In `@src/content/docs/developer-tools/sdks/backend/nextjs-sdk.mdx`:
- Around line 603-611: The getUser return example still uses legacy keys like
"usr_*"; update that example to use the new "kp_usr_*" prefix so it matches the
rest of the document—locate the client-side user/getUser example (the JSON
object under the getUser return example around the user example block) and
rename every occurrence of keys starting with "usr_" (e.g., usr_city,
usr_industry, usr_job_title, usr_middle_name, usr_postcode, usr_salutation,
usr_state_region, usr_street_address, usr_street_address_2) to use the "kp_usr_"
prefix (kp_usr_city, kp_usr_industry, etc.) ensuring all examples on the page
are consistent.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 03d05e8b-bbda-4452-982e-f08f39e2a7b2

📥 Commits

Reviewing files that changed from the base of the PR and between b3f604c and 0286887.

📒 Files selected for processing (3)
  • src/content/docs/developer-tools/sdks/backend/nextjs-prev-sdk.mdx
  • src/content/docs/developer-tools/sdks/backend/nextjs-prev-sdkv1.mdx
  • src/content/docs/developer-tools/sdks/backend/nextjs-sdk.mdx

<Aside>
You are viewing the docs for Next.js **Pages Router**. If you are using the latest App Router, please refer to the [Next.js App Router](/developer-tools/sdks/backend/nextjs-sdk/) docs instead.

If you are using Next.js 13 or earlier, refer to the earlier version [Next.js Pages Router v1](/developer-tools/sdks/backend/nextjs-prev-sdkv1/).
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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix conflicting version guidance for Next.js 13 users.

This line currently redirects all Next.js 13 users to the v1 page, which conflicts with this guide’s own targeting and can misroute readers to older instructions. Narrow this to the actual legacy cutoff (for example, Next.js 12 or earlier) or clarify the exact router/version split.

🤖 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 `@src/content/docs/developer-tools/sdks/backend/nextjs-prev-sdk.mdx` at line
53, The sentence "If you are using Next.js 13 or earlier, refer to the earlier
version [Next.js Pages Router
v1](/developer-tools/sdks/backend/nextjs-prev-sdkv1/)." incorrectly redirects
Next.js 13 users to v1; change the wording to target the true legacy cutoff
(e.g., "If you are using Next.js 12 or earlier" or "If you are using the Pages
Router (Next.js 12 or earlier)"), update the link/display text referencing
"Next.js Pages Router v1" and the URL
"/developer-tools/sdks/backend/nextjs-prev-sdkv1/" accordingly, or alternatively
add a short clarifier that distinguishes the App Router (Next.js 13+) from the
Pages Router so readers know which page to follow.

npm run dev
```

2. Navigate to `http://localhost:3000` and select **Create account**. You will be redirected to the Kinde hosted sign up page.
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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Hyphenate “sign-up” in user-facing text.

Use “sign-up page” (compound adjective) for correctness and consistency.

🧰 Tools
🪛 LanguageTool

[grammar] ~256-~256: Use a hyphen to join words.
Context: ...t**. You will be redirected to the Kinde hosted sign up page. 3. Sign up with a...

(QB_NEW_EN_HYPHEN)


[grammar] ~256-~256: Use a hyphen to join words.
Context: ...l be redirected to the Kinde hosted sign up page. 3. Sign up with a test user a...

(QB_NEW_EN_HYPHEN)

🤖 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 `@src/content/docs/developer-tools/sdks/backend/nextjs-prev-sdk.mdx` at line
256, Replace the user-facing phrase "sign up page" with the hyphenated form
"sign-up page" in the sentence that reads "You will be redirected to the Kinde
hosted sign up page." (look for that exact sentence in the Next.js SDK docs
content).

Comment on lines +768 to 772
```env
// .env

KINDE_DEBUG_MODE = true;
KINDE_DEBUG_MODE=true
```
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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use valid .env comment syntax in the debug-mode snippet.

// .env inside an env block is misleading for dotenv files. Replace it with # .env or remove the comment line.

Suggested doc fix
 ```env
-// .env
+# .env
 KINDE_DEBUG_MODE=true
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

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

In @src/content/docs/developer-tools/sdks/backend/nextjs-prev-sdk.mdx around
lines 768 - 772, In the env code block containing the KINDE_DEBUG_MODE example,
replace the invalid JavaScript-style comment "// .env" with a valid dotenv
comment "# .env" (or remove the comment line entirely) so the snippet uses
correct .env syntax; update the triple-backtick block that starts with ```env
and the line containing "// .env" accordingly.


</details>

<!-- fingerprinting:phantom:poseidon:hawk -->

<!-- This is an auto-generated comment by CodeRabbit -->

Comment on lines +603 to +611
"kp_usr_city": "",
"kp_usr_industry": "",
"kp_usr_job_title": "",
"kp_usr_middle_name": "",
"kp_usr_postcode": "",
"kp_usr_salutation": "",
"kp_usr_state_region": "",
"kp_usr_street_address": "",
"kp_usr_street_address_2": ""
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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Complete the prefix rename across all user property examples in this doc.

Good update here to kp_usr_*, but the client-side user / getUser return example still shows usr_* keys (Line 1129-Line 1137), which conflicts with this section and other token examples on the same page. Please align those keys to kp_usr_* as well to avoid mixed guidance.

🤖 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 `@src/content/docs/developer-tools/sdks/backend/nextjs-sdk.mdx` around lines
603 - 611, The getUser return example still uses legacy keys like "usr_*";
update that example to use the new "kp_usr_*" prefix so it matches the rest of
the document—locate the client-side user/getUser example (the JSON object under
the getUser return example around the user example block) and rename every
occurrence of keys starting with "usr_" (e.g., usr_city, usr_industry,
usr_job_title, usr_middle_name, usr_postcode, usr_salutation, usr_state_region,
usr_street_address, usr_street_address_2) to use the "kp_usr_" prefix
(kp_usr_city, kp_usr_industry, etc.) ensuring all examples on the page are
consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant