Dyad LogoDyad

Self-hosted Supabase

Run Supabase on your own server and connect your Dyad apps to it.

This guide walks you through renting a server, running a self-hosted Supabase instance on it, and connecting your Dyad app to it. Once it's connected, Dyad uses your instance the same way it uses Supabase Cloud: it sets up your database, auth and storage, and deploys your edge functions to your server.

There are many ways to install Supabase, but as of now Dyad's integration only supports two of them:

  • With Coolify (recommended). Dyad installs Coolify on your server for you. Coolify is a free, open-source dashboard for running apps on your own server. You then create Supabase from Coolify's template with a few clicks, and Dyad can import its settings for you.
  • With Docker Compose. You install Supabase yourself using Supabase's official setup script. This takes a few terminal commands and gives you a plain Supabase install with nothing else on the server.

Experimental

Self-hosted Supabase is an experimental feature. Turn it on in Settings → Experiments → Allow self-hosted Supabase. If you're using Coolify, also turn on Allow deployment to your own server.

The two experiment switches in Dyad's settings

Set up a server on Hetzner

You can use any Linux server you can log in to as root. This guide uses Hetzner Cloud because it's inexpensive and bills by the hour, so you can create a server to try things out and delete it when you're done.

Create a Hetzner account

Sign up for Hetzner. Coolify offers a promo code that gives new Hetzner accounts €20 or $20 of free credit, depending on your account's currency. We recommend redeeming it immediately after signing up, under Promo Codes, since it has to be used before you create any servers. The credit expires after a few months, and the page shows the date once it's redeemed. Hetzner asks for a payment method, but you won't be charged while you stay within the credit.

Coolify's promo code redeemed on Hetzner's Promo Codes page

Get an SSH key ready

Dyad logs in to your server with an SSH key. You add the public half of the key to the server when you create it, so get it ready first.

Dyad generates a key for you. In Dyad, open the app you want to connect (create one first if you don't have one), go to Publish → Deployment → Your Own Server, and copy the key under 1. Give your server this key.

Dyad's Your Own Server panel showing the public key to copy

Leave this panel open. You'll come back to it once the server is running.

Create a key on your computer. You'll also paste the private half of this key into Dyad later, so give it no passphrase: press Enter when ssh-keygen asks for one.

In PowerShell:

New-Item -ItemType Directory -Force "$env:USERPROFILE\.ssh" | Out-Null
ssh-keygen -t ed25519 -f "$env:USERPROFILE\.ssh\dyad-supabase"
Get-Content "$env:USERPROFILE\.ssh\dyad-supabase.pub"

In a terminal:

mkdir -p ~/.ssh
ssh-keygen -t ed25519 -f ~/.ssh/dyad-supabase
cat ~/.ssh/dyad-supabase.pub

Copy the line that starts with ssh-ed25519. That's the public key.

Create the server

In the Hetzner Cloud console, open your project (Hetzner creates one called Default), go to Servers and click Add Server. Then choose:

  • Type: under Shared Resources, pick Regular Performance. Choose CPX22 (4 GB of memory) to try Supabase out, or CPX32 (8 GB) for an app you plan to keep running. Coolify and Supabase together use about 3 GB. Depending on what else you intend to run, you may wish to use a stronger server than CPX32.
Hetzner's server types, with Regular Performance selected
  • Location: the one closest to you or your users. Prices differ slightly between locations.
  • Image: Ubuntu, the newest version. Many other distributions of Linux will likely work as well.
Hetzner's image picker with Ubuntu selected
  • Networking: leave Public IPv4 on. Dyad connects to the server by its IP address.
  • SSH keys: click Add SSH key and paste the public key from the previous step. Hetzner fills in a name from the key, which you can change.
Hetzner's Add an SSH key dialog with a public key pasted in

Leave everything else as it is and click Create & Buy now. Despite the name, Hetzner bills by the hour and you only pay for the time the server exists.

When the server is running, copy its IPv4 address from the Public IP column of the server list.

Hetzner's server list showing a running server and its public IP

Stopping the bill

Turning a server off doesn't stop Hetzner billing for it. To stop paying, delete the server.

Option 1: Install Supabase with Coolify

Install Coolify from Dyad

Fill in the server details

Back in Dyad's Your Own Server panel, enter:

  • Server address: the server's IPv4 address.
  • Email for the Coolify admin account: this is your Coolify login. It must use a real domain, because Coolify checks that the domain exists.
  • Domain: leave this empty. Dyad sets up HTTPS using a free address based on your server's IP.

Click Check server. Dyad connects to the server and shows its fingerprint and memory.

Install

Click Install Coolify. Installing takes a few minutes, and you can leave the screen while it runs.

Dyad installing Coolify and showing the installer's progress

When it's done, Dyad shows the dashboard address, your email and a generated password. Save the password now. Then click Continue.

Dyad showing the Coolify address, email and password after installing

Create Supabase in Coolify

Sign in to Coolify

Open the address Dyad showed you and sign in with your email and password. Coolify opens a welcome wizard. Click Skip setup: the installer has already added your server to Coolify.

Coolify's welcome screen with the Skip setup button

Create a project

Go to Projects, click New Project, give it a name such as supabase, and click Create Project.

Coolify's New Project dialog

Add Supabase

In the project, click New Resource, search for Supabase, and click Configure.

Searching Coolify's resources for Supabase

On the service page that opens, click Deploy.

The new Supabase service in Coolify with the Deploy button

After a couple of minutes, every resource should show Running. Minio Createbucket shows Exited: it's a one-time setup step, and that's expected.

Supabase's resources in Coolify, all running

Turn on HTTPS

Coolify serves Supabase over plain HTTP by default, which would send your keys unencrypted. To switch to HTTPS, open the service's Domains page, click the ⋯ menu next to the Supabase Kong address (under Actions), and choose Edit.

The Supabase service's Domains page in Coolify

Change Protocol to https and click Save. Coolify may warn that sslip.io addresses can hit certificate rate limits; you can continue anyway.

Coolify's Domain settings with the protocol set to https

Then click Restart current version at the top of the page and confirm. About a minute later, the address works over HTTPS.

Connect your app

Import from Coolify

In Dyad, open your app's details page. Under Supabase Projects, choose Self-hosted, click Add self-hosted instance, and pick your service under Import from Coolify.

Choosing the Coolify Supabase service to import in Dyad

Dyad fills in everything, including the SSH details it uses to deploy edge functions. Check that the API URL starts with https://.

Dyad's self-hosted form filled in from Coolify

Add and connect

Click Add and connect. Dyad checks the instance and deploys a test edge function. When it's done, your app is connected.

An app connected to a self-hosted Supabase instance

If Dyad says it couldn't reach the instance and the error ends in UNABLE_TO_VERIFY_LEAF_SIGNATURE, it usually means HTTPS isn't on yet. Go back to Turn on HTTPS and make sure you clicked Restart current version after saving. If you just restarted, wait a minute and try again.

To open Supabase Studio, click Studio. Sign in with the Supabase · Dashboard User and Supabase · Dashboard Password shown on the service's page in Coolify.

Option 2: Install Supabase with Docker Compose

Log in to your server

From the terminal on your computer, using the key you created earlier:

In PowerShell:

ssh -o IdentitiesOnly=yes -i "$env:USERPROFILE\.ssh\dyad-supabase" root@<your-server-ip>
ssh -o IdentitiesOnly=yes -i ~/.ssh/dyad-supabase root@<your-server-ip>

The first time, type yes to trust the server. Run the rest of the commands in this section on the server.

Run Supabase's setup script

curl -fsSL https://supabase.link/setup.sh | sh

The script installs Docker, downloads Supabase into supabase-project, and generates your passwords and keys. It asks four questions:

  • SUPABASE_PUBLIC_URL: enter https://<your-server-ip>.sslip.io. sslip.io turns your IP address into a name that HTTPS certificates can be issued for.
  • API_EXTERNAL_URL, SITE_URL and PROXY_DOMAIN: press Enter to accept each default.

Turn on HTTPS

Supabase includes a Caddy setup that gets an HTTPS certificate for you:

cd supabase-project
sh run.sh config add caddy

Caddy only lets Supabase's public APIs through and puts everything else behind your dashboard password. Dyad also needs Supabase's SQL endpoint, /pg/, which Supabase still protects with your service role key. Add it to Caddy's list:

sed -i 's#@supabase_api path #@supabase_api path /pg/* #' volumes/proxy/caddy/Caddyfile

Start Supabase

sh run.sh start

This takes a minute or two. When it finishes, every service shows as healthy. You can check again at any time with sh run.sh status.

Get your keys

Print the two keys Dyad needs:

grep -E '^(ANON_KEY|SERVICE_ROLE_KEY)=' .env

Keep the service role key private. It has full access to your database.

Connect your app

In Dyad, open your app's details page. Under Supabase Projects, choose Self-hosted and click Add self-hosted instance. Fill in:

  • Name: anything you like.
  • API URL and Studio URL: https://<your-server-ip>.sslip.io
  • Anon key and Service role key: the values from the previous step.
  • Enable edge functions: turn it on, then enter your server's IP address as the SSH host, root as the SSH user, and paste your private key. Print it on your computer with cat ~/.ssh/dyad-supabase (on Windows, Get-Content "$env:USERPROFILE\.ssh\dyad-supabase").
Dyad's self-hosted form filled in for a Docker Compose install

Click Add and connect. Dyad checks the instance and deploys a test edge function. When it's done, your app is connected.

An app connected to a Docker Compose Supabase instance

To open Supabase Studio, click Studio. Sign in with DASHBOARD_USERNAME and DASHBOARD_PASSWORD, which you can print on the server with grep -E '^DASHBOARD_(USERNAME|PASSWORD)=' .env.

Close the database ports

By default, the Docker Compose install also opens Postgres to the internet on ports 5432 and 6543, protected by its password. If you don't need direct database access, add a Hetzner firewall that only allows ports 22, 80 and 443.

What to know

  • Email sign-up needs SMTP. Self-hosted Supabase doesn't send email until you configure an SMTP server. Until then, Dyad's card shows SMTP not configured, and email sign-up fails because Supabase can't send the confirmation email. See Supabase's SMTP settings. To try sign-up without SMTP, turn off email confirmation, so new users can sign in right away without confirming their address:
    • Coolify: in the service's Environment Variables, set ENABLE_EMAIL_AUTOCONFIRM to true, then click Restart current version.
    • Docker Compose: in supabase-project/.env, set ENABLE_EMAIL_AUTOCONFIRM=true, then run sh run.sh recreate auth.
  • Settings and secrets are set on the server. Things that Dyad changes for you on Supabase Cloud, such as auth redirect URLs and edge function secrets, live in your server's configuration, and Dyad's agent tells you what to set.
    • Coolify: add them in the service's Environment Variables, then click Restart current version.
    • Docker Compose: auth settings such as ADDITIONAL_REDIRECT_URLS are already in supabase-project/.env; change them there and run sh run.sh recreate auth. For an edge function secret, add it to .env (for example OPENAI_API_KEY=...), add a matching line under functions: → environment: in docker-compose.yml (for example OPENAI_API_KEY: ${OPENAI_API_KEY}), then run sh run.sh recreate functions. sh run.sh restart doesn't pick up changes to .env.
  • Use one instance per app. Apps connected to the same instance share its database and edge functions, so tables or functions with the same name overwrite each other.
  • Edge function updates take a few minutes to go live. Requests keep working while an update rolls out: up to about a minute on Coolify, and up to about seven minutes with Docker Compose. Dyad shows when the new version will be live.

On this page