diff --git a/README.md b/README.md index e4230e6..e005ee4 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@

- Nuxt Better Auth + Nuxt Better Auth
Designed by HugoRCD

-

@onmax/nuxt-better-auth

+

@nuxtjs/better-auth

Nuxt module for Better Auth

- npm version - npm downloads - License + npm version + npm downloads + License Nuxt

@@ -20,7 +20,7 @@ ## Documentation -**[nuxt-better-auth.onmax.me](https://nuxt-better-auth.onmax.me/)** +**[better-auth.nuxtjs.org](https://better-auth.nuxtjs.org)** ## License diff --git a/docs/app/app.config.ts b/docs/app/app.config.ts index e9bcbf0..2382355 100644 --- a/docs/app/app.config.ts +++ b/docs/app/app.config.ts @@ -1,6 +1,6 @@ export default defineAppConfig({ github: { - url: 'https://github.com/onmax/nuxt-better-auth', + url: 'https://github.com/nuxt-modules/better-auth', branch: 'main', rootDir: 'docs', }, diff --git a/docs/app/components/OgImage/OgImageDocs.vue b/docs/app/components/OgImage/OgImageDocs.vue index 2070197..d9354fb 100644 --- a/docs/app/components/OgImage/OgImageDocs.vue +++ b/docs/app/components/OgImage/OgImageDocs.vue @@ -59,7 +59,7 @@ defineProps<{ - github.com/onmax/nuxt-better-auth + github.com/nuxt-modules/better-auth diff --git a/docs/app/components/app/AppHeader.vue b/docs/app/components/app/AppHeader.vue index 9725817..7ab688d 100644 --- a/docs/app/components/app/AppHeader.vue +++ b/docs/app/components/app/AppHeader.vue @@ -8,7 +8,7 @@ const isDocsPage = computed(() => route.path.startsWith('/getting-started') || r const navLinks = [ { name: 'docs', path: '/getting-started' }, - { name: 'demo', path: 'https://demo-nuxt-better-auth.onmax.me', external: true }, + { name: 'demo', path: 'https://demo.better-auth.nuxtjs.org', external: true }, { name: 'better-auth', path: 'https://www.better-auth.com', external: true }, ] @@ -59,7 +59,7 @@ const navLinks = [
  • x

    - npx nuxi module add @onmax/nuxt-better-auth@alpha + npx nuxi module add @nuxtjs/better-auth@alpha

    - + - +
    @@ -99,7 +99,7 @@ function getCodeBlock(tab: { name: string, code: string }) { Get Started
    @@ -203,7 +203,7 @@ function getCodeBlock(tab: { name: string, code: string }) { diff --git a/docs/app/components/content/landing/hero.yml b/docs/app/components/content/landing/hero.yml index 04ea095..be3b980 100644 --- a/docs/app/components/content/landing/hero.yml +++ b/docs/app/components/content/landing/hero.yml @@ -5,7 +5,7 @@ tabs: - name: nuxt.config.ts code: | export default defineNuxtConfig({ - modules: ['@onmax/nuxt-better-auth'], + modules: ['@nuxtjs/better-auth'], routeRules: { '/dashboard/**': { auth: 'user' }, '/admin/**': { auth: 'admin' }, @@ -13,7 +13,7 @@ tabs: }) - name: server/auth.config.ts code: | - import { defineServerAuth } from '@onmax/nuxt-better-auth/config' + import { defineServerAuth } from '@nuxtjs/better-auth/config' import { admin, twoFactor } from 'better-auth/plugins' export default defineServerAuth({ @@ -25,7 +25,7 @@ tabs: }) - name: app/auth.config.ts code: | - import { defineClientAuth } from '@onmax/nuxt-better-auth/config' + import { defineClientAuth } from '@nuxtjs/better-auth/config' import { adminClient, twoFactorClient } from 'better-auth/client/plugins' export default defineClientAuth({ diff --git a/docs/content/1.getting-started/0.index.md b/docs/content/1.getting-started/0.index.md index 3337c61..667a76d 100644 --- a/docs/content/1.getting-started/0.index.md +++ b/docs/content/1.getting-started/0.index.md @@ -6,7 +6,7 @@ navigation.icon: i-lucide-sparkles Nuxt Better Auth integrates **Nuxt** and **Better Auth**, the TypeScript-first authentication library. You get route protection, session management, and schema generation with minimal setup. The plugin ecosystem adds features like 2FA, organizations, and passkeys. -::card{to="https://demo-nuxt-better-auth.nuxt.dev" target="_blank" icon="i-lucide-external-link"} +::card{to="https://demo.better-auth.nuxtjs.org" target="_blank" icon="i-lucide-external-link"} **Live Demo** – Try the authentication flow in action. :: @@ -58,7 +58,7 @@ Get a working login in 5 minutes with NuxtHub (SQLite). ### Install ```bash -npx nuxi module add @onmax/nuxt-better-auth@alpha @nuxthub/core +npx nuxi module add @nuxtjs/better-auth@alpha @nuxthub/core ``` ### Configure @@ -76,7 +76,7 @@ BETTER_AUTH_SECRET="generate-a-32-char-secret" ### Create Config Files ```ts [server/auth.config.ts] -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' export default defineServerAuth({ emailAndPassword: { enabled: true }, @@ -84,7 +84,7 @@ export default defineServerAuth({ ``` ```ts [app/auth.config.ts] -import { defineClientAuth } from '@onmax/nuxt-better-auth/config' +import { defineClientAuth } from '@nuxtjs/better-auth/config' export default defineClientAuth({}) ``` diff --git a/docs/content/1.getting-started/1.installation.md b/docs/content/1.getting-started/1.installation.md index 423614f..bef3b84 100644 --- a/docs/content/1.getting-started/1.installation.md +++ b/docs/content/1.getting-started/1.installation.md @@ -15,7 +15,7 @@ navigation.icon: i-lucide-download ### Install the module ```bash -npx nuxi module add @onmax/nuxt-better-auth@alpha +npx nuxi module add @nuxtjs/better-auth@alpha ``` ### Set Environment Variables @@ -69,7 +69,7 @@ The module requires two configuration files: Create these files with the following content: ```ts [server/auth.config.ts] -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' export default defineServerAuth({ emailAndPassword: { enabled: true } @@ -77,7 +77,7 @@ export default defineServerAuth({ ``` ```ts [app/auth.config.ts] -import { defineClientAuth } from '@onmax/nuxt-better-auth/config' +import { defineClientAuth } from '@nuxtjs/better-auth/config' export default defineClientAuth({}) ``` diff --git a/docs/content/1.getting-started/2.configuration.md b/docs/content/1.getting-started/2.configuration.md index 7a357d9..4e8d1eb 100644 --- a/docs/content/1.getting-started/2.configuration.md +++ b/docs/content/1.getting-started/2.configuration.md @@ -8,7 +8,7 @@ navigation.icon: i-lucide-settings ```ts [nuxt.config.ts] export default defineNuxtConfig({ - modules: ['@onmax/nuxt-better-auth'], + modules: ['@nuxtjs/better-auth'], auth: { redirects: { login: '/login', @@ -82,7 +82,7 @@ Define your authentication logic in `server/auth.config.ts`, including plugins, Use the `defineServerAuth` helper to ensure type safety and access context. It accepts an object or function syntax. ```ts [server/auth.config.ts] -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' // Object syntax (simplest) export default defineServerAuth({ @@ -106,7 +106,7 @@ The module automatically injects `secret` and `baseURL`. You don't need to confi When using the function syntax, `defineServerAuth` callback receives a context object with useful properties: ```ts [server/auth.config.ts] -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' import { drizzleAdapter } from 'better-auth/adapters/drizzle' export default defineServerAuth(({ db, runtimeConfig }) => ({ diff --git a/docs/content/1.getting-started/3.client-setup.md b/docs/content/1.getting-started/3.client-setup.md index fa08165..6302126 100644 --- a/docs/content/1.getting-started/3.client-setup.md +++ b/docs/content/1.getting-started/3.client-setup.md @@ -11,7 +11,7 @@ Create `app/auth.config.ts` with a default export using `defineClientAuth`. The `defineClientAuth` helper supports two syntaxes: an object for simple configurations, or a function when you need access to context like the resolved site URL. ```ts [app/auth.config.ts] -import { defineClientAuth } from '@onmax/nuxt-better-auth/config' +import { defineClientAuth } from '@nuxtjs/better-auth/config' // Object syntax (simplest) export default defineClientAuth({}) @@ -31,7 +31,7 @@ The helper creates a factory function that the module calls with the correct `ba If you added a plugin in your server config (`server/auth.config.ts`), make sure to add its client equivalent here. ```ts [app/auth.config.ts] -import { defineClientAuth } from '@onmax/nuxt-better-auth/config' +import { defineClientAuth } from '@nuxtjs/better-auth/config' import { adminClient } from 'better-auth/client/plugins' export default defineClientAuth({ @@ -46,7 +46,7 @@ export default defineClientAuth({ ### Admin + Two Factor ```ts [app/auth.config.ts] -import { defineClientAuth } from '@onmax/nuxt-better-auth/config' +import { defineClientAuth } from '@nuxtjs/better-auth/config' import { adminClient, twoFactorClient } from 'better-auth/client/plugins' export default defineClientAuth({ diff --git a/docs/content/1.getting-started/4.type-augmentation.md b/docs/content/1.getting-started/4.type-augmentation.md index d5fa15a..6e8c6be 100644 --- a/docs/content/1.getting-started/4.type-augmentation.md +++ b/docs/content/1.getting-started/4.type-augmentation.md @@ -20,7 +20,7 @@ If you add the `admin` plugin: ```ts [server/auth.config.ts] import { admin } from 'better-auth/plugins' -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' export default defineServerAuth({ plugins: [admin()] diff --git a/docs/content/2.core-concepts/2.sessions.md b/docs/content/2.core-concepts/2.sessions.md index 8643a07..2c30a09 100644 --- a/docs/content/2.core-concepts/2.sessions.md +++ b/docs/content/2.core-concepts/2.sessions.md @@ -78,7 +78,7 @@ const { fetchSession, ready } = useUserSession() Configure session duration in your auth config: ```ts [server/auth.config.ts] -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' export default defineServerAuth({ session: { diff --git a/docs/content/2.core-concepts/5.security-caveats.md b/docs/content/2.core-concepts/5.security-caveats.md index db7ad3f..5bed578 100644 --- a/docs/content/2.core-concepts/5.security-caveats.md +++ b/docs/content/2.core-concepts/5.security-caveats.md @@ -12,7 +12,7 @@ Client-side redirects improve UX but don't prevent unauthorized access. Always v Better Auth performs origin checks for cookie-based requests (it validates `Origin` / `Referer`). If you use multiple domains (custom domains, preview URLs, etc.), add them to `trustedOrigins` in your auth config. ```ts [server/auth.config.ts] -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' export default defineServerAuth({ trustedOrigins: [ diff --git a/docs/content/3.guides/1.role-based-access.md b/docs/content/3.guides/1.role-based-access.md index 8ab8aa7..5eda327 100644 --- a/docs/content/3.guides/1.role-based-access.md +++ b/docs/content/3.guides/1.role-based-access.md @@ -7,7 +7,7 @@ description: Protect routes using generic field matching on AuthUser. ```ts [server/auth.config.ts] import { admin } from 'better-auth/plugins' -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' export default defineServerAuth({ plugins: [admin()] }) // nuxt.config.ts - role is now typed! diff --git a/docs/content/3.guides/2.oauth-providers.md b/docs/content/3.guides/2.oauth-providers.md index c75e62d..26d4392 100644 --- a/docs/content/3.guides/2.oauth-providers.md +++ b/docs/content/3.guides/2.oauth-providers.md @@ -31,7 +31,7 @@ GOOGLE_CLIENT_SECRET="your-client-secret" ### Configure `server/auth.config.ts` ```ts [server/auth.config.ts] -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' export default defineServerAuth({ socialProviders: { diff --git a/docs/content/3.guides/3.custom-database.md b/docs/content/3.guides/3.custom-database.md index d0baae6..d73a63a 100644 --- a/docs/content/3.guides/3.custom-database.md +++ b/docs/content/3.guides/3.custom-database.md @@ -21,12 +21,12 @@ Adapter imports come from the `better-auth` package, so you must install it in y pnpm add better-auth ``` -`better-auth` is a peer dependency of `@onmax/nuxt-better-auth`. Keep the major versions aligned to avoid mismatches. +`better-auth` is a peer dependency of `@nuxtjs/better-auth`. Keep the major versions aligned to avoid mismatches. ## Drizzle Adapter ```ts [server/auth.config.ts] -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' import { drizzleAdapter } from 'better-auth/adapters/drizzle' import { drizzle } from 'drizzle-orm/node-postgres' @@ -41,7 +41,7 @@ export default defineServerAuth({ ## Prisma Adapter ```ts [server/auth.config.ts] -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' import { prismaAdapter } from 'better-auth/adapters/prisma' import { PrismaClient } from '@prisma/client' @@ -56,7 +56,7 @@ export default defineServerAuth({ ## Kysely Adapter ```ts [server/auth.config.ts] -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' import { kyselyAdapter } from 'better-auth/adapters/kysely' import { Kysely, PostgresDialect } from 'kysely' import { Pool } from 'pg' diff --git a/docs/content/3.guides/4.database-less-mode.md b/docs/content/3.guides/4.database-less-mode.md index 3b9868b..cb183ff 100644 --- a/docs/content/3.guides/4.database-less-mode.md +++ b/docs/content/3.guides/4.database-less-mode.md @@ -55,7 +55,7 @@ Simply don't configure a database adapter: ```ts [nuxt.config.ts] export default defineNuxtConfig({ - modules: ['@onmax/nuxt-better-auth'], + modules: ['@nuxtjs/better-auth'], }) ``` @@ -64,7 +64,7 @@ export default defineNuxtConfig({ Enable JWE sessions and cookie-based OAuth state: ```ts [server/auth.config.ts] -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' export default defineServerAuth({ socialProviders: { diff --git a/docs/content/3.guides/5.external-auth-backend.md b/docs/content/3.guides/5.external-auth-backend.md index cebd092..553a2f6 100644 --- a/docs/content/3.guides/5.external-auth-backend.md +++ b/docs/content/3.guides/5.external-auth-backend.md @@ -18,7 +18,7 @@ When your Better Auth server runs on a separate backend (e.g., standalone h3/Nit ```ts [nuxt.config.ts] export default defineNuxtConfig({ - modules: ['@onmax/nuxt-better-auth'], + modules: ['@nuxtjs/better-auth'], auth: { clientOnly: true, }, diff --git a/docs/content/3.guides/6.migrate-from-nuxt-auth-utils.md b/docs/content/3.guides/6.migrate-from-nuxt-auth-utils.md index d82401e..c54dc51 100644 --- a/docs/content/3.guides/6.migrate-from-nuxt-auth-utils.md +++ b/docs/content/3.guides/6.migrate-from-nuxt-auth-utils.md @@ -57,7 +57,7 @@ export default defineOAuthGitHubEventHandler({ ```ts // nuxt-better-auth - Declarative config // server/auth.config.ts -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' export default defineServerAuth({ socialProviders: { github: { @@ -107,7 +107,7 @@ export default defineOAuthGitHubEventHandler({ **After:** ```ts [server/auth.config.ts] -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' export default defineServerAuth({ socialProviders: { @@ -257,7 +257,7 @@ Implement a custom password verifier that tries both formats: ```ts [server/auth.config.ts] import { scrypt, timingSafeEqual } from 'node:crypto' -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' async function verifyLegacyHash(password: string, hash: string): Promise { // Implement scrypt verification for legacy hashes diff --git a/docs/content/3.guides/7.two-factor-auth.md b/docs/content/3.guides/7.two-factor-auth.md index d4e64aa..c1e1236 100644 --- a/docs/content/3.guides/7.two-factor-auth.md +++ b/docs/content/3.guides/7.two-factor-auth.md @@ -10,7 +10,7 @@ Better Auth ships a `twoFactor` plugin with TOTP, OTP, and backup codes. It requ ### Enable the Plugin (Server) ```ts [server/auth.config.ts] -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' import { twoFactor } from 'better-auth/plugins/two-factor' export default defineServerAuth({ @@ -28,7 +28,7 @@ export default defineServerAuth({ ```ts [app/auth.config.ts] import { navigateTo } from '#imports' -import { defineClientAuth } from '@onmax/nuxt-better-auth/config' +import { defineClientAuth } from '@nuxtjs/better-auth/config' import { twoFactorClient } from 'better-auth/client/plugins' export default defineClientAuth({ diff --git a/docs/content/3.guides/9.production-deployment.md b/docs/content/3.guides/9.production-deployment.md index ad11f9d..7eed91e 100644 --- a/docs/content/3.guides/9.production-deployment.md +++ b/docs/content/3.guides/9.production-deployment.md @@ -84,13 +84,13 @@ When deploying with NuxtHub: 1. Database migrations run automatically during build 2. Set environment variables in your deployment platform -3. Ensure `@nuxthub/core` is listed before `@onmax/nuxt-better-auth` in modules +3. Ensure `@nuxthub/core` is listed before `@nuxtjs/better-auth` in modules ```ts [nuxt.config.ts] export default defineNuxtConfig({ modules: [ '@nuxthub/core', // Must be first - '@onmax/nuxt-better-auth', + '@nuxtjs/better-auth', ], }) ``` diff --git a/docs/content/4.integrations/1.nuxthub.md b/docs/content/4.integrations/1.nuxthub.md index 6511725..d65d9fb 100644 --- a/docs/content/4.integrations/1.nuxthub.md +++ b/docs/content/4.integrations/1.nuxthub.md @@ -42,7 +42,7 @@ Version 0.10.5 or later is required. Earlier versions cause runtime errors in de export default defineNuxtConfig({ modules: [ '@nuxthub/core', - '@onmax/nuxt-better-auth' + '@nuxtjs/better-auth' ], hub: { @@ -138,7 +138,7 @@ The module analyzes your `server/auth.config.ts` at build time: With NuxtHub, you get access to the Drizzle database instance in your server config: ```ts [server/auth.config.ts] -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' export default defineServerAuth(({ db }) => ({ // db is the Drizzle instance from NuxtHub diff --git a/docs/content/4.integrations/3.convex.md b/docs/content/4.integrations/3.convex.md index 7c7b252..07d9703 100644 --- a/docs/content/4.integrations/3.convex.md +++ b/docs/content/4.integrations/3.convex.md @@ -23,7 +23,7 @@ Add both modules to your Nuxt configuration. ```ts [nuxt.config.ts] export default defineNuxtConfig({ - modules: ['nuxt-convex', '@onmax/nuxt-better-auth'], + modules: ['nuxt-convex', '@nuxtjs/better-auth'], }) ``` @@ -89,7 +89,7 @@ The adapter replaces the standard database configuration in your auth config. Th import { components } from '#convex/api' import { createClient } from '@convex-dev/better-auth' import { convex } from '@convex-dev/better-auth/server/plugins' -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' const authComponent = createClient(components.betterAuth) diff --git a/docs/content/4.integrations/3.i18n.md b/docs/content/4.integrations/3.i18n.md index 8230dde..7d07fdd 100644 --- a/docs/content/4.integrations/3.i18n.md +++ b/docs/content/4.integrations/3.i18n.md @@ -19,7 +19,7 @@ pnpm add @nuxtjs/i18n ```ts [nuxt.config.ts] export default defineNuxtConfig({ - modules: ['@nuxtjs/i18n', '@onmax/nuxt-better-auth'], + modules: ['@nuxtjs/i18n', '@nuxtjs/better-auth'], i18n: { locales: ['en', 'es'], defaultLocale: 'en' @@ -101,7 +101,7 @@ For auth config callbacks like `sendResetPassword`, use `@intlify/utils/h3` to d ```ts [server/auth.config.ts] import { tryCookieLocale, tryHeaderLocale } from '@intlify/utils/h3' -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' export default defineServerAuth(() => ({ emailAndPassword: { diff --git a/docs/content/5.api/4.types.md b/docs/content/5.api/4.types.md index 6330fe7..6916151 100644 --- a/docs/content/5.api/4.types.md +++ b/docs/content/5.api/4.types.md @@ -12,7 +12,7 @@ import type { AuthUser, RequireSessionOptions, UserMatch, -} from '@onmax/nuxt-better-auth' +} from '@nuxtjs/better-auth' ``` ## AuthUser diff --git a/docs/content/6.troubleshooting/1.faq.md b/docs/content/6.troubleshooting/1.faq.md index 684aec0..22b15e3 100644 --- a/docs/content/6.troubleshooting/1.faq.md +++ b/docs/content/6.troubleshooting/1.faq.md @@ -41,7 +41,7 @@ Yes. Better Auth supports any database with a Drizzle, Prisma, or Kysely adapter Configure in Better Auth, then augment types: ```ts [server/auth.config.ts] -import { defineServerAuth } from '@onmax/nuxt-better-auth/config' +import { defineServerAuth } from '@nuxtjs/better-auth/config' export default defineServerAuth({ user: { diff --git a/docs/content/7.examples/1.index.md b/docs/content/7.examples/1.index.md index 28f64df..a7ca894 100644 --- a/docs/content/7.examples/1.index.md +++ b/docs/content/7.examples/1.index.md @@ -5,13 +5,13 @@ description: Working examples and starter templates. ## Live Demo -::card{to="https://demo-nuxt-better-auth.nuxt.dev" target="_blank" icon="i-lucide-external-link"} +::card{to="https://demo.better-auth.nuxtjs.org" target="_blank" icon="i-lucide-external-link"} **Full Demo** – Email/password, OAuth, protected routes :: ## Starter Templates -- [Basic Auth](https://github.com/onmax/nuxt-better-auth/tree/main/playground) - Module playground with email auth +- [Basic Auth](https://github.com/nuxt-modules/better-auth/tree/main/playground) - Module playground with email auth - [NuxtHub + Auth](https://github.com/nuxt-hub/core/tree/main/examples) - Database persistence example ## Code Snippets diff --git a/docs/nuxt.config.ts b/docs/nuxt.config.ts index 4c756ea..a227eec 100644 --- a/docs/nuxt.config.ts +++ b/docs/nuxt.config.ts @@ -11,7 +11,7 @@ export default defineNuxtConfig({ css: ['~/assets/css/main.css'], site: { - url: 'https://nuxt-better-auth.onmax.me', + url: 'https://better-auth.nuxtjs.org', name: 'Nuxt Better Auth', description: 'Nuxt module for Better Auth with auto schema generation, route protection, and session management.', defaultLocale: 'en', diff --git a/package.json b/package.json index 48f2fba..5b058b6 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,27 @@ { - "name": "@onmax/nuxt-better-auth", + "name": "@nuxtjs/better-auth", "type": "module", "version": "0.0.2-alpha.20", "packageManager": "pnpm@10.15.1", "description": "Nuxt module for Better Auth integration with NuxtHub, route protection, session management, and role-based access", - "author": "onmax", + "author": "Nuxt Modules", "license": "MIT", + "homepage": "https://better-auth.nuxtjs.org", "repository": { "type": "git", - "url": "https://github.com/onmax/nuxt-better-auth" + "url": "git+https://github.com/nuxt-modules/better-auth.git" + }, + "bugs": { + "url": "https://github.com/nuxt-modules/better-auth/issues" + }, + "keywords": [ + "nuxt", + "nuxt-module", + "auth", + "better-auth" + ], + "publishConfig": { + "access": "public" }, "agents": { "skills": [ @@ -57,7 +70,7 @@ "dev:prepare": "nuxt-module-build build --stub && nuxi prepare playground", "dev:docs": "nuxi dev docs", "build:docs": "nuxi build docs", - "release": "bumpp --push --no-push-all", + "release": "bumpp --push", "lint": "eslint .", "lint:fix": "eslint . --fix", "typecheck": "vue-tsc --noEmit", diff --git a/playground/app/pages/forget-password.vue b/playground/app/pages/forget-password.vue index f97b970..bf4a9cc 100644 --- a/playground/app/pages/forget-password.vue +++ b/playground/app/pages/forget-password.vue @@ -67,7 +67,7 @@ async function handleRequestReset() {

    built with - + nuxt-better-auth.

    diff --git a/playground/app/pages/index.vue b/playground/app/pages/index.vue index bdd5a18..4a440bd 100644 --- a/playground/app/pages/index.vue +++ b/playground/app/pages/index.vue @@ -23,7 +23,7 @@ const { loggedIn } = useUserSession() Official demo to showcase better-auth. features using - nuxt-better-auth. + nuxt-better-auth.

    diff --git a/playground/app/pages/login.vue b/playground/app/pages/login.vue index b45c2e7..ae7eda8 100644 --- a/playground/app/pages/login.vue +++ b/playground/app/pages/login.vue @@ -104,7 +104,7 @@ async function handlePasskeySignIn() {

    built with - + nuxt-better-auth.

    diff --git a/playground/app/pages/register.vue b/playground/app/pages/register.vue index 162fcca..f4b68b0 100644 --- a/playground/app/pages/register.vue +++ b/playground/app/pages/register.vue @@ -127,7 +127,7 @@ async function handleSignUp() {

    built with - + nuxt-better-auth.

    diff --git a/playground/app/pages/reset-password.vue b/playground/app/pages/reset-password.vue index 809e22b..13d787a 100644 --- a/playground/app/pages/reset-password.vue +++ b/playground/app/pages/reset-password.vue @@ -86,7 +86,7 @@ async function handleResetPassword() {

    built with - + nuxt-better-auth.

    diff --git a/playground/nuxt.config.ts b/playground/nuxt.config.ts index b5182bd..492ee30 100644 --- a/playground/nuxt.config.ts +++ b/playground/nuxt.config.ts @@ -34,7 +34,7 @@ export default defineNuxtConfig({ runtimeConfig: { public: { - siteUrl: 'https://demo-nuxt-better-auth.onmax.me', + siteUrl: 'https://demo.better-auth.nuxtjs.org', }, }, @@ -63,7 +63,7 @@ export default defineNuxtConfig({ nodeCompat: true, wrangler: { name: 'nuxt-better-auth-demo', - routes: [{ pattern: 'demo-nuxt-better-auth.onmax.me', zone_name: 'onmax.me', custom_domain: true }], + routes: [{ pattern: 'demo.better-auth.nuxtjs.org', zone_name: 'nuxtjs.org', custom_domain: true }], observability: { enabled: true, logs: { enabled: true, invocation_logs: true } }, }, }, diff --git a/src/module.ts b/src/module.ts index f7b218d..5f31b05 100644 --- a/src/module.ts +++ b/src/module.ts @@ -144,7 +144,7 @@ async function promptForSecret(rootDir: string): Promise { export type { BetterAuthModuleOptions } from './runtime/config' export default defineNuxtModule({ - meta: { name: '@onmax/nuxt-better-auth', version, configKey: 'auth', compatibility: { nuxt: '>=3.0.0' } }, + meta: { name: '@nuxtjs/better-auth', version, configKey: 'auth', compatibility: { nuxt: '>=3.0.0' } }, defaults: { clientOnly: false, serverConfig: 'server/auth.config', @@ -161,14 +161,14 @@ export default defineNuxtModule({ const serverPath = join(nuxt.options.rootDir, 'server/auth.config.ts') const clientPath = join(nuxt.options.srcDir, 'auth.config.ts') - const serverTemplate = `import { defineServerAuth } from '@onmax/nuxt-better-auth/config' + const serverTemplate = `import { defineServerAuth } from '@nuxtjs/better-auth/config' export default defineServerAuth({ emailAndPassword: { enabled: true }, }) ` - const clientTemplate = `import { defineClientAuth } from '@onmax/nuxt-better-auth/config' + const clientTemplate = `import { defineClientAuth } from '@nuxtjs/better-auth/config' export default defineClientAuth({}) ` @@ -216,6 +216,18 @@ export default defineClientAuth({}) const hub = hasNuxtHub ? (nuxt.options as { hub?: NuxtHubOptions }).hub : undefined const hasHubDb = !clientOnly && hasNuxtHub && !!hub?.db + // Nitro rollup can choke on libsql optional deps on non-Linux platforms + // (e.g. trying to resolve @libsql/linux-x64-gnu on macOS). Externalize it + // when NuxtHub DB is enabled so runtime can resolve the correct platform binding. + if (hasHubDb) { + nuxt.options.nitro = nuxt.options.nitro || {} + nuxt.options.nitro.externals = defu(nuxt.options.nitro.externals as Record, { external: [] }) as { external?: string[], trace?: boolean } + const existing = Array.isArray(nuxt.options.nitro.externals.external) ? nuxt.options.nitro.externals.external : [] + nuxt.options.nitro.externals.external = Array.from(new Set([...existing, 'libsql'])) + if (isTest) + nuxt.options.nitro.externals.trace = false + } + // Convex detection const hasConvex = hasNuxtModule('nuxt-convex', nuxt) const convexUrl = resolveConvexUrl(nuxt) @@ -324,7 +336,7 @@ export { db }` { convexUrl }, ) databaseCode = `import { useRuntimeConfig } from '#imports' -import { createConvexHttpAdapter } from '@onmax/nuxt-better-auth/adapters/convex' +import { createConvexHttpAdapter } from '@nuxtjs/better-auth/adapters/convex' import { api } from '#convex/api' export function createDatabase() { @@ -393,7 +405,7 @@ interface _AugmentedServerAuthContext { ${hasHubDb ? `db: typeof import('@nuxthub/db')['db']` : 'db: unknown'} } -declare module '@onmax/nuxt-better-auth/config' { +declare module '@nuxtjs/better-auth/config' { import type { BetterAuthOptions } from 'better-auth' type ServerAuthConfig = Omit export function defineServerAuth(config: T | ((ctx: _AugmentedServerAuthContext) => T)): (ctx: _AugmentedServerAuthContext) => T diff --git a/src/runtime/app/pages/__better-auth-devtools.vue b/src/runtime/app/pages/__better-auth-devtools.vue index 8d7ac4d..aea349a 100644 --- a/src/runtime/app/pages/__better-auth-devtools.vue +++ b/src/runtime/app/pages/__better-auth-devtools.vue @@ -218,7 +218,7 @@ function getAccountActions(row: AccountRow) {
    diff --git a/src/schema-generator.ts b/src/schema-generator.ts index 94b4d4d..eb9f553 100644 --- a/src/schema-generator.ts +++ b/src/schema-generator.ts @@ -194,7 +194,7 @@ export async function loadUserAuthConfig(configPath: string, throwOnError = fals if (typeof configFn === 'function') { return configFn({ runtimeConfig: {}, db: null }) } - consola.warn('[@onmax/nuxt-better-auth] auth.config.ts does not export default. Expected: export default defineServerAuth(...)') + consola.warn('[@nuxtjs/better-auth] auth.config.ts does not export default. Expected: export default defineServerAuth(...)') if (throwOnError) { throw new Error('auth.config.ts must export default defineServerAuth(...)') } @@ -204,7 +204,7 @@ export async function loadUserAuthConfig(configPath: string, throwOnError = fals if (throwOnError) { throw new Error(`Failed to load auth config: ${error instanceof Error ? error.message : error}`) } - consola.error('[@onmax/nuxt-better-auth] Failed to load auth config for schema generation. Schema may be incomplete:', error) + consola.error('[@nuxtjs/better-auth] Failed to load auth config for schema generation. Schema may be incomplete:', error) return {} } finally { diff --git a/test/fixtures/basic/.nuxtrc b/test/fixtures/basic/.nuxtrc index 58a663e..c89e1e4 100644 --- a/test/fixtures/basic/.nuxtrc +++ b/test/fixtures/basic/.nuxtrc @@ -1 +1 @@ -setups.@onmax/nuxt-better-auth="0.0.2-alpha.17" \ No newline at end of file +setups.@nuxtjs/better-auth="0.0.2-alpha.20" diff --git a/test/fixtures/no-db/.nuxtrc b/test/fixtures/no-db/.nuxtrc index 58a663e..c89e1e4 100644 --- a/test/fixtures/no-db/.nuxtrc +++ b/test/fixtures/no-db/.nuxtrc @@ -1 +1 @@ -setups.@onmax/nuxt-better-auth="0.0.2-alpha.17" \ No newline at end of file +setups.@nuxtjs/better-auth="0.0.2-alpha.20" diff --git a/test/fixtures/no-hub/.nuxtrc b/test/fixtures/no-hub/.nuxtrc index 58a663e..c89e1e4 100644 --- a/test/fixtures/no-hub/.nuxtrc +++ b/test/fixtures/no-hub/.nuxtrc @@ -1 +1 @@ -setups.@onmax/nuxt-better-auth="0.0.2-alpha.17" \ No newline at end of file +setups.@nuxtjs/better-auth="0.0.2-alpha.20"