Add Supabase client and env template
This commit is contained in:
3
frontend/.env.example
Normal file
3
frontend/.env.example
Normal file
@@ -0,0 +1,3 @@
|
||||
VITE_SUPABASE_URL=https://YOURPROJECT.supabase.co
|
||||
VITE_SUPABASE_PUBLISHABLE_KEY=sb_publishable_YOURKEY
|
||||
VITE_API_URL=http://localhost:5057
|
||||
12
frontend/src/lib/supabase.ts
Normal file
12
frontend/src/lib/supabase.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
|
||||
const url = import.meta.env.VITE_SUPABASE_URL;
|
||||
const publishableKey = import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY;
|
||||
|
||||
if (!url || !publishableKey) {
|
||||
throw new Error(
|
||||
'Missing VITE_SUPABASE_URL or VITE_SUPABASE_PUBLISHABLE_KEY. Copy .env.example to .env.local and fill it in.'
|
||||
);
|
||||
}
|
||||
|
||||
export const supabase = createClient(url, publishableKey);
|
||||
Reference in New Issue
Block a user