# Self-host Supabase

> Postgres-based backend stack (database, auth, REST API, realtime, file storage, edge functions) with a Studio dashboard, self-hosted as a Docker Compose project. Run your own Supabase on an always-on EnvHaven workspace by asking its coding agent: one request installs it, puts it on an HTTPS address and locks it down. What the agent takes care of, and the manual route.

_Updated November 23, 2026_

Running your own Supabase usually means a list of server chores: a machine that stays on, Docker or a runtime, a reverse proxy with certificates, a domain, and the settings that make Supabase behave behind all of it. On an EnvHaven workspace you skip the list. You ask the coding agent, and it does the work while you watch.

## Just ask your agent

Open a Plus workspace (Supabase runs in Docker, which Plus and Pro include), tap **Launch** to start any coding agent (Claude Code, Codex, OpenCode or another), and ask it:

```text
Set up Supabase on this workspace and give me the link. Follow https://envhaven.com/self-host/supabase.md
```

Then open the link it sends and create your Supabase account straight away, before anyone else finds the address. That is the whole request: the address in it is this page's Markdown copy, and the agent follows the instructions for it further down, with every setting Supabase's docs require.

## Or keep it private with Tailscale

The preview URL puts Supabase on the public internet, which suits something other people need to reach. For an app only you and your household use, your tailnet is the better home: Tailscale gives Supabase an HTTPS address that only your own devices, signed in to your Tailscale account, can open. Save a Tailscale auth key in the workspace's **Vars** pane as `TS_AUTHKEY`, and ask the agent:

```text
Set up Supabase on my tailnet instead of the preview URL. Follow https://envhaven.com/self-host/supabase.md and https://envhaven.com/guides/self-host-privately-with-tailscale.md
```

- A Tailscale container runs beside Supabase, so it keeps its private address through workspace restarts and updates, and every app you set up this way gets an address of its own.
- Anything other services have to reach, such as a webhook, still needs a public address. [Keep self-hosted apps private with Tailscale](https://envhaven.com/guides/self-host-privately-with-tailscale) covers both, and what Tailscale's free plan includes.

| At a glance |  |
| --- | --- |
| What it is | Databases, backends and analytics |
| License | Apache-2.0 |
| Runs as | Docker (`supabase/postgres plus supabase/studio, supabase/gotrue, supabase/realtime, supabase/storage-api, supabase/postgres-meta, supabase/edge-runtime, supabase/supavisor (third-party in the stack: postgrest/postgrest, envoyproxy/envoy, darthsim/imgproxy)`) |
| Memory | 4 GB minimum, 8 GB+ recommended ([docs](https://supabase.com/docs/guides/self-hosting/docker)) |
| Plan that fits | Plus or larger |
| Web port | 8000 |
| Documentation | [supabase.com/docs/guides/self-hosting/docker](https://supabase.com/docs/guides/self-hosting/docker) |

## What your agent takes care of

- **Installing it.** Supabase runs from the official image, `supabase/postgres plus supabase/studio, supabase/gotrue, supabase/realtime, supabase/storage-api, supabase/postgres-meta, supabase/edge-runtime, supabase/supavisor (third-party in the stack: postgrest/postgrest, envoyproxy/envoy, darthsim/imgproxy)`, with its data in folders under `~/apps/supabase`.
- **Putting it on an HTTPS address.** The workspace's preview URL serves it, and your own domain can too.
- **Locking it down first.** What Supabase's docs say to set before it faces the internet, below.
- **Telling you what to back up**: volumes/db/data (Postgres data directory), volumes/storage (Storage files, local backend), volumes/functions (Edge Functions code), volumes/snippets and the .env file (all secrets and keys) ([docs](https://supabase.com/docs/guides/self-hosting/docker)).

### The settings it needs behind a proxy

- `SUPABASE_PUBLIC_URL`: Base URL clients use to reach Supabase from the Internet (Dashboard, API, Storage); also the supabaseUrl passed to client libraries. ([docs](https://supabase.com/docs/guides/self-hosting/docker))
- `API_EXTERNAL_URL`: Public URL of the Auth service (ends in /auth/v1); used for OAuth callbacks, SAML endpoints and email links. ([docs](https://supabase.com/docs/guides/self-hosting/docker))
- `SITE_URL` (and `ADDITIONAL_REDIRECT_URLS`): Default redirect URL for Auth: the URL of your own frontend app. ([docs](https://supabase.com/docs/guides/self-hosting/docker))
- `PROXY_DOMAIN` and `CERTBOT_EMAIL` (Nginx override only): Domain and Let's Encrypt contact used by the bundled jonasal/nginx-certbot proxy; Caddy needs no extra variables. ([docs](https://supabase.com/docs/guides/self-hosting/self-hosted-proxy-https))
- Reverse proxy requirements: Proxy to the gateway on port 8000, enable WebSocket support (Realtime), add X-Forwarded headers, then set the three URL variables to the HTTPS URL. ([docs](https://supabase.com/docs/guides/self-hosting/self-hosted-proxy-https))
- TLS termination: The default Envoy gateway does not terminate TLS, so HTTPS needs the Caddy or Nginx override or your own proxy; docs call HTTPS required for production. ([docs](https://supabase.com/docs/guides/self-hosting/self-hosted-proxy-https))
- `API_GW_HTTP_PORT`: Host port the gateway publishes (default 8000). ([docs](https://github.com/supabase/supabase/blob/master/docker/.env.example))

### Before it faces the internet

- The shipped .env.example holds placeholder secrets, including demo ANON_KEY and SERVICE_ROLE_KEY JWTs (payload iss supabase-demo, signed with the placeholder JWT_SECRET); anyone can forge tokens until they are replaced. ([docs](https://supabase.com/docs/guides/self-hosting/docker))
- The env file itself says to change every default before first start. ([docs](https://github.com/supabase/supabase/blob/master/docker/.env.example))
- Placeholder JWT secret shipped in the example. ([docs](https://github.com/supabase/supabase/blob/master/docker/.env.example))
- Studio sits behind HTTP basic auth with a shipped default username supabase and an intentionally insecure default password. ([docs](https://github.com/supabase/supabase/blob/master/docker/.env.example))
- Docs require a strong dashboard password before first start; it must contain at least one letter and no special characters. ([docs](https://supabase.com/docs/guides/self-hosting/docker))
- Generate secrets with the shipped scripts before the first start. ([docs](https://supabase.com/docs/guides/self-hosting/docker))
- Sign-up is open by default (DISABLE_SIGNUP=false, email sign-up on). ([docs](https://github.com/supabase/supabase/blob/master/docker/.env.example))
- Changing JWT_SECRET later means regenerating the JWKS too. ([docs](https://supabase.com/docs/guides/self-hosting/self-hosted-auth-keys))
- HTTPS is required for production. ([docs](https://supabase.com/docs/guides/self-hosting/self-hosted-proxy-https))
- The compose file publishes the Supavisor Postgres ports (5432 and 6543) with no bind address, so they listen on every interface by default; firewall them or bind them to loopback. The docs say direct Postgres is not exposed by default. ([docs](https://github.com/supabase/supabase/blob/master/docker/docker-compose.yml))

## Things to ask next

Everything after the install is one more sentence to the agent. Some that come up:

- "Create the tables for a simple CRM: companies, contacts and deals."
- "Seed it with sample data so I can try the interface."
- "Move Supabase to app.example.com." Add the domain on the dashboard's Domains page with a CNAME to `domains.envhaven.app`, and the agent changes Supabase's address settings to match.
- "Update Supabase to the latest release." It pulls the new image and recreates the container, data kept.

## Instructions for the agent

The agent reads these from the page's Markdown copy. They also work pasted on their own, if you would rather give them in your own words.

```text
Set up Supabase on this workspace and serve it at my preview URL.
- Use Docker Compose with the official image, supabase/postgres plus supabase/studio, supabase/gotrue, supabase/realtime, supabase/storage-api, supabase/postgres-meta, supabase/edge-runtime, supabase/supavisor (third-party in the stack: postgrest/postgrest, envoyproxy/envoy, darthsim/imgproxy), starting from the docs' compose file: https://github.com/supabase/supabase/blob/master/docker/docker-compose.yml. If `docker compose` is missing, install the Compose plugin into ~/.docker/cli-plugins first.
- The docs' setup includes: Postgres (supabase/postgres, bundled); Envoy API gateway (default; Kong is an optional override); Studio; Auth (GoTrue); PostgREST; Realtime; Storage API; imgproxy; postgres-meta; Edge Runtime (Deno); Supavisor connection pooler.
- Keep the compose file in ~/apps/supabase and all of its data in folders there (bind mounts, not named volumes), with restart: unless-stopped on every service.
- This server has no firewall, so publish no port on its public IP, and drop host networking and privileged mode from the docs' compose file. Docker runs on the host: connect this workspace to the compose network and relay my preview URL's port to Supabase's port 8000.
- The preview URL terminates HTTPS in front of Supabase: serve plain HTTP on its port, and trust the forwarded headers the relay passes on.
- Set what "The settings it needs behind a proxy" lists on https://envhaven.com/self-host/supabase.md for the preview URL, as Supabase's docs describe for running behind a proxy; skip any that apply only when Supabase serves HTTPS itself.
- Before the preview URL serves it, apply what "Before it faces the internet" lists on https://envhaven.com/self-host/supabase.md.
- When it answers at the preview URL, send me the link and tell me what to back up.
- If I asked for my tailnet instead of the preview URL, set Supabase up the same way but follow https://envhaven.com/guides/self-host-privately-with-tailscale.md for the network: no preview URL, no relay.
```

## What to know

- In Docker, Supabase's containers keep running when the workspace restarts or updates. The relay from the preview URL is a process in the workspace, so after a restart or an update, ask the agent to restore it.
- Supavisor publishes raw Postgres on host ports 5432 (session) and 6543 (transaction) by default. These are raw TCP connections, which an HTTP-only tunnel cannot carry; run psql, migrations and pg_dump on the VPS or over SSH/VPN. ([docs](https://supabase.com/docs/guides/self-hosting/accessing-postgres))
- Realtime needs WebSocket pass-through on whatever sits in front. ([docs](https://supabase.com/docs/guides/self-hosting/self-hosted-proxy-https))
- Storage upload limit in the compose file is 50 MiB (52428800 bytes); raising it past a 100 MB tunnel body cap would still fail at the tunnel. ([docs](https://github.com/supabase/supabase/blob/master/docker/docker-compose.yml))
- Auth emails (confirmation, recovery, invites) need an external SMTP server; the example .env points at a placeholder mail host and ENABLE_EMAIL_AUTOCONFIRM is false. ([docs](https://supabase.com/docs/guides/self-hosting/docker))
- Heavy for a small VPS: 4 GB RAM minimum for all services; analytics (Logflare, Vector) is off by default to save memory and Edge Functions are capped at 2g. ([docs](https://supabase.com/docs/guides/self-hosting/docker))
- Compose pins every image tag; docs say stable snapshots ship about monthly and mixing service versions is not guaranteed. ([docs](https://supabase.com/docs/guides/self-hosting/docker))
- A workspace has one preview URL and one custom domain, both serving the same port, so it puts one app on a public address at a time.

## Without a workspace

The manual route, on a server you run:

1. Rent a Linux VPS, secure SSH, and create a user for the app.
2. Install Docker and write a compose file from the official image.
3. Put a reverse proxy in front (Caddy, nginx or Traefik), get certificates, and point a domain at the server.
4. Set the proxy settings listed above for that domain, and pass WebSocket upgrades through the proxy if the app uses them.
5. Keep the firewall closed except for the proxy, and schedule backups and updates.

Supabase's own [documentation](https://supabase.com/docs/guides/self-hosting/docker) covers each step for its install methods.

## Sources

Facts about Supabase come from its own documentation, checked on 2026-11-23:

- [supabase.com/docs/guides/self-hosting/docker](https://supabase.com/docs/guides/self-hosting/docker)
- [github.com/supabase/supabase/blob/master/docker/docker-compose.yml](https://github.com/supabase/supabase/blob/master/docker/docker-compose.yml)
- [supabase.com/docs/guides/self-hosting/self-hosted-proxy-https](https://supabase.com/docs/guides/self-hosting/self-hosted-proxy-https)
- [github.com/supabase/supabase/blob/master/docker/.env.example](https://github.com/supabase/supabase/blob/master/docker/.env.example)
- [supabase.com/docs/guides/self-hosting/accessing-postgres](https://supabase.com/docs/guides/self-hosting/accessing-postgres)
- [supabase.com/docs/guides/self-hosting/self-hosted-auth-keys](https://supabase.com/docs/guides/self-hosting/self-hosted-auth-keys)

## Keep reading

- [Self-host any app with your agent](https://envhaven.com/self-host)
- [Self-host Appwrite](https://envhaven.com/self-host/appwrite)
- [Self-host NocoDB](https://envhaven.com/self-host/nocodb)
- [Self-host Baserow](https://envhaven.com/self-host/baserow)
- [Self-host Directus](https://envhaven.com/self-host/directus)
- [AI agent hosting](https://envhaven.com/guides/ai-agent-hosting)

Source: https://envhaven.com/self-host/supabase
