[PR #6727] [MERGED] chore(demo): improve nextjs demo #15099

Closed
opened 2026-04-13 09:49:43 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6727
Author: @bytaesu
Created: 12/13/2025
Status: Merged
Merged: 12/20/2025
Merged by: @Bekacru

Base: canaryHead: 2025-12-13/chore/improve-nextjs-demo


📝 Commits (10+)

  • 44ded83 refactor authClient and auth types usage
  • 9699883 add Metadata type
  • 8f4f10e fix: lint
  • 6d52b71 singleton query client
  • 0cdb444 clean up layout and components
  • d2581cd separate util
  • 107e9fe remove code related to SSO, oidcProvider, and genericOAuth plugins that are not implemented yet
  • 975d1c1 redirect to sign-in
  • bf237d5 adjust structure to work with customSession
  • 18d8b87 improve clarity

📊 Changes

91 files changed (+4406 additions, -2940 deletions)

View changed files

demo/nextjs/app/(auth)/accept-invitation/[id]/page.tsx (+204 -0)
📝 demo/nextjs/app/(auth)/device/approve/page.tsx (+6 -5)
📝 demo/nextjs/app/(auth)/device/denied/page.tsx (+1 -1)
📝 demo/nextjs/app/(auth)/device/layout.tsx (+0 -0)
📝 demo/nextjs/app/(auth)/device/page.tsx (+3 -3)
📝 demo/nextjs/app/(auth)/device/success/page.tsx (+1 -1)
📝 demo/nextjs/app/(auth)/forget-password/page.tsx (+13 -65)
📝 demo/nextjs/app/(auth)/reset-password/page.tsx (+10 -69)
📝 demo/nextjs/app/(auth)/sign-in/_components/sign-in.tsx (+37 -103)
demo/nextjs/app/(auth)/sign-in/_components/sign-up.tsx (+52 -0)
📝 demo/nextjs/app/(auth)/sign-in/page.tsx (+6 -5)
📝 demo/nextjs/app/(auth)/two-factor/otp/page.tsx (+3 -80)
📝 demo/nextjs/app/(auth)/two-factor/page.tsx (+5 -61)
demo/nextjs/app/accept-invitation/[id]/invitation-error.tsx (+0 -43)
demo/nextjs/app/accept-invitation/[id]/page.tsx (+0 -182)
📝 demo/nextjs/app/admin/page.tsx (+9 -9)
demo/nextjs/app/apps/register/page.tsx (+0 -102)
📝 demo/nextjs/app/client-test/page.tsx (+14 -16)
demo/nextjs/app/dashboard/_components/organization-card.tsx (+384 -0)
demo/nextjs/app/dashboard/_components/subscription-card.tsx (+292 -0)

...and 71 more files

📄 Description

Summary by cubic

Modernized the Next.js demo by unifying the auth client, adding React Query-powered session/organization/subscription hooks, and removing unimplemented SSO/OIDC flows. This cleans up pages, improves consistency, and makes session/state handling more reliable.

  • Refactors

    • Replaced client with authClient across the app; standardized React Query hooks for session, organizations, and subscriptions.
    • Removed SSO/OIDC/generic OAuth plugins and demo pages (oauth/authorize, apps/register).
    • Added Providers (ThemeProvider, QueryClient singleton, Toaster, React Query Devtools) and a new Header; replaced Wrapper and SignInButton with EntryButton.
    • Polished layout and copy; unified page components to Page.
    • Streamlined dashboard SSR session with shared headers; AccountSwitcher now uses device sessions with query invalidation.
    • Added organization invitation flow under /(auth)/accept-invitation with accept/decline mutations.
    • Introduced a subscription card with React Query (list, upgrade, cancel, restore).
    • Migrated sign-in/sign-up, forget/reset password, and two-factor flows to react-hook-form-based forms; introduced shadcn Field/InputGroup and updated Separator/Textarea; removed the OneTap component.
    • Updated proxy to redirect unauthenticated users to /sign-in.
  • Migration

    • Import authClient from lib/auth-client and auth types from lib/auth.
    • Use useSessionQuery for client-side session; use EntryButton instead of SignInButton; remove Wrapper components.
    • Remove any usage of SSO/OIDC/generic OAuth in the demo; those flows are not supported here.
    • Replace legacy auth components with SignInForm, SignUpForm, ForgetPasswordForm, ResetPasswordForm, and TwoFactor forms; remove OneTap.

Written for commit 19eb53596b. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/6727 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 12/13/2025 **Status:** ✅ Merged **Merged:** 12/20/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `2025-12-13/chore/improve-nextjs-demo` --- ### 📝 Commits (10+) - [`44ded83`](https://github.com/better-auth/better-auth/commit/44ded83f75e7ea22b0f26e13a39d6e293d563ab7) refactor authClient and auth types usage - [`9699883`](https://github.com/better-auth/better-auth/commit/9699883a3206a0a90e6030f2a7cbcf30e0f6624e) add Metadata type - [`8f4f10e`](https://github.com/better-auth/better-auth/commit/8f4f10eb2e12be54ceda2bb1a131a48eab0822c0) fix: lint - [`6d52b71`](https://github.com/better-auth/better-auth/commit/6d52b717eb47096d75125abeacc0e2741f08f3d2) singleton query client - [`0cdb444`](https://github.com/better-auth/better-auth/commit/0cdb4447d891d613752665a6e3506f3c63d12c3f) clean up layout and components - [`d2581cd`](https://github.com/better-auth/better-auth/commit/d2581cd979df634492b61dc2c3719744252eaccf) separate util - [`107e9fe`](https://github.com/better-auth/better-auth/commit/107e9fed43d396e2c4195f21d85b8e808c5d335f) remove code related to SSO, oidcProvider, and genericOAuth plugins that are not implemented yet - [`975d1c1`](https://github.com/better-auth/better-auth/commit/975d1c10e8d6964a2a67bdc58572a06a43f62140) redirect to sign-in - [`bf237d5`](https://github.com/better-auth/better-auth/commit/bf237d597ac64d32e1c03490e7c634dc4b9b0005) adjust structure to work with customSession - [`18d8b87`](https://github.com/better-auth/better-auth/commit/18d8b87ae79d09442bf12f35258e49ca83050ad0) improve clarity ### 📊 Changes **91 files changed** (+4406 additions, -2940 deletions) <details> <summary>View changed files</summary> ➕ `demo/nextjs/app/(auth)/accept-invitation/[id]/page.tsx` (+204 -0) 📝 `demo/nextjs/app/(auth)/device/approve/page.tsx` (+6 -5) 📝 `demo/nextjs/app/(auth)/device/denied/page.tsx` (+1 -1) 📝 `demo/nextjs/app/(auth)/device/layout.tsx` (+0 -0) 📝 `demo/nextjs/app/(auth)/device/page.tsx` (+3 -3) 📝 `demo/nextjs/app/(auth)/device/success/page.tsx` (+1 -1) 📝 `demo/nextjs/app/(auth)/forget-password/page.tsx` (+13 -65) 📝 `demo/nextjs/app/(auth)/reset-password/page.tsx` (+10 -69) 📝 `demo/nextjs/app/(auth)/sign-in/_components/sign-in.tsx` (+37 -103) ➕ `demo/nextjs/app/(auth)/sign-in/_components/sign-up.tsx` (+52 -0) 📝 `demo/nextjs/app/(auth)/sign-in/page.tsx` (+6 -5) 📝 `demo/nextjs/app/(auth)/two-factor/otp/page.tsx` (+3 -80) 📝 `demo/nextjs/app/(auth)/two-factor/page.tsx` (+5 -61) ➖ `demo/nextjs/app/accept-invitation/[id]/invitation-error.tsx` (+0 -43) ➖ `demo/nextjs/app/accept-invitation/[id]/page.tsx` (+0 -182) 📝 `demo/nextjs/app/admin/page.tsx` (+9 -9) ➖ `demo/nextjs/app/apps/register/page.tsx` (+0 -102) 📝 `demo/nextjs/app/client-test/page.tsx` (+14 -16) ➕ `demo/nextjs/app/dashboard/_components/organization-card.tsx` (+384 -0) ➕ `demo/nextjs/app/dashboard/_components/subscription-card.tsx` (+292 -0) _...and 71 more files_ </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Modernized the Next.js demo by unifying the auth client, adding React Query-powered session/organization/subscription hooks, and removing unimplemented SSO/OIDC flows. This cleans up pages, improves consistency, and makes session/state handling more reliable. - **Refactors** - Replaced client with authClient across the app; standardized React Query hooks for session, organizations, and subscriptions. - Removed SSO/OIDC/generic OAuth plugins and demo pages (oauth/authorize, apps/register). - Added Providers (ThemeProvider, QueryClient singleton, Toaster, React Query Devtools) and a new Header; replaced Wrapper and SignInButton with EntryButton. - Polished layout and copy; unified page components to Page. - Streamlined dashboard SSR session with shared headers; AccountSwitcher now uses device sessions with query invalidation. - Added organization invitation flow under /(auth)/accept-invitation with accept/decline mutations. - Introduced a subscription card with React Query (list, upgrade, cancel, restore). - Migrated sign-in/sign-up, forget/reset password, and two-factor flows to react-hook-form-based forms; introduced shadcn Field/InputGroup and updated Separator/Textarea; removed the OneTap component. - Updated proxy to redirect unauthenticated users to /sign-in. - **Migration** - Import authClient from lib/auth-client and auth types from lib/auth. - Use useSessionQuery for client-side session; use EntryButton instead of SignInButton; remove Wrapper components. - Remove any usage of SSO/OIDC/generic OAuth in the demo; those flows are not supported here. - Replace legacy auth components with SignInForm, SignUpForm, ForgetPasswordForm, ResetPasswordForm, and TwoFactor forms; remove OneTap. <sup>Written for commit 19eb53596bdfdb2e303db425ef91a889d862da7a. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 09:49:43 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#15099