@onmax/nuxt-better-auth 0.0.2-alpha.31 → 0.0.2-alpha.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -17
- package/dist/module.json +2 -2
- package/dist/module.mjs +580 -261
- package/dist/runtime/app/components/BetterAuthState.d.vue.ts +4 -4
- package/dist/runtime/app/components/BetterAuthState.vue +1 -1
- package/dist/runtime/app/components/BetterAuthState.vue.d.ts +4 -4
- package/dist/runtime/app/composables/useAuthClient.d.ts +9 -0
- package/dist/runtime/app/composables/useAuthClient.js +34 -0
- package/dist/runtime/app/composables/useAuthClientAction.d.ts +1 -3
- package/dist/runtime/app/composables/useAuthClientAction.js +2 -2
- package/dist/runtime/app/composables/useAuthRequestFetch.d.ts +1 -1
- package/dist/runtime/app/composables/useSignIn.js +2 -2
- package/dist/runtime/app/composables/useSignUp.js +2 -2
- package/dist/runtime/app/composables/useUserSession.d.ts +5 -4
- package/dist/runtime/app/composables/useUserSession.js +62 -69
- package/dist/runtime/app/composables/useUserSessionState.d.ts +3 -0
- package/dist/runtime/app/composables/useUserSessionState.js +4 -0
- package/dist/runtime/app/internal/session-fetch.d.ts +1 -1
- package/dist/runtime/app/internal/vue-safe-auth-proxy.d.ts +3 -0
- package/dist/runtime/app/internal/vue-safe-auth-proxy.js +68 -0
- package/dist/runtime/app/middleware/auth.global.js +5 -4
- package/dist/runtime/app/plugins/session.client.js +2 -1
- package/dist/runtime/composables.d.ts +11 -0
- package/dist/runtime/composables.js +9 -0
- package/dist/runtime/config.d.ts +4 -2
- package/dist/runtime/server/api/_better-auth/_schema.d.ts +1 -5
- package/dist/runtime/server/api/_better-auth/accounts.get.d.ts +2 -2
- package/dist/runtime/server/api/_better-auth/config.get.js +1 -1
- package/dist/runtime/server/api/_better-auth/sessions.get.d.ts +2 -2
- package/dist/runtime/server/api/_better-auth/users.get.d.ts +2 -2
- package/dist/runtime/server/middleware/route-access.js +1 -1
- package/dist/runtime/server/utils/auth.d.ts +13 -2
- package/dist/runtime/server/utils/auth.js +42 -16
- package/dist/runtime/server/utils/session.d.ts +3 -1
- package/dist/runtime/server/utils/session.js +175 -1
- package/dist/runtime/server/virtual-modules.d.ts +5 -0
- package/dist/runtime/types/augment.d.ts +1 -3
- package/dist/runtime/types.d.ts +1 -1
- package/package.json +28 -12
package/README.md
CHANGED
|
@@ -1,27 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
<img src="https://raw.githubusercontent.com/onmax/nuxt-better-auth/main/.github/og.png" alt="Nuxt Better Auth" width="100%">
|
|
3
|
-
<br>
|
|
4
|
-
<sub>Designed by <a href="https://github.com/HugoRCD">HugoRCD</a></sub>
|
|
5
|
-
</p>
|
|
1
|
+
# `@onmax/nuxt-better-auth`
|
|
6
2
|
|
|
7
|
-
|
|
3
|
+
Nuxt module for [Better Auth](https://better-auth.com) with Nuxt-native route protection, SSR-safe session access, auto-imported helpers, and optional NuxtHub-backed schema generation.
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
> [!WARNING]
|
|
6
|
+
> This package is still in alpha. Expect API and behavior changes before a stable release.
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
<a href="https://npmjs.com/package/@onmax/nuxt-better-auth"><img src="https://img.shields.io/npm/v/@onmax/nuxt-better-auth/latest.svg?style=flat&colorA=020420&colorB=00DC82" alt="npm version"></a>
|
|
13
|
-
<a href="https://npm.chart.dev/@onmax/nuxt-better-auth"><img src="https://img.shields.io/npm/dm/@onmax/nuxt-better-auth.svg?style=flat&colorA=020420&colorB=00DC82" alt="npm downloads"></a>
|
|
14
|
-
<a href="https://npmjs.com/package/@onmax/nuxt-better-auth"><img src="https://img.shields.io/npm/l/@onmax/nuxt-better-auth.svg?style=flat&colorA=020420&colorB=00DC82" alt="License"></a>
|
|
15
|
-
<a href="https://nuxt.com"><img src="https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js" alt="Nuxt"></a>
|
|
16
|
-
</p>
|
|
8
|
+
## Who this is for
|
|
17
9
|
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
Use this module if you want Better Auth in a Nuxt 4 app and you want the Nuxt-specific pieces handled for you:
|
|
11
|
+
|
|
12
|
+
- `useUserSession()` for reactive auth state
|
|
13
|
+
- `requireUserSession(event)` and related server helpers
|
|
14
|
+
- route protection through `routeRules` and `definePageMeta({ auth })`
|
|
15
|
+
- generated `server/auth.config.ts` and `app/auth.config.ts`
|
|
16
|
+
- optional NuxtHub database integration and schema generation
|
|
17
|
+
|
|
18
|
+
## Install the module
|
|
19
|
+
|
|
20
|
+
For the fastest path in a Nuxt 4 app:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx nuxi module add @onmax/nuxt-better-auth@alpha
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then create or confirm these files:
|
|
27
|
+
|
|
28
|
+
- `server/auth.config.ts`
|
|
29
|
+
- `app/auth.config.ts`
|
|
30
|
+
- `.env` with `NUXT_BETTER_AUTH_SECRET`
|
|
31
|
+
|
|
32
|
+
For the full setup flow, follow the [installation guide](https://better-auth.nuxt.dev/getting-started/installation).
|
|
33
|
+
|
|
34
|
+
## Choose your setup path
|
|
35
|
+
|
|
36
|
+
- Use [NuxtHub integration](https://better-auth.nuxt.dev/integrations/nuxthub) if you want the shortest path to database-backed auth.
|
|
37
|
+
- Use [custom database setup](https://better-auth.nuxt.dev/guides/custom-database) if you already have your own database stack.
|
|
38
|
+
- Use [external auth backend](https://better-auth.nuxt.dev/guides/external-auth-backend) if Better Auth runs in a separate service.
|
|
39
|
+
- Use [database-less mode](https://better-auth.nuxt.dev/guides/database-less-mode) for stateless or OAuth-first setups with clear tradeoffs.
|
|
20
40
|
|
|
21
41
|
## Documentation
|
|
22
42
|
|
|
23
|
-
|
|
43
|
+
The documentation site is at [better-auth.nuxt.dev](https://better-auth.nuxt.dev).
|
|
44
|
+
|
|
45
|
+
Recommended reading order:
|
|
46
|
+
|
|
47
|
+
1. [Quickstart](https://better-auth.nuxt.dev/getting-started)
|
|
48
|
+
2. [Installation](https://better-auth.nuxt.dev/getting-started/installation)
|
|
49
|
+
3. [Configuration](https://better-auth.nuxt.dev/getting-started/configuration)
|
|
50
|
+
4. [Client setup](https://better-auth.nuxt.dev/getting-started/client-setup)
|
|
51
|
+
5. [Route protection](https://better-auth.nuxt.dev/core-concepts/route-protection)
|
|
52
|
+
|
|
53
|
+
## Development
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pnpm install
|
|
57
|
+
pnpm dev:docs
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Useful commands:
|
|
61
|
+
|
|
62
|
+
- `pnpm dev` to run the playground
|
|
63
|
+
- `pnpm dev:docs` to run the docs site
|
|
64
|
+
- `pnpm lint` to lint the repo
|
|
65
|
+
- `pnpm test` to run the test suite
|
|
66
|
+
- `pnpm build:docs` to build the docs site
|
|
24
67
|
|
|
25
68
|
## License
|
|
26
69
|
|
|
27
|
-
MIT
|
|
70
|
+
[MIT](https://github.com/nuxt-modules/better-auth/blob/main/LICENSE)
|
package/dist/module.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onmax/nuxt-better-auth",
|
|
3
|
-
"version": "0.0.2-alpha.
|
|
3
|
+
"version": "0.0.2-alpha.32",
|
|
4
4
|
"configKey": "auth",
|
|
5
5
|
"compatibility": {
|
|
6
6
|
"nuxt": ">=4.0.0"
|
|
7
7
|
},
|
|
8
8
|
"builder": {
|
|
9
9
|
"@nuxt/module-builder": "1.0.2",
|
|
10
|
-
"unbuild": "
|
|
10
|
+
"unbuild": "unknown"
|
|
11
11
|
}
|
|
12
12
|
}
|