---
name: nuxt-better-auth
description: Guides authentication in Nuxt apps using @nuxtjs/better-auth. Use when installing or configuring the module, using its client or server APIs, protecting routes, refreshing sessions, or integrating Better Auth plugins.
license: MIT
title: nuxt-better-auth
canonical_url: https://skilld.dev/gh/onmax/claude-config/nuxt-better-auth
last_updated: 2026-10-01T13:14:55.000Z
---

> **Skill from skilld.dev.** Follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [references/client-auth.md](https://skilld.dev/api/skills-raw/onmax/claude-config/nuxt-better-auth/references/client-auth.md), [references/client-only.md](https://skilld.dev/api/skills-raw/onmax/claude-config/nuxt-better-auth/references/client-only.md), [references/database.md](https://skilld.dev/api/skills-raw/onmax/claude-config/nuxt-better-auth/references/database.md), [references/installation.md](https://skilld.dev/api/skills-raw/onmax/claude-config/nuxt-better-auth/references/installation.md), [references/plugins.md](https://skilld.dev/api/skills-raw/onmax/claude-config/nuxt-better-auth/references/plugins.md), [references/route-protection.md](https://skilld.dev/api/skills-raw/onmax/claude-config/nuxt-better-auth/references/route-protection.md), [references/server-auth.md](https://skilld.dev/api/skills-raw/onmax/claude-config/nuxt-better-auth/references/server-auth.md), [references/types.md](https://skilld.dev/api/skills-raw/onmax/claude-config/nuxt-better-auth/references/types.md).
>
> If the user asked to install this Skill, run `npx skilld install onmax/claude-config/nuxt-better-auth`. Install writes the Skill files into the project, so every session loads them.

# Nuxt Better Auth

Use the smallest reference that matches the task.

## Pick a reference

| Task                                                                                         | Read                                                             |
| -------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| Install the module, configure environment variables, or create config files                  | [references/installation.md](https://skilld.dev/api/skills-raw/onmax/claude-config/nuxt-better-auth/references/installation.md)         |
| Read client session state, build auth forms, call plugins, or fetch auth-bound data          | [references/client-auth.md](https://skilld.dev/api/skills-raw/onmax/claude-config/nuxt-better-auth/references/client-auth.md)           |
| Read or enforce sessions in server handlers, create sessions, or refresh cached session data | [references/server-auth.md](https://skilld.dev/api/skills-raw/onmax/claude-config/nuxt-better-auth/references/server-auth.md)           |
| Protect pages or API routes and configure redirects                                          | [references/route-protection.md](https://skilld.dev/api/skills-raw/onmax/claude-config/nuxt-better-auth/references/route-protection.md) |
| Register Better Auth plugins and their client companions                                     | [references/plugins.md](https://skilld.dev/api/skills-raw/onmax/claude-config/nuxt-better-auth/references/plugins.md)                   |
| Configure NuxtHub, generated schema, or secondary storage                                    | [references/database.md](https://skilld.dev/api/skills-raw/onmax/claude-config/nuxt-better-auth/references/database.md)                 |
| Connect a Nuxt frontend to an external Better Auth server                                    | [references/client-only.md](https://skilld.dev/api/skills-raw/onmax/claude-config/nuxt-better-auth/references/client-only.md)           |
| Use inferred auth types or add project fields                                                | [references/types.md](https://skilld.dev/api/skills-raw/onmax/claude-config/nuxt-better-auth/references/types.md)                       |

## Rules that apply across tasks

- Confirm the consumer's installed package version supports each API you use. The published skill may be newer than the consumer's lockfile.
- Enforce protected API reads and mutations server-side with `requireUserSession(event)`. Route rules and page meta also control navigation.
- Navigate only to validated local redirect paths.
- In `clientOnly` mode, do not use local server helpers or expect SSR session hydration.
- After server-side changes to session payload fields, call `refreshSessionCookieCache(event)`. Wrap custom client auth endpoints that create or change the current session with `runWithSessionRefresh()`.

Before finishing an implementation, run the consumer's typecheck and the narrowest relevant auth test.

## Resources

- [Documentation site](https://better-auth.nuxt.dev)
- [Better Auth docs](https://www.better-auth.com/)
