Initialize Next.js app with Supabase, Brevo config and migration
This commit is contained in:
1 parent
af8dc721a1
commit
8763c5bace
21 files changed
+8299
-1
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
|
||||
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL || '';
|
||||
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || '';
|
||||
|
||||
if (!supabaseUrl || !supabaseAnonKey) {
|
||||
console.warn('Supabase URL or Anon Key is missing in environment variables.');
|
||||
}
|
||||
|
||||
// Client-side Supabase client
|
||||
export const supabase = createClient(supabaseUrl, supabaseAnonKey);
|
||||
|
||||
// Server-side admin client (with service_role)
|
||||
export function getSupabaseAdmin() {
|
||||
const serviceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY;
|
||||
if (!serviceRoleKey) {
|
||||
throw new Error('SUPABASE_SERVICE_ROLE_KEY is required for admin operations.');
|
||||
}
|
||||
return createClient(supabaseUrl, serviceRoleKey);
|
||||
}
|
||||
Reference in new issue
Block a user