RealComposer

Supabase Safe & Unsafe Practices

Direct Answer

The Supabase anon (publishable) key is safe in clients only when Row Level Security is enabled on every exposed table. The service_role (secret) key bypasses RLS entirely and must stay on a server or edge proxy, never in a mobile app, FlutterFlow project, or browser bundle.

Credentials & Where They Belong

Client safe
anon / publishable key

Safe only when RLS policies restrict what each user can read and write.

Server only
service_role / secret key

Bypasses all RLS policies with full database access.

Server only
JWT secret

Signs user tokens. Leaking it lets attackers mint any identity.

Safe Practices

  • Enable RLS on every table in exposed schemas

    Write policies using auth.uid() so each user can only touch their own rows, and test them with the anon key.

  • Keep service_role calls behind a server boundary

    Admin reads, cross-user joins, and webhook writes belong in an edge function or proxy holding the secret key.

  • Authorize from app_metadata, not user_metadata

    Users can edit their own user_metadata. Store roles in app_metadata or a protected table.

Unsafe Practices

  • Shipping the service_role key in an app

    Anyone who extracts it gets unrestricted read and write access to your whole database.

  • Leaving RLS disabled on public tables

    With RLS off, the anon key can read and modify every row through the REST API.

  • Writing policies that check client-supplied IDs

    Policies like user_id = request parameter are spoofable. Compare against auth.uid().

The RealComposer Pattern

Keep SUPABASE_SERVICE_ROLE_KEY in the vault and expose narrow, read-only pipelines (profiles, plan status) that return slimmed JSON. Clients keep using the anon key with RLS for user-scoped data, and never see the secret key.

START BUILDING FREE

Frequently Asked Questions

Q:Is it safe to expose the Supabase anon key?

Yes, if every exposed table has RLS enabled with correct policies. Without RLS, the anon key grants open access to those tables.

Q:Where should I use the Supabase service role key?

Only in trusted server or edge code, such as admin jobs, webhooks, and aggregation pipelines that must read across users.

Multi-API Aggregation

Combine Supabase Auth User with Custom Billing API

To solve combine supabase auth user with custom billing api, never execute unauthenticated requests or embed private tokens directly in client bundles. RealComposer acts as a sub-10ms edge gateway running on Cloudflare Workers that securely injects credentials from your Secret Vault, normalizes responses, and prevents unauthorized API usage. Route calls through your RealComposer edge URL to guarantee complete privacy, robust origin validation, and low mobile latency.

Sub-10ms edgeView Recipe
Multi-API Aggregation

Combine Openai Embeddings and Supabase Vector Search in One Call

To solve combine openai embeddings and supabase vector search in one call, never execute unauthenticated requests or embed private tokens directly in client bundles. RealComposer acts as a sub-10ms edge gateway running on Cloudflare Workers that securely injects credentials from your Secret Vault, normalizes responses, and prevents unauthorized API usage. Route calls through your RealComposer edge URL to guarantee complete privacy, robust origin validation, and low mobile latency.

Sub-10ms edgeView Recipe
Multi-API Aggregation

Combine Algolia Search Results with Supabase User Favorites

To solve combine algolia search results with supabase user favorites, never execute unauthenticated requests or embed private tokens directly in client bundles. RealComposer acts as a sub-10ms edge gateway running on Cloudflare Workers that securely injects credentials from your Secret Vault, normalizes responses, and prevents unauthorized API usage. Route calls through your RealComposer edge URL to guarantee complete privacy, robust origin validation, and low mobile latency.

Sub-10ms edgeView Recipe

Related Concepts