- lib/supabase.ts: Return null when credentials missing instead of crash - next.config.js: Add assetPrefix and basePath for VibeCoder proxy - package.json: Use generic template name (v0.2.0)
15 lines
586 B
TypeScript
15 lines
586 B
TypeScript
import { createClient, SupabaseClient } from '@supabase/supabase-js';
|
|
|
|
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
|
|
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
|
|
|
|
// Create client only if credentials are available
|
|
// This allows the app to run without Supabase for basic previews
|
|
export const supabase: SupabaseClient | null =
|
|
supabaseUrl && supabaseAnonKey
|
|
? createClient(supabaseUrl, supabaseAnonKey)
|
|
: null;
|
|
|
|
// Helper to check if Supabase is configured
|
|
export const isSupabaseConfigured = (): boolean => supabase !== null;
|