Getting Started

Configuration

How features are turned on, and every option at a glance.

Everything is configured under betterAuthUi in nuxt.config.ts. The sign-in pages, the account page and the admin dashboard are on from the start; every other feature is off until you turn it on.

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@treygrr/nuxt-better-auth-ui'],
  betterAuthUi: {
    twoFactor: { enabled: true },
    magicLink: { enabled: true },
    emails: { send: './server/emails/send.ts' }
  }
})

How a feature is added

Most features are one of Better Auth's own plugins. When you turn one on, the module:

  1. adds the plugin to Better Auth's server and client config for you, so your server/auth.config.ts and app/auth.config.ts don't change;
  2. shows it on the pages that use it: a button on the sign-in page, a card on the account page, a column in the admin;
  3. lists it on the admin's configuration page, so staff can see how the app is set up.
After turning on a feature that adds tables or columns, run Better Auth's migrations again, the same way you apply your other Better Auth migrations. Each feature's page says whether it needs one.

Adding a plugin yourself

The pages read your Better Auth set-up at runtime, so they also pick up plugins your own auth config adds. That's useful when you need a plugin option the module doesn't pass through: leave the module's option off, add the plugin and its client plugin to your auth configs, and the pages show it all the same. A few extras only come with the module's own plugin; their pages say which.

Features

FeatureOptionPackage to installMigration
Two-factor authenticationtwoFactorYes
Passkeyspasskey@better-auth/passkeyYes
UsernamesusernameYes
Sign-in linksmagicLinkNo
Codes by emailemailOtpNo
Guest accountsanonymousYes
Several accountsmultiSessionNo
Phone numbersphoneNumber, smsYes
Signing in devicesdeviceAuthorizationYes
Provider sign-in in a popupoauthPopupNo
CaptchacaptchaNo
Breached passwordshaveIBeenPwnedNo
"Last used" methodlastLoginMethodNo
Security alertssecurityAlertsNo
OrganizationsorganizationYes
Single sign-onsso@better-auth/ssoYes
Subscriptions with Stripestripe@better-auth/stripe, stripeYes
API keysapiKey@better-auth/api-keyYes
Bearer tokensbearerNo
JWTsjwtYes
EmailsemailsNo

General options

pages
object
Where each page lives, or false to leave one out. See Sign-in pages.
signOutRedirect
stringdefault: '/'
Where people go after signing out from the account page or the admin menu.
locale
stringdefault: 'en'
The pages' and default emails' language: en, es, or one you add with messages. See Languages.
messages
object
Your own words for any of the module's, per language and key. See Languages.
admin
object
The admin dashboard: its route, roles, impersonation, audit log and more. See Admin dashboard.

Environment variables

Secrets are read from the environment at runtime, never from nuxt.config.ts:

VariableUsed by
BETTER_AUTH_CAPTCHA_SECRET_KEYCaptcha
STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRETStripe

Better Auth's own variables (its secret and base URL) work as usual; see @nuxtjs/better-auth.