Initial commit

This commit is contained in:
mstfyldz
2026-08-08 17:19:28 +03:00
commit df70520ede
19 changed files with 3926 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import { createClient } from '@supabase/supabase-js';
import dotenv from 'dotenv';
dotenv.config();
const supabaseUrl = process.env.SUPABASE_URL;
// We use the service role key in the backend to bypass RLS when necessary (e.g. inserting system analyses),
// or we can use anon key if RLS allows it. Let's assume we use the anon key or service role key provided in ENV.
// However, the frontend passes the user_id, so the backend can act on behalf of the user.
const supabaseKey = process.env.SUPABASE_SERVICE_ROLE_KEY || process.env.SUPABASE_ANON_KEY;
if (!supabaseUrl || !supabaseKey) {
throw new Error('Missing Supabase URL or Key in environment variables');
}
export const supabase = createClient(supabaseUrl, supabaseKey);