supabase-auth-ssr-setup

This skill should be used when configuring Supabase Auth for server-side rendering with Next.js App Router, including secure cookie handling, middleware protection, route guards, authentication utilities, and logout flow. Apply when setting up SSR auth, adding protected routes, implementing middleware authentication, configuring secure sessions, or building login/logout flows with Supabase.

View on GitHub
Author Hope Overture
Namespace @hopeoverture/worldbuilding-app-skills
Category development
Version 1.0.0
Stars 1
Downloads 3
self.md verified
Table of content

This skill should be used when configuring Supabase Auth for server-side rendering with Next.js App Router, including secure cookie handling, middleware protection, route guards, authentication utilities, and logout flow. Apply when setting up SSR auth, adding protected routes, implementing middleware authentication, configuring secure sessions, or building login/logout flows with Supabase.

Installation

npx claude-plugins install @hopeoverture/worldbuilding-app-skills/supabase-auth-ssr-setup

Contents

Folders: skills

Included Skills

This plugin includes 1 skill definition:

supabase-auth-ssr-setup

This skill should be used when configuring Supabase Auth for server-side rendering with Next.js App Router, including secure cookie handling, middleware protection, route guards, authentication utilities, and logout flow. Apply when setting up SSR auth, adding protected routes, implementing middleware authentication, configuring secure sessions, or building login/logout flows with Supabase.

View skill definition

Supabase Auth SSR Setup

Overview

Configure Supabase Authentication for Next.js App Router with server-side rendering (SSR), secure cookie-based sessions, middleware protection, and complete authentication flows.

Installation and Configuration Steps

1. Install Dependencies

Install Supabase SSR package for Next.js:

npm install @supabase/supabase-js @supabase/ssr

2. Create Supabase Client Utilities

Create three client configurations for different contexts (browser, server, middleware):

File: lib/supabase/client.ts (Browser client)

Use the template from assets/supabase-client.ts. This client:

File: lib/supabase/server.ts (Server component client)

Use the template from assets/supabase-server.ts. This client:

File: lib/supabase/middleware.ts (Middleware client)

Use the template from assets/supabase-middleware.ts. This client:

3. Configure Environment Variables

Add Supabase credentials to .env.local:

NEXT_PUBLIC_SUPABASE_URL=your-project-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key

Get these values from your Supabase p

…(truncated)

Source

View on GitHub

Tags: development