-
Notifications
You must be signed in to change notification settings - Fork 856
DC-5242 Astro Better-Auth Guide #7215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughUpdated Better-Auth docs and samples: Next.js guide migrated to App Router with auth/prisma code under Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Pre-merge checks✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (1)
🧰 Additional context used🧠 Learnings (4)📚 Learning: 2025-10-08T16:23:00.388ZApplied to files:
📚 Learning: 2025-10-09T21:32:50.340ZApplied to files:
📚 Learning: 2025-10-10T13:13:30.534ZApplied to files:
📚 Learning: 2025-10-08T16:23:00.388ZApplied to files:
🪛 LanguageToolcontent/800-guides/400-betterauth-astro.mdx[grammar] ~417-~417: Use a hyphen to join words. (QB_NEW_EN_HYPHEN) [grammar] ~585-~585: Use a hyphen to join words. (QB_NEW_EN_HYPHEN) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (20)
Comment |
Deploying docs with
|
| Latest commit: |
c7a25c9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0156eb87.docs-51g.pages.dev |
| Branch Preview URL: | https://dc-5242-astro-betterauth-gui.docs-51g.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
content/800-guides/400-betterauth-astro.mdx (2)
506-524: Improve variable naming and remove debug code.The sign-up handler has a few minor code quality issues:
- Line 516: The variable
tmpis not descriptive. Consider renaming toresultorresponse.- Line 521: The
console.log(tmp)should be removed as it's debug code.- Line 522: The check
Boolean(tmp.error) === falseis overly verbose and could be simplified to!tmp.error.Apply this diff to improve the code quality:
- const tmp = await authClient.signUp.email({ + const result = await authClient.signUp.email({ name, email, password, }); - console.log(tmp); - if (Boolean(tmp.error) === false) window.location.href = "/dashboard"; + if (!result.error) window.location.href = "/dashboard";
672-687: Simplify boolean check for consistency.Similar to the sign-up page, line 685 uses the verbose
Boolean(tmp.error) === falsewhich could be simplified to!tmp.error. Consider applying the same refactor here for consistency.Apply this diff:
const tmp = await authClient.signIn.email({ email, password, }); - if (Boolean(tmp.error) === false) window.location.href = "/dashboard"; + if (!tmp.error) window.location.href = "/dashboard";Also consider renaming
tmptoresultfor better readability.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
content/800-guides/230-betterauth-nextjs.mdx(11 hunks)content/800-guides/400-betterauth-astro.mdx(1 hunks)sidebars.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-09T21:32:50.340Z
Learnt from: aidankmcalister
PR: prisma/docs#7167
File: content/900-ai/prompts/astro.mdx:84-84
Timestamp: 2025-10-09T21:32:50.340Z
Learning: The `npx prisma init` command supports the following flags: `--db` (shorthand for `--datasource-provider prisma+postgres`), `--output` (specifies output location for generated client), `--generator-provider` (defines the generator provider), `--datasource-provider`, `--url`, `--preview-feature`, and `--with-model`. These are documented valid CLI options for Prisma init command.
Applied to files:
content/800-guides/230-betterauth-nextjs.mdx
🪛 LanguageTool
content/800-guides/400-betterauth-astro.mdx
[grammar] ~418-~418: Use a hyphen to join words.
Context: ...ashboard}/index.astro ``` ### 7.1. Sign up page This page allows new users to c...
(QB_NEW_EN_HYPHEN)
[grammar] ~586-~586: Use a hyphen to join words.
Context: ...pt> ``` ### 7.2. Sign in page This page allows existing users...
(QB_NEW_EN_HYPHEN)
🔇 Additional comments (7)
sidebars.ts (1)
450-450: LGTM!The new sidebar entry for the Astro Better-Auth guide is correctly positioned and follows the established pattern. The subsequent
.sort()call ensures proper ordering.content/800-guides/230-betterauth-nextjs.mdx (6)
13-13: LGTM!The updates correctly reflect the App Router setup:
- Updated description for clarity
- Prerequisites now explicitly mention "App Router"
- Output descriptions accurately reflect the file structure
Also applies to: 20-20, 86-89
101-106: LGTM!The path updates from
/libtosrc/libcorrectly align with the App Router structure and are consistent with modern Next.js conventions.Also applies to: 183-187
334-362: LGTM!The API route structure correctly implements the App Router pattern with the catch-all route at
src/app/api/auth/[...all]/route.tsand properPOST/GETexports usingtoNextJsHandler.
367-375: LGTM!The page structure correctly reflects the App Router pattern with
page.tsxfiles in their respective directories undersrc/app/.
823-829: LGTM!The client-side route protection using
useEffectis appropriate for Next.js App Router with client components. The loading and redirecting states provide a good user experience during authentication checks.Note: This differs from the Astro guide's server-side approach (
Astro.locals.userchecks), which is correct given the framework differences.Also applies to: 858-863
897-913: LGTM!The user extraction and sign-out button implementation are clean and follow React best practices. The sign-out flow is correctly implemented.
Dangerous URL checkNo absolute URLs to prisma.io/docs found. |
Redirect checkThis PR probably requires the following redirects to be added to static/_redirects:
|
🍈 Lychee Link Check Report
📊 Results Overview
|
|
Images automagically compressed by Calibre's image-actions ✨ Compression reduced images by 86.2%, saving 319.4 KB.
|
🍈 Lychee Link Check Report
📊 Results Overview
|
|
Images automagically compressed by Calibre's image-actions ✨ Compression reduced images by 86.1%, saving 317.4 KB.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
static/img/guides/prisma-betterauth-astro-cover.pngis excluded by!**/*.png
📒 Files selected for processing (2)
.github/workflows/lychee.yml(1 hunks)sidebars.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- sidebars.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Check links
- GitHub Check: runner / linkspector
- GitHub Check: Check internal links
🍈 Lychee Link Check Report
📊 Results Overview
Errors per inputErrors in 200-orm/800-more/600-help-and-troubleshooting/050-dataguide/02-introduction-to-data-types.mdx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
content/800-guides/400-betterauth-astro.mdx (1)
71-71: Remove the../prefix from the--outputpath—the directory should be relative to the project root.The command at line 71 uses
--output ../prisma/generated, which would place the output directory in the parent of the project. However, the description at lines 84-85 and the import statements throughout the code (e.g.,import { PrismaClient } from "../../prisma/generated/client") confirm the output should be atprisma/generatedrelative to the project root. Update the command:-npx prisma init --db --output ../prisma/generated +npx prisma init --db --output prisma/generated
🧹 Nitpick comments (2)
content/800-guides/400-betterauth-astro.mdx (2)
417-417: Apply standard hyphenation for compound adjectives in section headings.The section heading uses "Sign up page" but should use the hyphenated form "Sign-up page" to follow standard English grammar for compound adjectives used as modifiers.
-### 7.1. Sign up page +### 7.1. Sign-up page
585-585: Apply standard hyphenation for compound adjectives in section headings.The section heading uses "Sign in page" but should use the hyphenated form "Sign-in page" to follow standard English grammar for compound adjectives used as modifiers.
-### 7.2. Sign in page +### 7.2. Sign-in page
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/lychee.yml(1 hunks)content/800-guides/400-betterauth-astro.mdx(1 hunks)
🧰 Additional context used
🪛 LanguageTool
content/800-guides/400-betterauth-astro.mdx
[grammar] ~417-~417: Use a hyphen to join words.
Context: ...ashboard}/index.astro ``` ### 7.1. Sign up page This page allows new users to c...
(QB_NEW_EN_HYPHEN)
[grammar] ~585-~585: Use a hyphen to join words.
Context: ...pt> ``` ### 7.2. Sign in page This page allows existing users...
(QB_NEW_EN_HYPHEN)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Check links
- GitHub Check: Check internal links
- GitHub Check: runner / linkspector
🔇 Additional comments (1)
.github/workflows/lychee.yml (1)
100-100: Excellent fix for the skipped step guard condition.The updated condition now safely checks
steps.lychee-retry.conclusion != 'skipped'before accessing the retry step's outputs. This prevents false-positive comment posts when the retry step is skipped (i.e., when the first run finds no broken links).
|
Images automagically compressed by Calibre's image-actions ✨ Compression reduced images by 84.9%, saving 233.2 KB.
|
Summary by CodeRabbit
Documentation
Chores