aethex-forge/client/lib/supabase.ts
Builder.io 3b2f04b68b Add isSupabaseConfigured export
cgen-7fe01e523dab4f73bfbc0da6d18abe05
2025-08-06 02:18:29 +00:00

35 lines
956 B
TypeScript

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;
// Validate required environment variables
if (!supabaseUrl || !supabaseAnonKey) {
throw new Error(
"Missing Supabase environment variables. Please configure VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY",
);
}
// Always true in production mode - Supabase is required
export const isSupabaseConfigured = true;
export const supabase = createClient<Database>(supabaseUrl, supabaseAnonKey, {
auth: {
autoRefreshToken: true,
persistSession: true,
detectSessionInUrl: true,
},
});
// 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;