InterviewBuddy
All interview questions

How should you protect private data in a Next.js app?

Advanced

Answer

Authenticate the request, authorize access to the specific record on the server or database, and ensure private responses are not placed in a shared cache. UI gating alone is insufficient.

Explanation

With Supabase, row-level security remains the final data boundary. Do not expose secret keys to client components.

Example

Owner check: row.user_id = auth.uid()