skills/nuxt-users/SKILL.md
Configure and use the nuxt-users module for Nuxt 3 and Nuxt 4. 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).
npx skillsauth add rrd108/nuxt-users nuxt-usersInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill helps you work with the nuxt-users module: user authentication, authorization, database setup, and CLI for Nuxt 3 and Nuxt 4 apps.
npx nuxt-users migrate, npx nuxt-users create-useruseAuthentication, useUsers, usePublicPaths, or usePasswordValidationNUsersLoginForm, NUsersLogoutLink, NUsersProfileInfo, NUsersResetPasswordForm, NUsersList, NUsersUserFormInstall 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.
Register the module in nuxt.config.ts
export default defineNuxtConfig({
modules: ['nuxt-users']
})
Run migrations
From the project root (where nuxt.config.ts lives):
npx nuxt-users migrate
Create at least one user
npx nuxt-users create-user -e [email protected] -n "Admin User" -p password123 -r admin
Flags: -e email, -n name, -p password, -r role (optional).
Configure permissions (required for protected routes)
Without auth.permissions, authenticated users cannot access protected routes. Prefer early configuration:
export default defineNuxtConfig({
modules: ['nuxt-users'],
nuxtUsers: {
auth: {
permissions: {
admin: ['*'],
user: ['/profile', '/api/nuxt-users/me']
}
}
}
})
Use login in a page
NUsersLoginForm component and handle @success by calling login(user) from useAuthentication().navigateTo('/')).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 | 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']) |
| 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. The CLI merges that when loadNuxt succeeds from the project root. If loadNuxt fails (no nuxt.config, output-only deploy, or missing nuxt/@nuxt/kit under --omit=dev), the CLI falls back to DB_* env vars and defaults for other options — custom tables / passwordValidation from config may not apply. See docs/user-guide/configuration.md (CLI sections).
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>]
Legacy/table creation (if needed for older setups)
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 is not inside
.output/alone; you neednuxt-users(and peers) installed where you run Node.npxmay download the package if absent. Apackage.jsonscript ("nuxt-users": "nuxt-users") uses the local binary. Full config requires the app root withnuxt.configand resolvable@nuxt/kit; build-only oromit=devdeploys often hit env fallback (DB_*) instead — see configuration docs.
user, isAuthenticated, login(user, rememberMe?), logout(), fetchUser(useSSR?), initializeUser()users, pagination, loading, error, fetchUsers(page?, limit?), updateUser, addUser, removeUser(userId)getPublicPaths(), getAccessiblePaths(), isPublicPath(path), isAccessiblePath(path, method?)validate(password), isValid, errors, strength, score, clearValidation()t(key, params?), currentLocale, fallbackLocaleNUsersLoginForm — Login form; use @success to call login(user) from useAuthentication()NUsersLogoutLink — Logout link/buttonNUsersProfileInfo — Display profileNUsersResetPasswordForm — Password reset formNUsersList — List users (admin)NUsersUserForm — Create/edit user formUsers get redirected to login on protected routes
Configure nuxtUsers.auth.permissions so each role has access to the routes they need (e.g. admin: ['*'], user: ['/profile']).
CLI says config not found or uses wrong tables / password rules
Run the CLI from the directory that contains nuxt.config. If you only deploy .output/ or run with nuxt omitted from production, loadNuxt may fail and the CLI uses DB_* fallback with defaults for non-connector options. Set DB_* (and see docs) or run the CLI from CI with a full app checkout.
Migrations table missing
Run npx nuxt-users migrate once from the project root. The module will warn at runtime if the migrations table is missing.
Password validation too strict
Adjust nuxtUsers.passwordValidation (e.g. lower minLength, set requireUppercase/requireNumbers/requireSpecialChars to false). Do not disable all checks in production without good reason.
Database driver errors
Install the correct peer: SQLite → better-sqlite3, MySQL → mysql2, PostgreSQL → pg. Ensure connector.name and connector.options match the driver and environment (e.g. correct host, port, credentials).
Google OAuth
Set nuxtUsers.auth.google with clientId, clientSecret, and optionally callbackUrl, successRedirect, errorRedirect, scopes, allowAutoRegistration.
../../docs/user-guide/getting-started.md, ../../docs/examples/basic-setup.md../../docs/user-guide/authorization.md../../docs/user-guide/configuration.mdKeep nuxtUsers config and permissions in sync with the app’s roles and routes; use guard clauses and early returns when implementing custom auth logic.
tools
Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layers like Lobster, ACPX, plugins, or plain code. Keep conditional logic in the caller; use TaskFlow for flow identity, child-task linkage, waiting state, revision-checked mutations, and user-facing emergence.
tools
# Lobster Lobster executes multi-step workflows with approval checkpoints. Use it when: - User wants a repeatable automation (triage, monitor, sync) - Actions need human approval before executing (send, post, delete) - Multiple tool calls should run as one deterministic operation ## When to use Lobster | User intent | Use Lobster? | | ------------------------------------------------------ | --------------------------
tools
# Lobster Lobster executes multi-step workflows with approval checkpoints. Use it when: - User wants a repeatable automation (triage, monitor, sync) - Actions need human approval before executing (send, post, delete) - Multiple tool calls should run as one deterministic operation ## When to use Lobster | User intent | Use Lobster? | | ------------------------------------------------------ | --------------------------
tools
A CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.