</>RescueMyRepoFree scan

// guide · Supabase · Stripe · updated Nov 5, 2026

Hiding Pro features in the UI isn't a paywall: enforce paid plans in Supabase RLS

Short answer

If your app hides Pro content with an if (plan === "pro") in React but the Supabase query still returns it, free users can read it in DevTools or query it themselves from the console. The plan check has to happen where the data is served: an RLS policy on the table or a server route. And the plan itself has to live somewhere users can't edit, updated by your Stripe webhook.

Why a UI paywall leaks

Apps generated by Lovable, Bolt and similar tools usually talk to Supabase directly from the browser using the public anon key plus the signed-in user's session. That's fine when Row Level Security decides which rows each user gets. But when the AI tool builds a paywall, it often does it the quick way: fetch everything, then hide the Pro parts in the component.

// Looks like a paywall, isn't one
const { data: reports } = await supabase.from("reports").select("*"); // returns Pro rows too
return reports
  .filter((r) => !r.is_pro || profile.plan === "pro") // hidden in the UI only
  .map((r) => <ReportCard key={r.id} report={r} />);

Everything that query returns is already in the browser. The Network tab shows the full response, and anyone can call the same table with their own filters. The same pattern shows up with Pro-only columns, export buttons that call an unprotected RPC, premium files in a public storage bucket, and credit counters that the browser decrements itself.

Test it in two minutes

// Signed in as a FREE test user, in the browser console:
const { data } = await supabase.from("reports").select("*").eq("is_pro", true);
console.log(data); // anything other than [] means free users can read Pro rows

If you get Pro rows back, the paywall is cosmetic.

The fix: plan in a table users can't write, check in RLS

Keep each user's plan in a table that your Stripe webhook updates on the server with the service_role key. Users can read their own row but have no insert or update policy. Then let RLS return Pro rows only to active Pro users (Supabase RLS docs):

-- 1. Plan lives in a table users can read but never write
create table public.subscriptions (
  user_id uuid primary key references auth.users on delete cascade,
  plan text not null default 'free',
  current_period_end timestamptz
);
alter table public.subscriptions enable row level security;
create policy "read own subscription" on public.subscriptions
  for select to authenticated using ((select auth.uid()) = user_id);
-- no insert/update/delete policies: only your Stripe webhook (service_role, server-side) changes plans

-- 2. Pro rows are only returned to active Pro users
alter table public.reports enable row level security;
create policy "free rows for everyone signed in" on public.reports
  for select to authenticated using (not is_pro);
create policy "pro rows for pro users" on public.reports
  for select to authenticated using (
    is_pro and exists (
      select 1 from public.subscriptions s
      where s.user_id = (select auth.uid())
        and s.plan = 'pro'
        and (s.current_period_end is null or s.current_period_end > now())
    )
  );

If the Pro feature is an action rather than rows (an AI generation, an export, a PDF), do the plan and credit check in the server route or edge function that performs it, and decrement credits there in the same request. Verify your Stripe webhook signature before trusting any plan change (Stripe webhook docs).

Don't store the plan in user_metadata: any signed-in user can change it with supabase.auth.updateUser(). See our user_metadata guide and Supabase's Managing user data.

Tell your AI coding tool

Paste this into Lovable, Bolt, Cursor or Claude Code:

Audit this project for paywalls and plan limits that are enforced only in the browser.
1. Find every place the UI hides, disables or filters features, rows or fields based on plan, tier, subscription, is_pro, credits or trial status.
2. For each one, check whether the underlying Supabase query, RPC, storage download or API route still returns the data or does the work for a free user. If it does, move the check into an RLS policy on that table or into the server route before the data is returned.
3. Store the plan in a table (or app_metadata) that only the server updates from the Stripe webhook with the service_role key. Users may read their own row; no client insert/update policies. Never read the plan from user_metadata.
4. Enforce credits and usage limits in the database or server in the same request that does the work.
5. Add a test: a free user querying Pro rows directly with supabase-js gets an empty result or an error.

Check the rest of your repo

RescueMyRepo's free scan flags the problems that usually sit next to a cosmetic paywall: tables without RLS, permissive policies, plans or roles read from user_metadata, Stripe webhooks that skip signature checks, public storage buckets and leaked keys. Each finding comes with a fix prompt for your AI tool.

Scan my repo freePublic GitHub repos · no signup · about a minute

FAQ

Can free users really see Pro data if the page hides it?

Yes, if the data reaches the browser. Supabase apps built with Lovable, Bolt or Cursor usually query tables straight from the browser with the public anon key and the user's session. Whatever rows that query returns are visible in the DevTools Network tab, and the user can run the same query from the console with different filters, even if your React code never renders it.

Where should the plan check live?

Where the data is served: in a Row Level Security policy on the table, or in a server route or edge function that checks the plan before returning anything. Browser code can hide or show buttons for convenience, but it can't be the thing that says no.

Where should I store the user's plan?

Somewhere the user can't write: a subscriptions or profiles table with RLS that allows users to read only their own row and has no client update policy, updated by your Stripe webhook using the service_role key on the server. app_metadata set from the server also works. Never use user_metadata, because any signed-in user can change it with supabase.auth.updateUser().

Does this also apply to usage limits and credits?

Yes. If the browser decides how many credits are left, or decrements them itself, users can skip the check. Count and enforce limits in the database or on the server, in the same request that does the work.

How do I check without reading all the code?

Sign in as a free test account, open DevTools, go to the Network tab, filter for rest/v1, and open the Pro page or feature. If any response contains Pro-only rows or fields, the paywall is only in the UI.

Sources