Also known as: server-only data access, backend-only architecture
Definition
Backend-only data access is an architectural pattern where the database is never queried directly from the browser. All queries run through Server Actions or Route Handlers using the service_role key, after server-side authentication and Zod validation. The browser only receives data the server explicitly returns.
A structural commitment: no Supabase client is instantiated in a Client Component, no anon key is used for query construction, and the service_role key never enters the browser bundle. Every database operation is wrapped in a Server Action that validates input, authenticates the user, authorizes the operation, and only then queries.
RLS is a strong second line, but it relies on perfect policies across every table. A single missing policy on a new table is a wide-open leak. Backend-only access removes that whole risk class: there is no client-side query path, so missing policies on internal tables cannot be exploited.
The quickstart shows client-side queries with RLS as the only defense. That pattern works for prototypes but fails at scale: every new table is a security-relevant migration, and a single mistake exposes data. Backend-only access uses RLS as a deny-all safety net AND a Server Action layer that does the explicit authorization work in code that you can read.