All skills
onmax avatar

/nuxt-better-auth

@e44f20d

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.

  • 9 files
  • 19.9 KB
  • MIT
  • Updated last week
  • GitHub

Use this Skill: https://skilld.dev/gh/onmax/claude-config/nuxt-better-auth

This session only. Nothing lands on disk.

referencesinstallation.md

≈503 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Installation and configuration

Happy path

npx nuxi module add @nuxtjs/better-auth

Required files:

  • server/auth.config.ts
  • app/auth.config.ts or the equivalent file inside your srcDir
  • .env with NUXT_BETTER_AUTH_SECRET

Environment variables

NUXT_BETTER_AUTH_SECRET=replace-with-a-random-32-character-secret

Set the public site URL when the deployment platform cannot detect it:

NUXT_PUBLIC_SITE_URL=https://your-domain.com

BETTER_AUTH_SECRET is still accepted as a fallback. Prefer NUXT_BETTER_AUTH_SECRET.

For non-destructive secret rotation, keep the current and previous secrets in Better Auth's versioned variable:

BETTER_AUTH_SECRETS=2:current-secret-must-be-at-least-32-characters,1:previous-secret-must-be-at-least-32-characters

Minimal module setup

export default defineNuxtConfig({
  modules: ['@nuxtjs/better-auth'],
})

Minimal server config

import { defineServerAuth } from '@nuxtjs/better-auth/config'

export default defineServerAuth({
  emailAndPassword: {
    enabled: true,
  },
})

Minimal client config

import { defineClientAuth } from '@nuxtjs/better-auth/config'

export default defineClientAuth({})

Module-owned values

  • Do not set secret manually in defineServerAuth(). The module injects it.
  • Do not set baseURL manually in full mode. The module resolves it.
  • Use auth.clientOnly = true only when Better Auth runs on an external backend.
  • For database-backed auth with the shortest setup, prefer NuxtHub.

NuxtHub setup

export default defineNuxtConfig({
  modules: ['@nuxthub/core', '@nuxtjs/better-auth'],
  hub: { db: 'sqlite' },
})

See references/database.md for schema setup.

Client-only mode

For external auth backends:

export default defineNuxtConfig({
  modules: ['@nuxtjs/better-auth'],
  auth: {
    clientOnly: true,
  },
})

See references/client-only.md for full setup.

Source: SKILL.md on GitHub

No third-party reports yet.

Signed by skilld at e44f20d. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 8 hours ago.

Activeupdated last week

README badge

README badge for onmax/claude-config/nuxt-better-auth