Skip to content
Development
Skill

/nuxt-users

Configure and use the nuxt-users module for Nuxt. Use when adding authentication, user management, roles, password reset, database setup (SQLite/MySQL/PostgreSQL), or CLI commands (migrate, create-user). Covers nuxt.config (nuxtUsers), composables (useAuthentication, useUsers,

From plugin
nuxt-skills
72330 skills1 MCP

Claude Code

$ npx -y skills add onmax/nuxt-skills --skill nuxt-users --agent claude-code

SKILL.md

nuxt-users.SKILL.md
name: nuxt-users
description: Configure and use the nuxt-users module for Nuxt. Use when adding authentication, user management, roles, password reset, database setup (SQLite/MySQL/PostgreSQL), or CLI commands (migrate, create-user). Covers nuxt.config (nuxtUsers), composables (useAuthentication, useUsers, usePublicPaths, usePasswordValidation, useNuxtUsersLocale), components (NUsersLoginForm, NUsersLogoutLink, etc.), and authorization (whitelist, permissions).
license: MIT
metadata:
  author: rrd108
  version: "1.0"

Nuxt Users skill

Initial setup

1. **Install the module and peer dependencies**

   npm install nuxt-users
   npm install db0 better-sqlite3 bcrypt nodemailer

For MySQL or PostgreSQL, install the corresponding driver (`mysql2` or `pg`) instead of or in addition to `better-sqlite3` as required.

2. **Register the module in `nuxt.config.ts`**

   export default defineNuxtConfig({
     modules: ['nuxt-users']
   })

3. **Run migrations** From the project root (where `nuxt.config.ts` lives):

   npx nuxt-users migrate

4. **Create at least one user**

   npx nuxt-users create-user -e admin@example.com -n "Admin User" -p password123 -r admin

Flags: `-e` email, `-n` name, `-p` password, `-r` role (optional).

5. **Configure permissions**

   export default defineNuxtConfig({
     modules: ['nuxt-users'],
     nuxtUsers: {
       auth: {
         permissions: {
           admin: ['*'],
           user: ['/profile', '/api/nuxt-users/me']
         }
       }
     }
   })

6. **Use login in a page**

  • Use the `NUsersLoginForm` component and handle `@success` by calling `login(user)` from `useAuthentication()`.
  • Optionally redirect after login (e.g. `navigateTo('/')`).

Configuration reference (nuxt.config.ts)

All options live under `nuxtUsers` in `nuxt.config.ts`.

| Area | Key | Notes | |------|-----|--------| | Database | `connector.name` | `'sqlite' \| 'mysql' \| 'postgresql'` | | Database | `connector.options` | `path` (SQLite), or `host`, `port`, `user`, `password`, `database` (MySQL/PostgreSQL) | | API | `apiBasePath` | Default `'/api/nuxt-users'` | | Tables | `tables.users`, `tables.personalAccessTokens`, `tables.passwordResetTokens`, `tables.migrations` | Custom table names | | Mailer | `mailer` | Nodemailer config for password reset emails | | URLs | `siteUrl` | Public app URL for links in emails (e.g. `'https://example.com'`). Required in production; the Host header is only trusted in development | | URLs | `passwordResetUrl`, `emailConfirmationUrl` | Paths for redirects | | Auth | `auth.whitelist` | Public routes (e.g. `['/register']`); `/login` is always public | | Auth | `auth.tokenExpiration` | Minutes (default 1440) | | Auth | `auth.rememberMeExpiration` | Days (default 30) | | Auth | `auth.permissions` | Role → paths (e.g. `admin: ['*']`, `user: ['/profile']`). Keys are the predefined roles. | | Auth | `auth.allowCustomRoles` | Default `false`. When `true`, create/update APIs and `NUsersUserForm` accept roles not listed in `permissions`. Empty `permissions` (bootstrap) already accepts any role. | | Auth | `auth.google` | Google OAuth: `clientId`, `clientSecret`, `callbackUrl`, etc. | | Password | `passwordValidation` | `minLength`, `requireUppercase`, `requireLowercase`, `requireNumbers`, `requireSpecialChars`, `preventCommonPasswords` | | Data | `hardDelete` | `true` = hard delete, `false` = soft delete (default) | | Locale | `locale.default`, `locale.texts`, `locale.fallbackLocale` | Localization |

Runtime config is also supported: use `runtimeConfig.nuxtUsers` for env-based or server-only settings.

CLI commands

Run from the project root so `nuxt.config.ts` (and optionally `.env`) are found.

  • **Migrations**
  npx nuxt-users migrate
  • **Create user**
  npx nuxt-users create-user -e <email> -n "<name>" -p <password> [-r <role>]

Role should match a `auth.permissions` key unless `auth.allowCustomRoles` is `true` (or permissions are empty).

  • **Legacy/table creation**
  npx nuxt-users create-users-table
  npx nuxt-users create-personal-access-tokens-table
  npx nuxt-users create-password-reset-tokens-table
  npx nuxt-users create-migrations-table

> **Production:** The CLI requires `nuxt-users` (and peers) installed where Node runs — it is not bundled inside `.output/`. Full config needs the app root with `nuxt.config`; build-only or `--omit=dev` deploys fall back to `DB_*` env vars. See `docs/user-guide/configuration.md`.

Composables (auto-imported)

  • **useAuthentication()** — `user`, `isAuthenticated`, `login(user, rememberMe?)`, `logout()`, `fetchUser(useSSR?)`, `initializeUser()`
  • **useUsers()** — Admin: `users`, `pagination`, `loading`, `error`, `fetchUsers(page?, limit?)`, `updateUser`, `addUser`, `removeUser(userId)`
  • **usePublicPaths()** — `getPublicPaths()`, `getAccessiblePaths()`, `isPublicPath(path)`, `isAccessiblePath(path, method?)`
  • **usePasswordValidation(moduleOptions?, options?)** — `validate(password)`, `isValid`, `errors`, `strength`, `score`, `clearValidation()`
  • **useNuxtUsersLocale()** — `t(key, params?)`, `currentLocale`, `fallbackLocale`

Components

  • `NUsersLoginForm` — Login form; use `@success` to call `login(user)` from `useAuthentication()`
  • `NUsersLogoutLink` — Logout link/button
  • `NUsersProfileInfo` — Display profile
  • `NUsersResetPasswordForm` — Password reset form
  • `NUsersList` — List users (admin)
  • `NUsersUserForm` — Create/edit user form; role select from `auth.permissions` keys; set `auth.allowCustomRoles: true` for a custom free-text role option

Troubleshooting

| Symptom | Fix | |---------|-----| | Redirected to login on protected routes | Set `auth.permissions` so each role has access to needed routes | | CLI config not found / wrong tables | Run CLI from the directory containing `nuxt.config`; see production note above | | Migrations table

Read more
@onmax
Ships withnuxt-skills

Vue, Nuxt, and NuxtHub skills for AI coding assistants.

72330 skills1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
723
Star history of onmax/nuxt-skills on GitHub, a chart by star-history.com

Other skills on nuxt-skills.

arkenv

arkenv

Answer questions about ArkEnv and help implement environment variable validation. Use when developers: (1) Ask about environment…

@onmax@onmaxInstall Skill
comark

comark

Comark (Components in Markdown) parser: syntax, AST, Vue/React/Svelte/Angular renderers, plugins, and LLM streaming with…

@onmax@onmaxInstall Skill
eve

eve

Build durable backend AI agents with the eve framework. Use when creating, editing, or debugging an eve project — agent…

@onmax@onmaxInstall Skill
nanime

nanime

Build animations in a Nuxt app with nanime, the Nuxt module wrapping Anime.js v4. Use when animating elements, text, SVG or…

@onmax@onmaxInstall Skill
nitro

nitro

Nitro is the framework-agnostic server toolkit (powering Nuxt) for building and deploying web servers anywhere. Use when working…

@onmax@onmaxInstall Skill
nuxt-better-auth

nuxt-better-auth

Guides authentication in Nuxt apps using @nuxtjs/better-auth. Use when installing or configuring the module, using its client or…

@onmax@onmaxInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc11d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about nuxt-users.

Which coding agents can use nuxt-users?
nuxt-users installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.