Prev Next

Database / Supabase basics Interview Questions

Explain the execution flow of a request through Supabase's auto-generated API?

When a client calls supabase.from('posts').select('*'), the request travels through several distinct layers before a row ever comes back.

  1. The client SDK builds an HTTP GET request to /rest/v1/posts, attaching the API key and, if the user is signed in, an Authorization: Bearer <jwt> header.
  2. The request hits Kong, Supabase's API gateway, which routes it to the PostgREST service and can apply rate limiting.
  3. PostgREST verifies the JWT, extracts claims like the user's role and auth.uid(), and opens a Postgres connection as that role rather than as a superuser.
  4. Postgres compiles the query, and because the connection is running as the authenticated (or anon) role, every Row Level Security policy on posts is evaluated as part of the query plan — not as a separate check afterward.
  5. Only rows that pass the policy are returned, serialized to JSON by PostgREST, and sent back through the gateway to the client.

The key architectural point is that authorization isn't a middleware step bolted onto the API; it's inseparable from the SQL execution itself, which is what makes it consistent no matter which client or tool issues the request.

What does Supabase's API gateway (Kong) do in this flow?
At what point are Row Level Security policies evaluated in this flow?

Invest now in Acorns!!! 🚀 Join Acorns and get your $5 bonus!
Acorns Logo

Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!

Earn passively and while sleeping

Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.

Robinhood Logo

Invest now!!! Get Free equity stock (US, UK only)!

Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.

The Robinhood app makes it easy to trade stocks, crypto and more.


Webull Logo

Webull! Receive free stock by signing up using the link: Webull signup.

More Related questions...

What is Supabase? What is the purpose of PostgreSQL within Supabase? What are the core services offered by Supabase? What is Supabase Authentication used for? What are the types of storage available in Supabase Storage? Define Row Level Security in Supabase? Describe the Supabase client library? What is the purpose of Supabase Edge Functions? List the API types Supabase auto-generates from your schema? How do you create a new Supabase project and connect to it? How does Supabase auto-generate REST APIs from a database schema? Why is Row Level Security important in a client-facing Supabase app? How does Supabase Realtime broadcast database changes to clients? What is the difference between the anon key and the service role key in Supabase? When should you use an Edge Function instead of a Postgres database function? How do you troubleshoot a valid query being blocked by Row Level Security? What is the difference between using Supabase Auth and rolling your own JWT-based authentication? How is data validated before insertion in a Supabase table? Why do we use database migrations in Supabase projects? What happens when a Postgres trigger fires on a table linked to Edge Function webhooks? Explain the execution flow of a request through Supabase's auto-generated API? Why doesn't Supabase recommend using the service_role key on the client? How can you optimize Postgres connection pooling for serverless Edge Functions? Explain the internal working of Row Level Security policy evaluation in Postgres? What is the difference between pgvector similarity search and hybrid search in Supabase? Which is better for real-time collaboration, Supabase Realtime or client-side polling, and why? How does Supabase handle connection pooling for high-concurrency workloads? Explain the lifecycle of a Supabase Auth session token? When would you choose self-hosting Supabase over the managed cloud offering? How do you optimize full-text search performance on a large Postgres table in Supabase?
Show more question and Answers...

Supabase Intermediate to Advanced Interview Questions

Comments & Discussions