Structure
Pick one to update the preview and filesList prices at the time of writing. Verify before you rely on them.
Preview
What it adds
9 things, working end to end- Email and password sign-up and login, with email verification required
- Forgot-password and reset-password pages
- Google sign-in, switched on by two environment variables
- Protected route groups with a session guard
- Account settings: details, language and delete account
- Organization-based: create and select organizations, a members table, an organization switcher and delete organization
- Organization-based: invite members by email with the roles member, admin or owner, and an accept-invitation page
- Verification, reset and invitation emails sent through your email provider
- Prisma models in prisma/schema/auth.prisma (User, Session, Account, Verification, plus Organization, Member, Invitation)
Set up User-based
Accounts and keys, in this order- 1Generate a secretBetter Auth signs sessions with a random secret.openssl rand -base64 32
- 2Set the secret and URLsUse your real domain in production..envBETTER_AUTH_SECRET="paste-the-output-here"BETTER_AUTH_URL="http://localhost:3000"NEXT_PUBLIC_APP_URL="http://localhost:3000"
- 3Optional: Google sign-inCreate an OAuth client and add the redirect URI. Email sign-in works without it.console.cloud.google.comAPIs & ServicesCredentialsCreate OAuth client ID.envRedirect URI: http://localhost:3000/api/auth/callback/googleGOOGLE_CLIENT_ID="...apps.googleusercontent.com"GOOGLE_CLIENT_SECRET="..."
- 4Check it worksOpen
/signupand create an account. Sign-in requires a verified email, so set up Email first; then sign in at/login.
Environment variables
For the selected provider.env
# Base URL of the app
BETTER_AUTH_URL=
# Random secret that signs sessions: openssl rand -base64 32
BETTER_AUTH_SECRET=
# Public URL of the app
NEXT_PUBLIC_APP_URL=
# Google OAuth client id, to enable Google sign-in (optional)
GOOGLE_CLIENT_ID=
# Google OAuth client secret (optional)
GOOGLE_CLIENT_SECRET=
Works with
Other modules this one connects toAdd it to your repo
Pick the preset in the builder, check the providers, and download a repo that already has this module wired in.
