What problem does it solve?
Clerk authentication in Nuxt 3 often breaks when developers mix client-only composables with server-side route protection, causing unprotected routes, incorrect redirects, or SSR hydration issues.
Core Features & Use Cases
- Route protection that redirects correctly: Use the built-in named auth middleware via definePageMeta to guard pages like /dashboard.
- Server-safe user access for APIs: Read auth state from event.context.auth in Nitro server routes and return 401/403 appropriately.
- SSR-safe client patterns: UseAuth and useUser for reactive state while avoiding hydration mismatches with loading boundaries such as isLoaded.
- Org-aware UI patterns: Scope dashboard behavior using orgId and orgRole for multi-organization SaaS experiences.
Quick Start
Ask the AI to provide a Nuxt 3 implementation that protects the /dashboard page with @clerk/nuxt auth middleware, shows a user profile using useUser(), and adds a Nitro server route that returns 401 when event.context.auth.userId is missing.