Supabase interview questions

25 questions from the Supabase course, each with the correct answer and an explanation. Try to answer before you open the answer.

Supabase Foundations

1. What sits at the centre of every Supabase project?

  1. A key-value cache only
  2. A proprietary document store
  3. A full Postgres database
  4. A GraphQL-only data layer
Show answer

Answer: A full Postgres database

Everything else is built around Postgres.

Lesson: What Supabase Is

2. Which key bypasses Row Level Security?

  1. The service_role (secret) key
  2. The anon (publishable) key
  3. A user access token
  4. The project URL
Show answer

Answer: The service_role (secret) key

Keep it on the server only.

Lesson: Architecture and API Keys

3. How does a supabase-js query report a failure?

  1. It logs and retries forever
  2. It always throws an exception
  3. It returns HTTP 500 to the user
  4. It returns an error object alongside data
Show answer

Answer: It returns an error object alongside data

Destructure { data, error } and check error.

Lesson: Project Setup and the supabase-js Client

Working With the Database

4. Why define foreign keys between tables in Supabase?

  1. They are required for every column
  2. They enforce integrity and let the API do nested selects
  3. They disable RLS automatically
  4. They make tables public
Show answer

Answer: They enforce integrity and let the API do nested selects

PostgREST discovers relationships from foreign keys.

Lesson: Tables, Relationships and Migrations

5. How do you return the inserted row from an insert?

  1. Call .returnRow()
  2. Chain .select() after .insert()
  3. Inserts always return rows by default in v2
  4. Run a second query with the service key
Show answer

Answer: Chain .select() after .insert()

In v2 writes return no rows unless you select.

Lesson: Querying With supabase-js

6. What is the risk of a security definer function?

  1. It disables the anon key
  2. It cannot read any tables
  3. It only runs on the client
  4. It runs with the owner's rights and can bypass RLS
Show answer

Answer: It runs with the owner's rights and can bypass RLS

Treat definer functions as privileged code.

Lesson: Postgres Functions and RPC

Row Level Security

7. With RLS enabled and no policies, what can the anon role read?

  1. No rows
  2. All rows
  3. Only rows it inserted
  4. Only the first page
Show answer

Answer: No rows

RLS is deny by default.

Lesson: Why RLS Is Essential

8. Which clause validates the values of a newly inserted row?

  1. GRANT
  2. USING
  3. WITH CHECK
  4. RETURNING
Show answer

Answer: WITH CHECK

USING filters existing rows; WITH CHECK validates new ones.

Lesson: Writing Policies With auth.uid()

9. Why test policies as the authenticated role rather than in the default SQL editor session?

  1. Policies only exist in the client
  2. The SQL editor cannot run selects
  3. The default session is privileged and bypasses RLS
  4. Roles do not affect queries
Show answer

Answer: The default session is privileged and bypasses RLS

Test from the user's point of view.

Lesson: Policy Patterns and Testing

Authentication

10. What does signInWithOtp provide?

  1. Passwordless sign-in via a magic link or one-time code
  2. Sign-in with Google only
  3. A permanent API key
  4. Admin access to the database
Show answer

Answer: Passwordless sign-in via a magic link or one-time code

OTP = one-time password.

Lesson: Email, Password and Magic Links

11. In the PKCE flow, what does the callback route do?

  1. Disables RLS for the user
  2. Stores the provider secret in the browser
  3. Creates a new database table
  4. Exchanges the returned code for a session
Show answer

Answer: Exchanges the returned code for a session

exchangeCodeForSession completes sign-in.

Lesson: OAuth Providers

12. Where does @supabase/ssr keep the session?

  1. Only in localStorage
  2. In cookies, readable by the server
  3. In the database URL
  4. In environment variables
Show answer

Answer: In cookies, readable by the server

Cookies make the session available during server rendering.

Lesson: Server-Side Auth With @supabase/ssr

Storage and Realtime

13. How do you share a file from a private bucket for a short time?

  1. Make the bucket public temporarily
  2. Create a signed URL with an expiry
  3. Send the service_role key to the user
  4. Disable RLS on storage.objects
Show answer

Answer: Create a signed URL with an expiry

Signed URLs grant time-limited access.

Lesson: Storage Buckets and Policies

14. Which feature shares cursor positions between clients without writing to a table?

  1. pg_cron
  2. Postgres Changes
  3. Storage
  4. Broadcast
Show answer

Answer: Broadcast

Broadcast is ephemeral messaging.

Lesson: Realtime Channels

15. Where should a user-uploaded video be kept?

  1. In Storage, with its path saved in a table
  2. As base64 in a text column
  3. In a Realtime channel
  4. In an environment variable
Show answer

Answer: In Storage, with its path saved in a table

Keep blobs out of the database.

Lesson: When to Use Storage and Realtime

Edge Functions and Extensions

16. Why forward the Authorization header to the client inside an edge function?

  1. To bypass RLS
  2. To make the function faster
  3. So queries run as the calling user and RLS applies
  4. Because Deno requires it for imports
Show answer

Answer: So queries run as the calling user and RLS applies

Act as the user unless you need elevated rights.

Lesson: Edge Functions

17. Which extension schedules recurring SQL jobs?

  1. PostgREST
  2. pgvector
  3. pg_cron
  4. pg_trgm
Show answer

Answer: pg_cron

cron.schedule takes a cron expression and SQL.

Lesson: Triggers, Webhooks and Cron

18. Which pgvector operator gives cosine distance?

  1. <=>
  2. <->
  3. <#>
  4. @>
Show answer

Answer: <=>

<-> is Euclidean, <#> is negative inner product.

Lesson: pgvector for Embeddings

Local Development and Workflow

19. What does supabase db reset do locally?

  1. Uploads files to Storage
  2. Deletes the remote production project
  3. Rotates the API keys
  4. Recreates the database from migrations and the seed file
Show answer

Answer: Recreates the database from migrations and the seed file

A clean, reproducible local database.

Lesson: The Supabase CLI and Local Stack

20. Which command applies local migrations to a linked hosted project?

  1. supabase start
  2. supabase db push
  3. supabase db reset
  4. supabase init
Show answer

Answer: supabase db push

push sends pending migrations to the remote database.

Lesson: Migrations, Diff and Push

21. What does passing the generated Database type to createClient give you?

  1. Automatic RLS policies
  2. Typed rows, inserts and RPC arguments
  3. Faster queries at runtime
  4. Encrypted columns
Show answer

Answer: Typed rows, inserts and RPC arguments

Types catch column and table typos at compile time.

Lesson: Generated Types, Seeding and Environments

Supabase in Production

22. What should you do if the service_role key is committed to a public repo?

  1. Make the repository private and do nothing else
  2. Enable RLS and keep using it
  3. Rename the environment variable
  4. Rotate it immediately and remove it from the code
Show answer

Answer: Rotate it immediately and remove it from the code

A leaked privileged key must be considered compromised.

Lesson: Security Beyond RLS

23. Why use Supavisor transaction mode for serverless functions?

  1. Many short-lived clients share a small pool of database connections
  2. It disables RLS for speed
  3. It caches all query results forever
  4. It replaces indexes
Show answer

Answer: Many short-lived clients share a small pool of database connections

Postgres connections are limited and costly.

Lesson: Performance and Connection Pooling

24. Why is Supabase lock-in lower than many proprietary backends?

  1. It has no pricing limits
  2. It stores data as JSON files
  3. Data lives in standard Postgres and the stack is open source
  4. Its API keys work on any provider
Show answer

Answer: Data lives in standard Postgres and the stack is open source

pg_dump and self-hosting are exit options.

Lesson: Backups, Limits, Cost and Lock-In

25. Which item belongs on a Supabase launch checklist?

  1. Production schema is edited only in the dashboard
  2. The service key is embedded in the mobile app
  3. Every exposed table has RLS with tested policies
  4. All buckets are public for simplicity
Show answer

Answer: Every exposed table has RLS with tested policies

RLS and key hygiene come first.

Lesson: A Supabase Launch Checklist

← Back to the course