The Supabase JS client auto-derives API paths from the base URL:
- REST: ${url}/rest/v1/
- Auth: ${url}/auth/v1/
Nginx now proxies these standard paths to the correct backend services.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
28 lines
766 B
TypeScript
28 lines
766 B
TypeScript
import { createClient } from '@supabase/supabase-js'
|
|
|
|
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL as string
|
|
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY as string
|
|
|
|
/**
|
|
* Supabase client singleton.
|
|
* Returns null if env vars are not configured (local-only mode).
|
|
*
|
|
* The client auto-derives API paths from the base URL:
|
|
* - REST: ${supabaseUrl}/rest/v1/
|
|
* - Auth: ${supabaseUrl}/auth/v1/
|
|
*/
|
|
export const supabase =
|
|
supabaseUrl && supabaseAnonKey
|
|
? createClient(supabaseUrl, supabaseAnonKey, {
|
|
auth: {
|
|
persistSession: true,
|
|
autoRefreshToken: true,
|
|
detectSessionInUrl: true,
|
|
},
|
|
})
|
|
: null
|
|
|
|
export function isSupabaseConfigured(): boolean {
|
|
return supabase !== null
|
|
}
|