Skip to content
Development
Command

/add-protected-route

Create a protected Next.js route with authentication enforcement.

From plugin
larouex-fullstack-builder
881 skills12 agents81 commands

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/add-protected-route

Context preview

What this command does when you run it.

Create a protected Next.js route with authentication enforcement.

Command definition

add-protected-route.md

Create a protected Next.js route with authentication enforcement.

Generate:

  • Protected page component with authentication check
  • Middleware for route protection (middleware.ts pattern)
  • Authentication state verification (server-side)
  • Redirect logic to login page with return URL
  • Loading state while checking authentication
  • Unauthorized access handling
  • TypeScript types for protected route props
  • Higher-order component or wrapper for route protection
  • API route protection with authentication middleware
  • Role-based access control (RBAC) if needed

Implement both page-level protection (Server Components) and API route protection. Include proper error handling, loading states, and redirect logic. Ensure protected routes work with SSR and Client Components.

Ships withlarouex-fullstack-builder

A comprehensive Claude Code plugin with 81 commands and 12 specialized AI agents for building modern, full-stack web applications with Next.js 15, Azure, Railway, Bootstrap, and TypeScript.

Get the whole plugin

Other commands on larouex-fullstack-builder.