nuxt-better-auth

Integrate Better Auth into Nuxt 4 apps for session management and route protection.

Updated Jun 8, 2025
One-click install
npx skills add https://github.com/noartem/kawa --skill nuxt-better-auth-noartem
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nuxt-better-auth
Source: https://github.com/noartem/kawa/tree/main/ui/.ai/skills/nuxt-better-auth
Command: npx skills add https://github.com/noartem/kawa --skill nuxt-better-auth-noartem

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Nuxt 4+ apps often struggle to implement a cohesive authentication flow; this skill provides a complete integration with Better Auth, exposing client and server utilities for session management, route protection, and plugin support.

Core Features & Use Cases

  • useUserSession client composable for session state and auth actions
  • serverAuth, getUserSession, requireUserSession for server-side control
  • routeRules and definePageMeta-based protection, plus i18n and plugins support
  • NuxtHub integration and clientOnly mode for external backends

Quick Start

Install the nuxt-better-auth module, configure server and client in nuxt.config.ts, then protect a route to test authentication.

Frequently Asked Questions about nuxt-better-auth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement authentication in Nuxt 4?▼

Implement authentication in Nuxt 4 using Better Auth to manage user sessions and route protection. This integration exposes client and server utilities like useUserSession and requireUserSession for secure login flows.

How do I protect routes in a Nuxt application?▼

Protect routes in a Nuxt application using routeRules and definePageMeta configurations. Better Auth validates server-side sessions via requireUserSession to restrict access to protected admin pages and APIs.

Does Better Auth work with NuxtHub and i18n plugins?▼

Yes, Better Auth works with NuxtHub and i18n plugins. The integration supports server-side session access alongside plugin configurations, allowing localized authentication flows and deployment on NuxtHub infrastructure.

How do I access user sessions on the server side in Nuxt?▼

Access user sessions on the server side in Nuxt using serverAuth, getUserSession, and requireUserSession utilities. These functions provide secure server-side control to validate session state and protect API endpoints.

Can I use Better Auth with an external backend in clientOnly mode?▼

Yes, you can use Better Auth with an external backend in clientOnly mode. This configuration bypasses server-side session validation, allowing the client composable useUserSession to manage authentication state externally.

What is the best way to manage Nuxt session state?▼

The best way to manage Nuxt session state is using the useUserSession client composable. It handles session state and auth actions cohesively, syncing with server-side Better Auth validation across route transitions.