Skip to content

Connect a Supabase Backend

Authorize Supabase and configure your Studio project to use Postgres, Auth, Storage, or Edge Functions.

Connect Supabase when you want to use managed Postgres, Auth, Storage, or Edge Functions in a Cloud Studio app. The connector authorizes BhaiCode to access the selected Supabase organization. That authorization doesn’t create a database or configure your application’s client credentials for you.

Connect your organization and project

Authorize Supabase

Open Connectors in the BhaiCode dashboard and select Connect on the Supabase card. Complete the OAuth flow in Supabase and select the organization that owns the backend.

Choose a Supabase project

Create or open the project in Supabase. Check that it belongs to the organization you just authorized. Record which project your development and production environments should use before you configure either one.

Set the app's environment variables

Use the values from the Supabase project you chose. Set only the variables your code reads. For example, a client that uses the Supabase API needs the project URL and a client key, but it doesn’t need a raw Postgres connection string.

VariableUse
SUPABASE_URLThe Supabase project URL used by the client.
SUPABASE_ANON_KEYThe legacy client key name used by existing app configuration.
DATABASE_URLA Postgres connection string for code that connects directly from the server.

Configure and check your client

If you ask Bhai to scaffold the integration, review the generated changes for the @supabase/supabase-js dependency, shared client initialization, and typed database definitions. Check that the environment variable names match what the client reads before you try a query or an Auth flow.

Supabase uses row level security (RLS) policies to control which rows a client can access. Test the path your users take with the intended client role. A successful query over a privileged database connection doesn’t tell you what the browser client can read.

Check the backend before you deploy

For Auth, try signing in and confirm the signed-in user can read only the data your policies allow. For Storage, test the upload or download that the app needs with the same client credentials users will use. If either check points to the wrong project, correct the project URL and matching key together before testing again.

Never put DATABASE_URL, a service-role key, or a secret key in browser code. Client-facing keys don’t replace RLS policies.

Next

Was this page helpful?