import { createClient } from '@supabase/supabase-js'; import type { Database } from './database.types'; const supabaseUrl = import.meta.env.VITE_SUPABASE_URL; const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY; // Check if Supabase is configured export const isSupabaseConfigured = !!(supabaseUrl && supabaseAnonKey && supabaseUrl !== 'https://your-project-ref.supabase.co' && supabaseAnonKey !== 'your-anon-key-here'); // Use fallback values for development if not configured const fallbackUrl = 'https://demo.supabase.co'; const fallbackKey = 'demo-key'; export const supabase = createClient( supabaseUrl || fallbackUrl, supabaseAnonKey || fallbackKey, { auth: { autoRefreshToken: isSupabaseConfigured, persistSession: isSupabaseConfigured, detectSessionInUrl: isSupabaseConfigured } } ); // Auth helpers export const auth = supabase.auth; // Database helpers export const db = supabase.from; // Storage helpers export const storage = supabase.storage; // Real-time helpers export const channel = supabase.channel;