0
0
Supabasecloud~20 mins

Setting up a Supabase project - Practice Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Supabase Setup Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Supabase Project Initialization

When you create a new Supabase project, what is the first essential step to connect your application to the Supabase backend?

AObtain the API URL and anon public key from the Supabase dashboard to configure your client.
BInstall a local database server on your machine before creating the project.
CWrite SQL queries manually before creating the project to define tables.
DSet up a virtual machine to host the Supabase backend.
Attempts:
2 left
💡 Hint

Think about what you need to connect your app to the cloud service after project creation.

Configuration
intermediate
2:00remaining
Supabase Environment Variable Setup

You want to securely store your Supabase project URL and anon key in a Node.js app. Which environment variable setup is correct?

Supabase
import { createClient } from '@supabase/supabase-js';

const supabaseUrl = process.env.SUPABASE_URL;
const supabaseKey = process.env.SUPABASE_ANON_KEY;
const supabase = createClient(supabaseUrl, supabaseKey);
AUse a global variable in the browser to store the URL and key.
BHardcode the URL and key directly in the code for faster access.
CStore the URL and key in a JSON file and import it directly.
DSet SUPABASE_URL and SUPABASE_ANON_KEY in a .env file and load them with dotenv package.
Attempts:
2 left
💡 Hint

Think about keeping secrets safe and not exposing keys in code.

Architecture
advanced
3:00remaining
Choosing Supabase Database Schema Design

You are designing a Supabase project for a simple blog. Which schema design best supports posts with multiple tags and user comments?

ACreate tables: posts, tags, post_tags (join table), users, comments with foreign keys linking appropriately.
BCreate one big table combining posts, tags, users, and comments in columns.
CCreate tables: posts, tags, users only; store comments inside posts as JSON.
DCreate tables: posts and comments only, store tags as comma-separated strings in posts.
Attempts:
2 left
💡 Hint

Think about how to represent many-to-many relationships and keep data organized.

security
advanced
3:00remaining
Supabase Row Level Security (RLS) Configuration

You want to restrict access so users can only read their own profile data in Supabase. Which RLS policy is correct?

Supabase
CREATE POLICY "Users can view their own profile" ON profiles
FOR SELECT USING (auth.uid() = user_id);
ACREATE POLICY "Users can view all profiles" ON profiles FOR SELECT USING (true);
BCREATE POLICY "Users can view their own profile" ON profiles FOR SELECT USING (auth.uid() = user_id);
CCREATE POLICY "Users can view profiles" ON profiles FOR SELECT USING (user_id = 'admin');
DNo policy needed; all profiles are public by default.
Attempts:
2 left
💡 Hint

Think about matching the authenticated user ID to the profile's user ID.

service_behavior
expert
3:00remaining
Supabase Realtime Behavior on Database Changes

In a Supabase project with Realtime enabled on the 'messages' table, what happens when a new message row is inserted?

AClients receive an event only if they query the table again.
BOnly the client that inserted the row receives an event notification.
CAll clients subscribed to 'messages' receive an event with the new row data immediately.
DNo event is sent until the database is manually refreshed.
Attempts:
2 left
💡 Hint

Think about how realtime subscriptions work to keep clients updated.