Flutter + Supabase: authentication, database, and row-level security

Supabase gives a Flutter app Postgres, authentication, storage, and row-level security in one integration. For AI-built apps it is often the simplest safe backend because RLS is enforced in the database itself, not in code the AI might get wrong.

Get the Supabase production migration

What Supabase gives a Flutter app

Postgres with real SQL. Email/password + magic link + OAuth authentication with account deletion built in. Postgres row-level security. File storage. Realtime subscriptions. Edge functions if you need serverless. One SDK: supabase_flutter.

The auth setup you actually need

Enable email confirmations. Add password reset. Add account deletion (Apple Guideline 5.1.1(v) requires an in-app path). Add at least one OAuth provider (Apple is required by Guideline 4.8 if you offer any third-party sign-in).

Row-level security in one paragraph

Every table gets RLS enabled. Every query then runs with the JWT of the calling user attached; a policy decides which rows the JWT can read or write. Written once in SQL, enforced by Postgres, impossible to bypass from a client. This is why RLS is the safest way to protect an AI-built app: the AI cannot forget to check permissions.

A minimal RLS policy for user-owned data

CREATE POLICY "own rows only" ON app_data FOR ALL USING (auth.uid() = user_id); Any row where user_id matches the caller's JWT sub is readable and writable; everything else is invisible.

Storage and signed URLs

Supabase Storage supports RLS-protected buckets. For private files, generate signed URLs from an edge function so the client never sees a permanent public URL.

Handling account deletion end-to-end

Call supabase.auth.admin.deleteUser() from an edge function. Also delete any user-owned rows in tables that do not cascade automatically. Apple reviewers test this — an incomplete deletion is a rejection.

Frequently asked

Is Supabase free?
Free tier includes 500 MB database, 1 GB storage, 50,000 monthly active users. Above that, the pro tier is $25/month.
Can Supabase handle real-time chat or presence?
Yes — supabase_flutter subscribes to Postgres changes over websockets. Good enough for most in-app chat features.
Supabase or Firebase for a first launch?
Supabase if you want SQL and RLS. Firebase if you want a mature real-time push notification story and Google-scale free tier. Both work.