aethex-forge/client/lib/supabase.ts
Builder.io 8b06e9cc71 Remove demo fallbacks and require Supabase configuration
cgen-4d661c08fb904cf28ee2df7d8745dbb7
2025-08-06 02:11:25 +00:00

32 lines
855 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"
);
}
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;