Reconcile pnpm-lock.yaml (root) and demo/nextjs/pnpm-lock.yaml with the merged package.json and pnpm-workspace.yaml overrides: next's workspace versions plus main's security bumps (samlify 2.13.1, fast-xml-parser 5.8.0) and the #9820 transitive-version overrides. demo/nextjs is a standalone pnpm project whose lockfile was resolved to next's during the merge while its workspace took main's overrides, so it is regenerated to match. Two root overrides pin dependencies to next's working versions: - kysely 0.28.17 (main's resolved version). The catalog range permits 0.29, but kysely 0.29's ESM build dropped the migration-table exports the kysely-adapter node:sqlite introspector imports, breaking table discovery. - zod 4.x to 4.3.6. better-call's zod peer otherwise resolves to 4.4.3, which produces a third zod copy that makes the docs app resolve zod to the 3.x line and fails react-hook-form's zodResolver type check. main reaches these versions through its release-age policy; next pins them explicitly because that policy does not resolve in every environment. Remove the pins once the kysely 0.29 and zod 4.4 upgrades land with their fixes. Verified: frozen install (root and all demos) under the strict policy, docs tsc, build, and the OAuth/SSO/oauth-provider regression suites.
Better Auth Demo App
Welcome to the Better Auth demo app!
This project is built with Next.js using
create-next-app.
Getting Started
Here’s how you can get the app running locally:
Prerequisites
-
Clone the repo:
git clone https://github.com/better-auth/better-auth cd better-auth/demo/nextjs -
Install the dependencies:
npm install # or yarn install # or pnpm install -
Set up your environment variables:
-
Rename the
.env.examplefile to.env:mv .env.example .env -
Open
.envand fill in the required details. These will include things like API URLs, client IDs, and secrets needed to connect to the Better Auth service.
-
Make sure TURSO_DATABASE_URL=your_turso_url and
TURSO_AUTH_TOKEN=your_turso_token is set or USE_MYSQL=true and
MYSQL_DATABASE_URL=your_mysql_url is set.
Start the Development Server
Once everything is set up, start the development server with:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
The app will be live at http://localhost:3000. Open it in your browser, and you’re good to go!
Feel free to jump in and edit the app by modifying app/page.tsx.
Any changes you make will update automatically in the browser.
Features
Here’s what this app supports out of the box:
- Email & Password: Simple and secure authentication.
- Organization / Teams: Manage users within organizations or teams.
- Passkeys: Passwordless login using modern authentication standards.
- Multi-Factor Authentication (MFA): Add an extra layer of security.
- Password Reset: Let users reset their passwords if they forget them.
- Email Verification: Ensure users verify their email addresses.
- Roles & Permissions: Define and manage who can do what.
- Rate Limiting: Protect your app from abuse with smart limits.
- Session Management: Handle user sessions seamlessly.
- Stripe Plugin: Integrate Stripe for customer management, subscriptions, and webhooks.
Learn More
Here are some helpful links if you want to dive deeper:
- Better Auth Documentation - Everything you need to know to integrate Better Auth.
- Next.js Documentation - Learn about the framework we used to build this app.
- Learn Next.js - A hands-on tutorial for Next.js.
If you run into issues or have suggestions, feel free to open an issue or submit a pull request on the GitHub repo.
Happy coding!