Authentication module for Nuxt 4+ built on [Better Auth](https://www.better-auth.com/). Provides composables, server utilities, and route protection. > **Alpha Status**: This module is currently in alpha (v0.0.2-alpha.19) and not recommended for production use. APIs may change. - Installing/configuring `@onmax/nuxt-better-auth`
Alpha Status: This module is currently in alpha (v0.0.2-alpha.19) and not recommended for production use. APIs may change.
@onmax/nuxt-better-auth@nuxtjs/i18nnuxt skill For NuxtHub database: use nuxthub skilluseUserSession()requireUserSession()auth route mode'user', 'guest', { user: {...} }, or falseserverAuth()// Client: useUserSession() const { user, loggedIn, signIn, signOut } = useUserSession() await signIn.email({ email, password }, { onSuccess: () => navigateTo('/') })
// Server: requireUserSession() const { user } = await requireUserSession(event, { user: { role: 'admin' } })
// nuxt.config.ts: Route protection routeRules: { '/admin/**': { auth: { user: { role: 'admin' } } }, '/login': { auth: 'guest' }, '/app/**': { auth: 'user' } }