← All components

Supabase Database & Auth Client

Adds browser/server Supabase clients (@supabase/ssr) and wraps the root layout in a SupabaseProvider via AST injection.

Copy the files below, or open this folder on GitHub. Each file is stamped with a limited-use licence, generator and date. SHA-256 is of the published catalog bytes, before the stamp.

id
supabase-client
stack
Next.js
version
2.0.0
compatibility
nextjs >=16 <17 · react >=19 <20 · supabase_ssr >=0.12 <1
requires
nextjs-base
env vars
NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY
Verified passing · daily buildIntegrity sha256:0de5a242433e2a71

Files (3)

lib/supabase/client.ts · sha256:0de5a242433e2a71…
// Licensed by BotKelp — https://www.botkelp.com

import { createBrowserClient } from '@supabase/ssr';

/**
 * Supabase client for use in Client Components (browser).
 * 
 * IMPORTANT: The anon key (NEXT_PUBLIC_SUPABASE_ANON_KEY) is exposed to the client.
 * You MUST enable Row-Level Security (RLS) on ALL tables in your Supabase database
 * to prevent unauthorized access. Without RLS, anyone can read/write your data.
 * 
 * See: https://supabase.com/docs/guides/auth/row-level-security
 */
export function createClient() {
  return createBrowserClient(
    process.env.NEXT_PUBLIC_SUPABASE_URL!,
    process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
  );
}