Skip to content
davila7 avatar

Nextjs Supabase Auth

Expert guidance for Supabase Auth in Next.js App Router, covering server, client, and middleware sessions.

CCM score
57 of 100
skills.sh installs
411
GitHub stars
34.3K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers session handling across Server Components, Client Components, Server Actions, and middleware for protected routes
  • Includes patterns for Supabase client setup, auth middleware with session refresh, and the OAuth auth callback route
  • Enforces @supabase/ssr usage and cookie-based sessions, and flags anti-patterns like getSession in Server Components and manual token storage
  • Designed for projects pairing nextjs-app-router with supabase-backend that need login and route protection

Install

$ npx -y skills add davila7/claude-code-templates --skill nextjs-supabase-auth -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Next.js + Supabase Auth

You are an expert in integrating Supabase Auth with Next.js App Router. You understand the server/client boundary, how to handle auth in middleware, Server Components, Client Components, and Server Actions.

Your core principles:

  1. Use @supabase/ssr for App Router integration
  2. Handle tokens in middleware for protected routes
  3. Never expose auth tokens to client unnecessarily
  4. Use Server Actions for auth operations when possible
  5. Understand the cookie-based session flow

Capabilities

  • nextjs-auth
  • supabase-auth-nextjs
  • auth-middleware
  • auth-callback

Requirements

  • nextjs-app-router
  • supabase-backend

Patterns

Supabase Client Setup

Create properly configured Supabase clients for different contexts

Auth Middleware

Protect routes and refresh sessions in middleware

Auth Callback Route

Handle OAuth callback and exchange code for session

Anti-Patterns

❌ getSession in Server Components

❌ Auth State in Client Without Listener

❌ Storing Tokens Manually

Related Skills

Works well with: nextjs-app-router, supabase-backend

Details

Repository
github.com/davila7/claude-code-templates
Categories
Backend & APIs, Frontend & UI Code
First seen
Jun 3, 2026

Questions

What does the nextjs-supabase-auth skill do?

The nextjs-supabase-auth skill guides an agent through integrating Supabase Auth with the Next.js App Router. It covers Supabase client setup with @supabase/ssr, auth middleware that protects routes and refreshes sessions, and an auth callback route that exchanges the OAuth code for a session.

How do I install the nextjs-supabase-auth skill?

Run npx -y skills add davila7/claude-code-templates --skill nextjs-supabase-auth -y in your project. Once installed, nextjs-supabase-auth lets the agent write Supabase login, middleware and protected route code for a Next.js App Router app.

Where does nextjs-supabase-auth sit in the Backend and APIs category?

nextjs-supabase-auth is listed in the Backend and APIs category on Claude Marketplaces, next to entra-app-registration, neon, firebase-basics, firebase-auth-basics and workers-best-practices. It stands apart by focusing on cookie-based session flow between Next.js server and client code.

Who should use nextjs-supabase-auth?

nextjs-supabase-auth suits developers building login, logout and protected routes in a Next.js App Router project that uses Supabase. It also helps when the agent must handle auth tokens in middleware rather than exposing them to the client.

Does nextjs-supabase-auth need Next.js or Supabase to already be set up?

Yes, nextjs-supabase-auth requires the nextjs-app-router and supabase-backend skills. Use them alongside it, since the skill points to both as the pieces it works well with.

More from davila7/claude-code-templates

All 398

Similar to Nextjs Supabase Auth

More Backend & APIs