clerk-nuxt-patterns

Community

Protect Nuxt 3 routes and APIs with Clerk

AuthorRajAryanIITBHU
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Provides clear, production-minded Nuxt 3 authentication patterns using @clerk/nuxt so teams can reliably protect pages, secure Nitro server API routes, and implement SSR-safe auth without guesswork.

Core Features & Use Cases

  • Auto-registered auth route protection using the built-in auth middleware and definePageMeta for pages.
  • Server API protection patterns that use event.context.auth or clerkClient to enforce authentication and return appropriate 401/403 responses.
  • Client composables (useAuth, useUser, useClerk) auto-imported for component-level reactive state, SSR-safe hydration advice, and organization-scoped flows such as org switching.
  • Practical guidance for common tasks: protecting dashboard pages, creating authenticated Nitro routes, building custom sign-in pages, and avoiding hydration mismatches.

Quick Start

Install and enable @clerk/nuxt, set the NUXT_PUBLIC_CLERK_PUBLISHABLE_KEY and NUXT_CLERK_SECRET_KEY environment variables, add modules: ['@clerk/nuxt'] to nuxt.config.ts, and protect your /dashboard page by adding definePageMeta({ middleware: 'auth' }).

Dependency Matrix

Required Modules

None required

Components

references

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: clerk-nuxt-patterns
Download link: https://github.com/RajAryanIITBHU/bny/archive/main.zip#clerk-nuxt-patterns

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.