Next.js + Supabase
Cursor rule: Supabase data access & RLS
Puntuación: AAn auto-attached .mdc rule that enforces the Supabase client split, RLS-first policy work, and typed queries — with a copyable policy snippet.
--- description: Supabase data-access and RLS conventions for app code globs: app/**/*.ts,app/**/*.tsx,lib/**/*.ts alwaysApply: false --- # Supabase access rules - Server Components and route handlers import from `@/lib/supabase/server`; browser code imports from `@/lib/supabase/client`. Never cross the two. - The service-role client (`@/lib/supabase/admin`) is reserved for webhook handlers. If a query fails under RLS, fix the policy - don't switch clients. - Type every query result from `Database` in `@/lib/database.types`. - New tables enable RLS in the same migration that creates them: ```sql alter table public.notes enable row level security; create policy "notes_owner_all" on public.notes for all using (auth.uid() = user_id) with check (auth.uid() = user_id); ``` - Follow @lib/queries/projects.ts for the query-helper pattern: typed arguments, narrow `select` lists, `throwOnError`. - Migrations are append-only: one new numbered file per change.
Estos ejemplos se publican bajo CC0: úsalos libremente, sin atribución. Se proveen tal cual, sin garantía de ningún tipo: revísalos y adáptalos a tu proyecto antes de usarlos, ya que eres responsable del resultado de aplicarlos.
Lleva PromptArch a tu equipo
Implementa PromptArch como herramienta interna en cada área de tu empresa. Obtén cuentas de equipo con créditos precargados compartidos y dominios personalizados para tu organización.
Contáctanos