Skip to content

feat(auth): add first-class Nuxt integration - #214

Open
mezotv wants to merge 8 commits into
mainfrom
feat/nuxt-auth-sdk
Open

feat(auth): add first-class Nuxt integration#214
mezotv wants to merge 8 commits into
mainfrom
feat/nuxt-auth-sdk

Conversation

@mezotv

@mezotv mezotv commented Aug 23, 2026

Copy link
Copy Markdown
Member

Summary

  • add a Vue-backed @neondatabase/auth/nuxt client
  • add an H3/Nitro server adapter with event-bound server methods, an auth proxy and opt-in route protection
  • add a Nuxt UI example with auth flows, organizations, notes and shared E2E coverage
  • export the Nuxt adapter from @neondatabase/neon-js
  • prevent Vue clients from entering the React auth UI provider

Test plan

  • Build the SDK packages and Nuxt example
  • Typecheck @neondatabase/auth, @neondatabase/auth-ui, @neondatabase/neon-js and the Nuxt example
  • Run the auth unit tests (252 passing)
  • Lint the auth, auth-ui, neon-js and Nuxt example packages

Provide Vue client and Nitro server adapters so Nuxt apps can use Neon Auth with the same framework-native surface as Next.js.
@vercel

vercel Bot commented Aug 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
neon-auth-nextjs Ready Ready Preview Aug 29, 2026 5:08pm
react-neon-js Ready Ready Preview Aug 29, 2026 5:08pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
neon-auth-magic-link-example Ignored Ignored Preview Aug 29, 2026 5:08pm
react-auth-external-ui Ignored Ignored Aug 29, 2026 5:08pm

Request Review

Keep Vue clients out of the React provider contract and trim duplicated Nuxt docs and adapter test scaffolding.
Use direct technical wording across the new Nuxt docs and remove Oxford commas from the added prose.

This comment was marked as spam.

@Shridhad Shridhad left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Nuxt implementation does reuse the extracted @neondatabase/auth/server toolkit correctly: RequestContext, createAuthServer, handleAuthProxyRequest, processAuthMiddleware, validation, and logging remain shared rather than being copied. The H3 bridge also handles raw bodies and separate Set-Cookie values carefully, and the explicit event binding has a good concurrency test.

The main blocker is the route-protection default. Unlike Hono PR #202, where middleware is scoped to a protected route, Nitro middleware is global and this defaults to protecting every path. That can redirect Nuxt assets and nominally public server routes. The docs currently encourage using auth.middleware() without showing a safe protectedRoutes configuration, and the missing example means there is no integration artifact demonstrating the intended wiring.

I also think we should make an explicit API decision before calling Nuxt a reference adapter: Next and Hono return the NeonAuthServer proxy directly and attach .handler() / .middleware(), while Nuxt returns { withEvent, handler, middleware }. Explicit event binding is safe, but it means future framework adapters cannot follow one consistent application-facing pattern. If Nitro request context cannot safely support the same surface, documenting this as a deliberate Nuxt-specific exception is reasonable.

Requested changes: make the middleware default safe (or explicitly exclude framework assets and document whole-app protection), add real middleware wiring tests, and either include the referenced Nuxt example or remove the broken link and provide complete setup snippets.

Comment thread packages/auth/src/nuxt/server/middleware.ts Outdated
Comment thread packages/auth/src/nuxt/server/index.test.ts
Comment thread packages/auth/README.md
Comment thread packages/auth/src/nuxt/server/index.ts
mezotv added 2 commits August 26, 2026 22:13
Show the Nuxt adapter with Nuxt UI auth flows, organizations, user-scoped notes and shared E2E coverage.
Keep global Nitro middleware safe by default, document explicit event binding and cover public and protected route wiring.
Avoid matching Nuxt UI password visibility controls in shared auth helpers.
Use the accessible label when available and fall back to the Better Auth UI placeholder.

@Shridhad Shridhad left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up looks good. The previous blockers are addressed: route protection is opt-in, middleware wiring tests cover the Nuxt-specific paths, the example is in-tree with handler/middleware/withEvent docs, and withEvent is documented as a Nuxt-specific exception rather than a new adapter template. Unit tests plus React/Next/Nuxt E2E are green.

The adapter still sits on the shared toolkit correctly. Two leftover nits below, neither blocking.

Comment thread packages/auth/README.md Outdated
Comment thread e2e/tests/organizations.spec.ts
Match the Nuxt middleware docs to the example and skip unsupported organization views only for the Nuxt target.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants