8 min read
How to make a Supabase app production-ready
Supabase is a great backend for AI-built apps, but its defaults assume you will finish the job. Work through this checklist before you invite real users.
Keys
- Only the anon (or publishable) key appears in front-end code.
- The service role (or secret) key lives only in Edge Functions or your server, read from a secret.
- If a secret key was ever committed or shipped to the browser, rotate it.
Database rules
- Row-level security is on for every table in exposed schemas.
- Policies check auth.uid() and never use
truefor private data. - Functions marked
security definerare reviewed and not callable by anonymous users unless intended. - The Supabase security advisor shows no errors.
alter table public.profiles enable row level security;
create policy "Users read own profile"
on public.profiles for select
using (auth.uid() = id);Authentication
- Email confirmation is on, and password reset links expire.
- Redirect URLs are limited to your own domains.
- Roles are set on the server; users can't edit their own role.
- Protected pages and API routes check the session on the server, not only in the UI.
Storage
- Buckets with user files are private.
- Storage policies limit each user to their own folder.
- Private files are served with short-lived signed URLs.
Reliability
- Backups are on, and you have tried a restore at least once.
- Error monitoring is set up for the front end and Edge Functions.
- You know your plan's limits (database size, bandwidth, function calls) and get alerts before you hit them.
Ask your AI tool to audit it
Prompt for your AI tool
Audit my Supabase project for production: list tables without RLS, policies using true, security definer functions callable by anon, public storage buckets, and any secret keys used in client code. Report everything first, then fix one item at a time with my approval.