nuxt-x-auth-better
BetterAuth authentication layer for Nuxt with 7 pre-built components.
nuxt-x-auth-better
BetterAuth frontend layer for Nuxt. Pairs with @xenterprises/fastify-xauth-better on the backend.
Installation
npm install @xenterprises/nuxt-x-auth-better
// nuxt.config.ts
export default defineNuxtConfig({
extends: '@xenterprises/nuxt-x-auth-better',
runtimeConfig: {
public: {
authBaseUrl: process.env.NUXT_PUBLIC_AUTH_BASE_URL
}
}
})
Components
| Component | Description |
|---|---|
<XAuthBetterLogin /> | BetterAuth login form |
<XAuthBetterSignup /> | Registration with email verification |
<XAuthBetterForgotPassword /> | Password reset |
<XAuthBetterOtp /> | TOTP 2FA input |
<XAuthBetterMagicLink /> | Magic link auth |
<XAuthBetterOAuthButton /> | OAuth provider button |
<XAuthBetterOAuthButtonGroup /> | Multiple OAuth buttons |
Composable
const { user, session, signIn, signOut, organizations } = useXAuthBetter()
AI Context
package: "@xenterprises/nuxt-x-auth-better"
backend-pair: "@xenterprises/fastify-xauth-better"
use-when: Apps using BetterAuth for authentication
composable: useXAuthBetter()
features: email+password, magic link, OAuth, organizations, 2FA (TOTP)
env: NUXT_PUBLIC_AUTH_BASE_URL → points to Fastify API base URL
