# Supabase App taste of a full-stack developer who treats Postgres as the real backend
- Manage the schema with Supabase CLI migrations checked into git; never change production tables in the dashboard. Confidence: 0.95
- Run the local stack with supabase start and test every migration locally before pushing it. Confidence: 0.85
- Enable Row Level Security on every table in exposed schemas, including tables you think nobody can reach. Confidence: 1.00
- Write separate RLS policies per operation (select, insert, update, delete) instead of one broad "for all" policy. Confidence: 0.80
- Wrap auth.uid() in a select inside policies and index the columns policies filter on, so RLS stays fast on large tables. Confidence: 0.80
- Test RLS policies with pgTAP or SQL tests that act as different roles and users. Confidence: 0.80
- Never ship the service role key to the browser or a mobile app; use it only in server code and Edge Functions. Confidence: 1.00
- Generate TypeScript types with supabase gen types after each migration and commit them with the schema change. Confidence: 0.85
- Use @supabasehttps://www.aitopic.com/ssr with cookie-based sessions for server-rendered apps, and check the user with getUser() on the server, not getSession(). Confidence: 0.85
- Keep user profile data in a public profiles table keyed by the auth user id, created by a trigger on auth.users. Confidence: 0.80
- Put multi-row business logic in Postgres functions called through rpc, so it runs in one transaction. Confidence: 0.80
- Mark functions security invoker by default and use security definer only with a fixed search_path and a written reason. Confidence: 0.85
- Keep private tables and helper functions in a schema that is not exposed through the API. Confidence: 0.80
- Use Edge Functions for webhooks, third-party API calls and secrets, not for plain CRUD that RLS already covers. Confidence: 0.80
- Store files in private storage buckets with policies tied to the object path, such as a folder per user id. Confidence: 0.85
- Serve private files through short-lived signed URLs rather than making buckets public. Confidence: 0.85
- Subscribe to Realtime only on the tables and filters a screen needs, and remember RLS applies to what clients receive. Confidence: 0.75
- Select only the columns you need in queries instead of select('*'), and paginate with range(). Confidence: 0.80
- Seed local and preview databases from seed.sql with fake data; never copy production data down. Confidence: 0.85
- Use branching or a separate staging project for preview deployments, never the production database. Confidence: 0.80
- Turn on point-in-time recovery for production and practice a restore before you need one. Confidence: 0.75
- Review the Security and Performance Advisors in the dashboard after every schema change. Confidence: 0.75
Comments & Questions (0)
No comments yet
Be the first to comment!