supabase-nextjs-integration

Set up Supabase integration in Next.js App Router projects with TypeScript.

2|Updated Dec 5, 2025
One-click install
npx skills add https://github.com/AgentiveCity/SkillFactory --skill supabase-nextjs-integration
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: supabase-nextjs-integration
Source: https://github.com/AgentiveCity/SkillFactory/tree/main/.claude/skills/supabase-nextjs-integration
Command: npx skills add https://github.com/AgentiveCity/SkillFactory --skill supabase-nextjs-integration

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Setting up, refactoring, or optimizing Supabase usage in Next.js App Router projects, including auth, database, storage, RLS-safe patterns, and edge functions, can be complex and security-critical. This Skill streamlines the integration, ensuring secure, idiomatic, and scalable Supabase usage, reducing development effort and potential vulnerabilities.

Core Features & Use Cases

  • Secure Supabase Client Setup: Configure Supabase clients for Server Components, Route Handlers, Server Actions, and client components, ensuring safe environment variable handling.
  • Auth Flows & RLS Enforcement: Implement email/password, OAuth, and magic link auth flows, and ensure Row Level Security (RLS) is correctly applied to protect data.
  • Database, Storage & Edge Functions: Integrate Supabase database, storage, and edge functions with appropriate runtime choices (Edge vs Node) for optimal performance and security.

Quick Start

Set up Supabase auth and secure dashboard routes in this Next.js app, and use Supabase with RLS to store user-specific todos.

Frequently Asked Questions about supabase-nextjs-integration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Supabase authentication in a Next.js App Router project?

Set up Supabase authentication by configuring environment variables, creating separate client instances for server and browser contexts, and implementing auth flows (email/password, OAuth, magic link) using Next.js Server Components and Route Handlers. This ensures credentials remain secure and authentication state syncs across the app.

What's the secure way to use Supabase database and storage with Next.js?

Use Supabase's RLS (Row Level Security) policies to protect database queries, create server-side clients for sensitive operations, and never expose the service_role key to the browser. Store the anon key client-side and service_role key only in server components or Route Handlers to enforce data access control.

Can I use Supabase edge functions with Next.js, and which runtime should I choose?

Supabase edge functions integrate with Next.js Route Handlers and Server Actions. Choose Edge runtime for low-latency, globally-distributed functions; use Node runtime for database-heavy operations. The Skill handles runtime selection based on your performance and security requirements.

How do I structure Supabase clients for Next.js Server Components, Route Handlers, and client components?

Create modular, separate Supabase client instances: one for Server Components and Route Handlers using the service_role key, another for client components using the anon key. This modular pattern enforces environment variable conventions and prevents accidental key exposure.

Why is Row Level Security (RLS) important when using Supabase with Next.js?

RLS enforces data access policies at the database layer, ensuring users can only access their own records even if they bypass your application logic. Combined with secure client setup in Next.js, RLS is critical for protecting sensitive user data from unauthorized access.

Do I need to refactor my existing Supabase setup in Next.js for security and performance?

If your project mixes anon and service_role keys, lacks RLS policies, or doesn't separate client-side and server-side Supabase instances, refactoring improves security and scalability. The Skill guides optimization for environment configuration, runtime selection, and idiomatic Next.js patterns.