Guides
Protected Routes
How to add authentication-protected routes with Clerk and Convex.
A short recipe for adding routes that require authentication.
What You'll Do
- Protect a Next.js route with Clerk middleware
- Gate Convex queries and mutations behind authentication
- Handle unauthenticated access gracefully
- Use
ensureUserAuthenticated()in backend functions