Skip to content

Supabase

Manage your Draftbit-managed Supabase backend, connect your apps with the right Supabase URL and publishable key for each environment, and set up Google, Apple, and other OAuth sign-in providers, redirect URLs, custom SMTP, email templates, storage, secrets, and edge functions

Draftbit can run a managed Supabase backend for your project: a PostgreSQL database, authentication, file storage, and edge functions that every app in the project can use.

The AI agent builds most of the backend for you, such as tables, row level security policies, and edge functions. The Supabase panel in Draftbit is where you check that work and change the settings yourself, including sign-in providers, redirect URLs, custom SMTP, email templates, secrets, and storage buckets. You don’t need a Supabase account, and you don’t need to contact support to change these settings.

Supabase runs as an app in your project. To add it to a project that doesn’t have a backend yet, open the project, click Add app, choose Backend, then Supabase. When you create a new project, answer Create a new backend and choose Supabase. Each project can have one Supabase Backend app, and the other apps in the project share it.

An API Backend can also use Supabase as its own database. See Supabase in an API Backend.

You can also connect a Supabase project you already own through the Supabase MCP. That project stays in your own Supabase account, so you manage it in Supabase’s dashboard rather than in this panel.

Use any of these:

  • In the builder, open the app switcher menu at the top of the screen and select Supabase.
  • On your project’s page, select Manage Supabase on the Supabase Backend app’s card.
  • In any app in the project, open Integrations in the main menu and select the Supabase tab. In other apps, the tab is under Project and appears once the project has a Supabase instance.
  • When the agent needs you to change something it can’t, such as a secret value only you have or a Staging or Production setting, it shows a card in the chat. Its button opens the panel at the right section and environment.

You need the Editor role or higher to manage Supabase. Viewers see the connection status only.

Each environment has its own Supabase project with separate data, users, settings, and secrets. Use the environment menu at the top of the panel to choose which one you’re looking at and changing. Everything you change in the panel applies only to the environment you have selected.

A Supabase Backend app has these environments:

  • Development is where the agent works while you build.
  • Staging and Production are set up when you select Set up on their card at the top of the panel, or the first time you publish the Supabase Backend app to them. Until then, they show as “Not set up”. They start on Nano; see Sizes, pausing, and restoring.

Staging and Production need a paid Draftbit plan (Standard or higher), because they use credits while they run. On the Free plan you can keep building in Development, but you can’t publish to Staging or Production, or create or reset their projects. A Staging or Production project that existed before paid backends launched is the exception until December 1, 2026: you can keep publishing to it on any plan until then. To keep a Production project without a paid plan, transfer it to your own Supabase organization from the Manage section.

When you’re ready to release, open the panel and select Publish, or publish the Supabase Backend app from its Publishing page. Publishing deploys the database migrations and edge functions saved in the app’s files. It doesn’t copy changes you made by hand in the panel, such as auth settings, secrets, or rows you edited, so make those changes in each environment that needs them.

The top of the Supabase panel has a tab for each environment with its status (Running, Restarting, Idle, Not set up, or Paused) and its size. The tab you pick is the environment that Overview and every tool in the sidebar work on. Development is always free on Nano. It runs while one of the project’s apps is running. An app stops a while after nobody is using it, and Development pauses 15 minutes after the last one stops. Until it pauses, its tab says Idle. Once it’s paused, its tab says Paused, and Start Development opens an app, which starts it again in a couple of minutes. If Draftbit can’t check whether it has paused, its tab says Unknown until the next check.

Overview shows the environment’s size, what it costs, its status, and its URL. For Staging and Production it has these actions:

  • Set up starts an environment that has no project on Nano, right on the page. It estimates a month from how many hours you expect it to be active, and says when an always-on size would cost less. An environment that’s waiting for its first publish is set up when you publish to it.
  • Upgrade (on Nano) or Change size opens a page with every always-on size, from Micro up to 16XL: its CPU, memory, largest database, and price per hour and per month. Pick one to see what’s charged now and per hour from then on. The switch takes the backend offline for a minute or two, and its tab says Restarting until it’s back. Once an environment is always on, it can’t move back to Nano. You can’t choose a size smaller than your database.
  • Pause stops the environment, so your apps can’t reach its database until you restore it. Paused hours aren’t charged.
  • Restore brings a paused environment back in about 3 minutes. Its tab says Restarting until then. The dialog shows what’s charged now. If your credits can’t cover it, it says how many you need, with ways to add them.
  • Move to your own Supabase account, Reset to a new project, and Delete at the bottom of Overview work like their counterparts in the Manage section.

A Supabase Backend app’s Publishing page also shows each environment’s database, with Change size and Manage database buttons that open these pages.

Staging and Production are charged in credits from your organization’s balance from the moment they’re set up: Nano for the compute it actively uses, prorated by the hour, and always-on sizes for every hour they run, paid an hour ahead. A project that existed before paid backends launched is free until December 1, 2026, and its tab says so. Changing its size ends that, and it’s charged from then on. If your balance can’t cover the next hour, the environment is paused (Staging before Production), a notice appears at the top of the panel, and the organization’s owner gets an email. It stays paused until someone restores it, so turning on auto top-up in Billing > Credits keeps that from happening. See Plans and pricing for prices.

Projects that added Supabase before Supabase Backend apps existed have a project-level instance instead. Its Production has the same actions and is charged the same way. See Projects with a project-level Supabase instance.

To deploy the app’s supabase/ files to Development, select Sync Development in the top bar. Use it after you edit those files yourself or merge changes from GitHub. The agent runs the same sync once it finishes changing them.

A sync publishes your unsaved changes to Development the same way publishing deploys Staging and Production: it applies the migrations in supabase/migrations, deploys the Edge Functions in supabase/functions, and applies the settings in supabase/config.toml. Draftbit keeps your apps’ site URL and redirect URLs in place. A sync takes a few minutes, and you can follow it on the app’s Publishing page.

Open the Supabase Backend app’s Publishing page and select the Environments tab to see where each environment stands. Each card shows the environment’s Supabase URL, which you can copy, and a status:

  • Development is always marked “Isolated development target”. The agent works here, and it isn’t replaced when you publish.
  • Staging and Production show “Target ready; publish to apply repository migrations and functions.” once their Supabase project exists but nothing has been published to it. After a publish, the card shows the version you deployed, such as “Deployed v1.0.0”.

Publish to Staging or Production the same way you publish any other app. Each publish applies the migrations and edge functions in the app’s files to that environment only, so publishing to Staging doesn’t change Production.

When a publish sets up Staging or Production for the first time, the publish dialog shows Nano’s price for each active hour, and what a month costs at 4 active hours a day and when it’s active all month. Without unsaved changes, the button reads Set up & publish.

A publish uses the app’s saved files, plus your unsaved changes when you choose to save and include them. It deploys them to the environment you picked, in this order:

  1. It applies the settings in supabase/config.toml.
  2. It runs every migration in supabase/migrations that the environment hasn’t run yet, oldest first. That includes migrations dated before the environment’s newest one, such as a file merged from another branch. Migration files are named <timestamp>_<name>.sql, and other files in the folder are ignored.
  3. It deploys every Edge Function: each folder in supabase/functions with an index.ts, plus each function that supabase/config.toml declares under [functions.<name>], such as one with a custom entrypoint. A function with enabled = false there isn’t deployed. A function you delete from the files stays deployed in the environment.

The publish dialog lists the migrations that will run and the Edge Functions that will deploy for the environment you picked, so check it before you publish. If Draftbit can’t read which migrations the environment already has, the list shows every migration file, and the publish still skips the ones that already ran.

A migration that ran in the environment but is missing from your files doesn’t stop a publish, and it doesn’t run again.

Keeping a migration or function out of a publish

Section titled “Keeping a migration or function out of a publish”

Your files alone decide what a publish deploys. To hold something back:

  1. Move the migration file out of supabase/migrations, or the function’s folder out of supabase/functions, for example into a supabase/held-back folder. To hold back a function, you can instead set enabled = false in its [functions.<name>] section of supabase/config.toml, which you have to do if that file declares it.
  2. Save your changes.
  3. Open the publish dialog, check its list, and publish.

When you’re ready to release it, move it back (or remove enabled = false), save, and publish again. A migration you move back still runs, even if newer migrations were published in the meantime.

Removing a migration’s file doesn’t undo it in an environment that already ran it. To reverse a change there, ask the agent to write a new migration that undoes it.

Each migration runs in one transaction, together with the record that it ran. When a migration fails, its changes are rolled back, it isn’t recorded, and the publish stops there. Migrations that ran earlier in the same publish stay applied, the config.toml settings are already applied, and no Edge Functions are deployed. Draftbit doesn’t undo the earlier migrations for you.

The publish’s logs on the Publishing page show which migration failed. Fix it, save, and publish again. Because the failed migration was never recorded, the next publish starts with it.

A few statements can’t run inside a transaction, such as CREATE INDEX CONCURRENTLY. They run on their own, so a migration that contains one can be left partly applied when it fails. Put those statements in a migration of their own.

To bring the data back to an earlier state, restore a backup from Database → Backups in the Supabase panel, if your project’s Supabase plan includes them.

Your mobile apps, web apps, and websites reach Supabase with two values: the project URL and a publishable key. Each environment has its own URL and keys, so your app needs a different pair for Development, Staging, and Production.

Draftbit doesn’t add these values to your apps. You or the agent add them as environment variables in each app’s Settings. The names are whatever your app’s code reads. Mobile apps commonly use EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_PUBLISHABLE_KEY. Web apps use the VITE_ prefix and websites use PUBLIC_, for example VITE_SUPABASE_URL.

  • Project URL. The top of the Supabase panel lists each environment with its URL, such as https://<project-ref>.supabase.co, and a copy button. For a Supabase Backend app, the Environments tab on its Publishing page shows the same URLs.
  • Publishable key. Choose the environment at the top of the Supabase panel, open API Keys, and copy a key whose type is Publishable. The keys you see belong to the environment you selected.

Never put a secret key in one of these apps. Secret keys bypass row level security, and plain text variables are built into your app where anyone can read them.

  1. Publish your Supabase Backend app to the environment first. Staging and Production don’t have a URL or keys until their first publish.
  2. In the Supabase panel, select that environment and copy its URL and publishable key.
  3. In your app, open Settings, go to Environment Variables, and select Add Variable.
  4. Enter the URL variable’s name, paste the URL as the value, choose Plain text, and under Environment select only the environment the URL belongs to. Save, then do the same for the publishable key.
  5. Repeat for each environment. You can add a variable with the same name more than once, as long as each copy covers different environments.
  6. Publish your app to that environment again. Your app reads these values when it’s built, so a build made before you added them won’t have them.

You can also give the agent the values and ask it to add the variables for you. Tell it which environment each value is for.

If a variable your code reads still has no value in an environment, the missing-variables notice in Settings lists it with the environments it’s missing from.

The Database section has five tabs.

  • Tables lists the tables in your database. Open a table to browse its rows, add a row, edit a row, or delete rows. Select Query your database to run SQL and optionally chart the results.
  • Backups lists available backups and point-in-time recovery, where your project’s Supabase plan includes them. Restoring a backup overwrites the database.
  • Connection shows connection strings, connection pooling settings, and SSL enforcement for connecting from other tools. It also has network restrictions, which limit database connections to the IP ranges you allow, when your project’s plan supports them.
  • Access shows row level security policies, tables that don’t have row level security, and database roles. This tab is read-only. To change policies, run SQL from the Tables tab or ask the agent to write a migration.
  • Migrations lists the migrations applied to the database, with the SQL each one ran.

The Storage section has two tabs.

  • Buckets lets you create buckets, set whether a bucket is public, limit file size, and restrict the allowed file types. Inside a bucket you can upload files, create folders, download, move or rename files, copy a public URL, or generate a signed URL that expires. You can also empty or delete a bucket.
  • Policies shows the row level security policies that control access to files. This tab is read-only. To change them, run SQL from the Database section or ask the agent.

The Authentication section holds your app’s sign-in settings.

General Settings controls whether new users can sign up. When sign-ups are off, existing users can still sign in. This is also where you allow anonymous sign-ins and let your app link a second sign-in method to an existing account.

Turn on Google, Apple, or another OAuth sign-in provider

Section titled “Turn on Google, Apple, or another OAuth sign-in provider”

Under Sign in methods, select a provider, turn it on, and enter the credentials from that provider. For example, Google sign-in needs a client ID and client secret from Google Cloud, and Apple sign-in needs a client ID and a secret key generated from your Apple private key.

Available sign-in methods:

  • Email and password, including whether users must confirm their email address
  • Phone number, including whether users must confirm their number with a code sent by SMS
  • Web3 wallet (Solana or Ethereum)
  • Google, Apple, GitHub, Azure, Bitbucket, Discord, Facebook, Figma, GitLab, Kakao, Keycloak, LinkedIn, Notion, Slack, Spotify, Twitch, X, WorkOS, and Zoom

Use the search box to find a provider quickly.

Under URL Configuration, set the site URL and the Redirect URLs that sign-in links, password resets, and OAuth providers are allowed to send users back to. Add one URL per entry. Wildcards such as https://example.com/** match any path.

Draftbit adds the published web addresses of your project’s apps, including custom domains, and keeps them up to date. Those entries are marked as managed by Draftbit. URLs you add yourself are kept.

Send auth emails from your own domain (custom SMTP)

Section titled “Send auth emails from your own domain (custom SMTP)”

By default, Supabase sends confirmation, magic link, and password reset emails from its own address. To send them from your own domain, open Custom SMTP under Emails and enter your email provider’s SMTP host, port, user name, password, and sender details.

Custom SMTP settings are always saved to Production as well as the environment you have selected, so your live app sends from your domain. For a step-by-step setup, including email rate limits, see Setting up custom SMTP for auth emails.

Open Email Templates under Emails to edit the subject and HTML body of each authentication email and security notification, with a live preview. The editor lists the template variables you can use. Some Supabase projects require custom SMTP before templates can be edited.

Email Notifications chooses which security notifications users receive, such as when their password, email address, or phone number changes, or when a sign-in method or MFA factor is added or removed.

Under Sessions & Security:

  • Sessions & Tokens sets how long access tokens last, how refresh tokens work, and session limits.
  • Multi-Factor Authentication chooses which second factors users can enroll and verify with. Turning off verification for a factor that users have already enrolled can lock them out.
  • Bot & Abuse Protection requires a CAPTCHA on sign-up, sign-in, and password reset. Your app must send the CAPTCHA token with each auth request.
  • Rate Limits sets how often users can request emails, text messages, and tokens. A value of 0 blocks that action.

Under Auth Hooks, you can point Supabase at your own endpoint or database function to customize auth:

  • Custom Access Token adds your own claims to access tokens.
  • Send Email and Send SMS send auth messages through your own service.
  • MFA Verification Attempt and Password Verification Attempt decide whether a sign-in attempt is allowed.
  • Before User Created validates or blocks a sign-up, and After User Created runs after a new account is created.

Hooks are set per environment.

The Users section shows a chart of new sign-ups over a time range you choose and a list of recent users.

To create an account yourself, such as a login for your staff, click Add user and enter an email address and password. The user is added to the environment you have selected and can sign in with email and password right away. No email is sent, so share the password with them yourself. The password must meet the rules set under Authentication, and email sign-in must be turned on there for them to sign in.

The API Keys section lists the project’s keys. Publishable keys are safe to ship in your app because row level security still applies. Secret keys bypass row level security, so use them only on a server. You can create publishable or secret keys with a name and description, reveal or copy a key, and delete keys.

Older projects also list the Legacy anon and service_role keys. You can’t delete these, but you can disable them once nothing uses them anymore. Supabase turns both on or off together. Legacy keys that are turned off are grayed out and marked (Disabled), and you can re-enable them from the same section.

The Secrets section stores values your edge functions need, such as third-party API keys. Add a secret with a name and value, or delete existing secrets.

Secrets belong to the environment you have selected. Environments don’t share secrets, and deploying or publishing doesn’t copy them, so add each secret to every environment that needs it.

The Edge Functions section lists deployed functions. Open a function to see its invoke URL, version, whether it verifies JWTs, and request statistics such as error rates. You can create a function, edit its files, and rename it in the panel. Functions that use features the editor doesn’t support show a notice; ask the agent to change those.

The Logs section shows logs by type, including API, database, authentication, storage, realtime, edge function, and cron job logs. Choose a log type and time range.

The Production section shows recent API logs. Choose a time range.

The Suggestions section lists security and performance recommendations from Supabase, such as tables without row level security.

The Usage section shows how much of the selected environment’s resources your project uses. Each environment runs on its own instance, so Development, Staging, and Production each show their own figures.

  • Compute: the instance size, current CPU and memory use, swap, memory commitment (memory that running processes have reserved, measured against what the instance can back with memory and swap), database connections and pooler clients against their limits, and load averages. CPU and memory update about once a minute, and CPU shows “Measuring…” for up to a minute and a half after you open the section.
  • Disk: how much of the database disk is used, with its type and IOPS.
  • Database and storage: the size of your database, the total size of files in Storage, and the largest file a single upload can be.
  • API requests: request counts for the database (REST), authentication, Storage, and Realtime over the last hour, 24 hours, or 7 days.

A bar turns amber at 75% of its limit and red at 90%.

Projects with a project-level Supabase instance

Section titled “Projects with a project-level Supabase instance”

Projects that added Supabase before Supabase Backend apps existed have one Supabase instance for the whole project, with a Development environment where the agent works and Production.

Your apps use the production URL and keys for builds that should see live data. Use the development URL and keys only for Development. These projects don’t have a separate Staging environment in Supabase, so choose whether your app’s Staging builds use development or production.

Deploy to production applies the database changes and edge functions you and the agent worked on in development to production, so they become available to every app in the project. From December 1, 2026, deploying to production needs a paid plan, and it does right away once you reset production to a new project. Draftbit runs Supabase security checks first and lists anything it finds before deploying, and you can review the source and destination in the confirmation dialog.

A deploy also copies your auth settings from development to production, except custom SMTP and auth hooks. It doesn’t copy secrets or table data, so check those in production before you launch. For a full launch checklist, see Connecting your app to Production with managed Supabase.

Your development environment is kept after a deploy. Draftbit updates it from production so it stays in step, and you keep working in it with the data you already have in it.

You can move a project-level instance into a Supabase Backend app that manages the same Supabase projects. Your data, keys, and URLs stay the same, so your apps keep working. Select Migrate on the banner at the top of the project’s Supabase page, or on the Supabase card on the project page.

Draftbit generates the app’s files from your Supabase projects:

  • supabase/config.toml holds your auth, API, database, and storage settings from production.
  • supabase/migrations holds production’s migration history.
  • supabase/functions holds production’s edge functions, and config.toml keeps whether each one verifies JWTs.

Production is the source of truth, so deploy your development changes to production first. Your next Sync Development gives development the same settings, functions, and migrations. The move takes a few minutes, and your Supabase projects keep running while it happens. If Draftbit can’t generate files that match your projects, nothing changes and the banner says why.

Publishing stays off until you review the files. A publish pushes config.toml, applies migrations, and redeploys every edge function, so a setting the files leave out can override what’s live. Auth providers, SMTP, and other secrets stay in Supabase and aren’t in the files. In the new app, select Review before publishing in the top bar:

  • Evaluate with agent starts a thread where the agent compares the files with your development project and reports what a publish would change. It doesn’t change your projects.
  • Approve publishing turns on publishing and Sync Development.

After the move, Supabase works as it does for any Supabase Backend app: you publish the app instead of deploying, and it gets a Staging environment the first time you publish to Staging. See Choosing an environment.

If your project has both a project-level instance and a Supabase Backend app, the banner asks you to contact support to explore migration options.

Edge Functions that serve static files can’t be moved this way yet. If production has one, the banner names it and asks you to contact support.

When you add an API Backend and choose Supabase as its database, or select Provision Supabase on its Database tab later, the API Backend gets its own Supabase database. Only that API Backend uses it. Your other apps reach the data through the API, using the API URL and key variables described in Connecting your apps, not a Supabase URL and key.

Open the API Backend, go to Integrations, and select the Database tab to see it:

  • While the database is being set up, the tab shows a Supabase Postgres card with a row for each environment. Staging and Production read “Created on first publish to Staging.” and “Created on first publish to Production.” until you publish the API Backend there. If setup stops or fails, select Retry.
  • Once the development database is ready, the tab shows the Supabase panel. Only the Database section is available, because this Supabase instance serves as a database only. Use the environment menu at the top to switch between the environments that exist.

Publishing the API Backend to Staging or Production creates that environment’s database if it doesn’t exist yet, then runs your migrations against it. That needs a paid plan, as it does for a Supabase Backend app. A database that existed before paid backends launched can be published to on any plan until December 1, 2026.

Each environment has its own Supabase project. Open the Manage section of the Supabase panel to see every environment with its project, and to transfer, reset, or delete one. Each action affects only the environment you choose, and Draftbit asks you to type the environment’s name before it deletes or replaces anything. None of these actions can be undone.

  • Transfer to my organization moves the environment’s project to a Supabase organization you own. Billing, team members, and ownership move to you, and Draftbit stops managing that project. The other environments stay with Draftbit.
  • Reset to new project gives the environment a new, empty Supabase project. The current project keeps working until the new one is ready, a few minutes later, and is then deleted with all its data: tables and rows, users, storage files, and edge functions. The new project stays empty until you publish to that environment, or sync Development.
  • Delete project deletes the environment’s project and all its data.

After you transfer or delete an environment’s project, that environment has no project, and publishing to it is turned off. Select Create project in the Manage section to give it a new, empty project at any time.

For a Supabase Backend app, transferring or deleting the last environment that has a project archives the app: the agent and publishing are turned off, and its files stay available read-only. While Development has no project, the agent can still edit the files under supabase/ but can’t reach a development database, so create a new development project to keep building.

For an API Backend’s Supabase database, you can keep the app connected to a transferred database: leave Keep this app connected to the transferred database selected when you transfer it, and that environment keeps using the database through its Postgres connection URL. An environment without a project can also be connected to any Postgres database you manage with Connect external Postgres.

To let the agent work with a transferred project again, connect the Supabase MCP with your own Supabase account.

Projects with a project-level Supabase instance

Section titled “Projects with a project-level Supabase instance”

A project-level Supabase instance is transferred or deleted as a whole, from its Production row: only production moves to your organization, and its development project is deleted, so deploy anything you want to keep first. Afterwards Draftbit no longer manages it, and the Supabase panel is removed.

You can reset either environment. Resetting Production gives it a new, empty project and keeps your development project, so you can deploy to fill it again. Resetting Development rebuilds it as a fresh copy of production’s schema, edge functions, and auth settings, and loses development data and any changes you haven’t deployed.

  • A project can have one Supabase Backend app.
  • Staging and Production need a paid plan, except ones that existed before paid backends launched, until December 1, 2026. Development is available on every plan.
  • A project with a project-level Supabase instance can’t add a Supabase Backend app. Move the instance into one instead.
  • A Supabase Backend app’s published environments can’t be unpublished, because that would delete their data. Delete an environment’s project from the Manage section instead.
  • You can’t publish to an environment that has no Supabase project.
  • Some features depend on your project’s Supabase plan, such as scheduled backups, point-in-time recovery, network restrictions, and editing email templates without custom SMTP. The panel tells you when one isn’t available.
  • Policies and roles are read-only in the panel. Change them with SQL or ask the agent.
  • A database attached to a single app shows only the Database section.