When you create a new Supabase project, what is the first essential step to connect your application to the Supabase backend?
Think about what you need to connect your app to the cloud service after project creation.
After creating a Supabase project, you get an API URL and anon key. These let your app talk to the Supabase backend securely.
You want to securely store your Supabase project URL and anon key in a Node.js app. Which environment variable setup is correct?
import { createClient } from '@supabase/supabase-js'; const supabaseUrl = process.env.SUPABASE_URL; const supabaseKey = process.env.SUPABASE_ANON_KEY; const supabase = createClient(supabaseUrl, supabaseKey);
Think about keeping secrets safe and not exposing keys in code.
Using environment variables with a .env file and dotenv keeps secrets out of code and allows easy configuration.
You are designing a Supabase project for a simple blog. Which schema design best supports posts with multiple tags and user comments?
Think about how to represent many-to-many relationships and keep data organized.
Using separate tables with join tables and foreign keys is best practice for relational data like posts, tags, users, and comments.
You want to restrict access so users can only read their own profile data in Supabase. Which RLS policy is correct?
CREATE POLICY "Users can view their own profile" ON profiles
FOR SELECT USING (auth.uid() = user_id);Think about matching the authenticated user ID to the profile's user ID.
This policy allows users to select only rows where the user_id matches their authenticated ID, enforcing privacy.
In a Supabase project with Realtime enabled on the 'messages' table, what happens when a new message row is inserted?
Think about how realtime subscriptions work to keep clients updated.
Supabase Realtime pushes changes instantly to all subscribed clients when data changes occur.