Supabase is an open-source Postgres development platform that provides a complete Postgres database along with authentication, instant APIs, realtime features, and storage—a great open-source alternative to Firebase.
Want to host Supabase yourself? We’ll show you two ways: the easy way, as a One-Click App that makes Supabase available over HTTPS in just a few clicks, and a manual installation using Docker Compose via the console. Then you’ll learn how to use API keys securely, connect your app, and what’s different about self-hosting compared to Supabase Cloud.
Supabase is available as a hosted service (Supabase Cloud) and as a self-hosted option. A VPS of your own is especially useful if:
- You want full control over your data: Your database, files, and user accounts are stored on your server, not with a third-party provider.
- Regulations rule out hosted services: Supabase itself cites compliance requirements that prohibit managed services as a typical reason for self-hosting.
- You need direct access to Postgres: You control the configuration, extensions, and database connection.
- You’re looking for a backend for your own projects or a test and development environment that runs continuously alongside your other services.
Self-hosting is less suitable if you don’t want to manage servers, backups, and updates. According to Supabase, these responsibilities—as well as security, monitoring, and availability—are yours when self-hosting. In that case, help comes from the community, not Supabase Support.
The self-hosted version is the same open-source software, but some features of the cloud platform are not available. The key differences, according to the Supabase documentation, are:
| Self-hosted (VPS) | Supabase Cloud | |
|---|---|---|
| Projects | One project per installation | Multiple organizations and projects |
| Backups | You set them up yourself | Managed backups and point-in-time recovery |
| Branching, ETL, Management API | Not available | Available |
| Operations and updates | You take care of them | Supabase takes care of them |
| Support | Community | Supabase |
If you only need one project with a database, authentication, storage, and realtime features, the self-hosted version has you covered.
The quickest way to get your own Supabase instance is through your VPS’s One-Click Apps. All Supabase services start together, the app is available directly over HTTPS with a domain, and all keys and passwords are generated during installation. You don’t need to touch a repository or .env file.
- A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See Set Up One-Click Apps to learn how.
- Supabase starts around 15 containers. The Supabase team recommends at least 4 GB RAM, 2 CPU cores, and 40 GB SSD storage for self-hosting; 8 GB RAM and 4 CPU cores are recommended.
- Open your VPS in the ZapX dashboard and switch to the One-Click Apps tab.
- Search for Supabase in the App catalog and click Install app.
- Leave Use a custom subdomain or zap.cloud enabled and choose an address. You’ll use this address to access Supabase Studio and your project’s API.
- No field under App configuration is required, so you can leave everything at its default. However, if users should be able to register for your app by email, enter your mail server details here now. See Email delivery for sign-up below.
- Click Queue installation. The first time it starts, the VPS downloads the images for all services. The app will be online after a few minutes.
Open the app’s Access link. It takes you to Supabase Studio, the web interface for your project. Your browser will ask for a username and password. You’ll find both in the app settings (gear icon) under App environment > Automatically generated values:
SERVICE_USER_ADMIN: usernameSERVICE_PASSWORD_ADMIN: password
Use the eye icon to reveal a value, or the copy icon to copy it.
After signing in, you’ll see the overview for the “Default Project,” including the project URL. Use the Table Editor to create tables and the SQL Editor to run SQL directly on your Postgres database.
You need the project URL and an API key for your app:
| Value | Where to find it | Purpose |
|---|---|---|
| Project URL | The app’s Access link, for example https://your-name-1234.zap.cloud | Address for client libraries and the REST API at /rest/v1/ |
| anon key | App environment > Automatically generated values > SERVICE_SUPABASEANON_KEY | For browsers and apps; access is limited by your Row Level Security rules |
| service_role key | App environment > Automatically generated values > SERVICE_SUPABASESERVICE_KEY | For servers and backends only; bypasses all Row Level Security rules |
For example, the connection using the JavaScript library looks like this:
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://name-1234.zap.cloud', '<ANON_KEY>')
Anyone with the service_role key has full access to your database. Never include it in a website or app that users download. Also enable Row Level Security for every table accessible through the API and create appropriate rules.
In Supabase Studio, the page for the new keys (publishable and secret) remains empty because the One-Click App uses the anon and service_role keys. This is expected.
By default, anyone who registers by email must confirm their address using a link. Supabase only sends this email if a mail server is configured. To configure one, enter your mail provider’s details under App environment in the app settings (gear icon):
| Variable | Value |
|---|---|
SMTP_HOST | SMTP server address |
SMTP_PORT | Port, usually 587 |
SMTP_USER | Mailbox username |
SMTP_PASS | Mailbox password |
SMTP_ADMIN_EMAIL | Sender address, for example noreply@your-domain.com |
SMTP_SENDER_NAME | Sender name |
Then click Save. The app will restart. Two other values in the same place control sign-ups: Set ENABLE_EMAIL_AUTOCONFIRM to true to skip the confirmation email; this is only suitable for testing. Set DISABLE_SIGNUP to true to prevent anyone from registering themselves. You can then create users in Supabase Studio under Authentication.
To check whether an update is available for your installation, go to App update in the app settings (gear icon) and click Check for updates. If a new version is available, install it with Apply update. Your database and Storage files are stored in separate volumes and are preserved during the update.
Supabase Studio does not include its own backup feature in the self-hosted version. So before an update, export important tables—for example, as CSV files from the Table Editor.
The rest of this guide describes a manual installation of Supabase using Docker Compose via the console. This may be useful, for example, if you want to integrate Supabase into an existing server environment or control every step yourself. The instructions are based on the official Self-Hosting with Docker guide.
- A Linux server running Debian or Ubuntu that you can access via SSH.
- A domain or subdomain with an A record pointing to your server’s IP address (e.g.
supabase.example.com). You’ll use it to access Supabase Studio and the API over HTTPS.
In the default configuration, Supabase starts eleven containers. The Supabase team recommends the following:
| Hardware | Minimum | Recommended |
|---|---|---|
| CPU | 2 vCPU cores | 4 vCPU cores or more |
| RAM | 4 GB | 8 GB or more |
| Disk space | 40 GB SSD | 80 GB SSD or more |
Also allow for extra space for your Storage data and backups.
First, bring your system up to date:
sudo apt update && sudo apt upgrade -y
Then install Git to download the Supabase files from GitHub:
sudo apt install git -y
Supabase runs in Docker containers. Install Docker with the Compose plugin as follows:
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
For detailed instructions on installing and using Docker, see our Docker guide. Verify the installation with docker --version and docker compose version.
Only SSH and the reverse proxy should be accessible from the internet, meaning ports 80 and 443. With ufw, this looks like this:
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
Do not open port 8000 (API gateway and Studio) or the database ports 5432 and 6543. For more information, see Managing the Firewall on Linux.
Ports published by a container are accessible from the internet despite ufw, because Docker sets its own firewall rules. In the default Supabase configuration, this applies to port 8000 and the database pooler on ports 5432 and 6543. The “Configuration” and “Access via HTTPS through a reverse proxy” sections explain how to restrict these ports to the server itself.
Get the Supabase repository at the current self-hosting version, create a project directory, and copy the Docker files and example environment file into it:
git clone --depth 1 --branch self-hosted/v0.8.5 https://github.com/supabase/supabase
mkdir supabase-project
cp -rf supabase/docker/. supabase-project
cd supabase-project && cp .env.example .env
docker compose pull
The version number in the command matches the version used for this guide. The official guide lists the latest version. Use the update script to install later updates (see “Update Supabase”).
The .env.example file contains publicly known passwords and keys. Don’t start Supabase until you’ve replaced them as described below. The database password is set on the first start.
Now generate all passwords and keys. The first script sets, among other things, POSTGRES_PASSWORD, JWT_SECRET, ANON_KEY, SERVICE_ROLE_KEY, and DASHBOARD_PASSWORD. The second adds the new API keys SUPABASE_PUBLISHABLE_KEY and SUPABASE_SECRET_KEY:
sh utils/generate-keys.sh --update-env
sh utils/add-new-auth-keys.sh --update-env
Both scripts write directly to .env. The second requires Node.js or uses Docker if Node.js is not installed.
Open .env with nano .env and update the addresses to match your domain:
| Variable | Value | Purpose |
|---|---|---|
SUPABASE_PUBLIC_URL | https://supabase.example.com | Address for Studio and the API |
API_EXTERNAL_URL | https://supabase.example.com/auth/v1 | Links in emails, OAuth redirects |
SITE_URL | https://app.example.com | Address of your own app, where users return after signing in |
DASHBOARD_USERNAME | Your own username | Sign-in to Supabase Studio |
Also enter your mail server under SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS, SMTP_ADMIN_EMAIL, and SMTP_SENDER_NAME. The default supabase-mail is only a placeholder; Supabase won’t send confirmation emails without a real mail server.
By default, the database pooler publishes ports 5432 and 6543 on all network interfaces. To make Postgres accessible only from the server itself, create a custom override file. Create it with nano docker-compose.local.yml:
services:
supavisor:
ports: !override
- 127.0.0.1:${POSTGRES_PORT}:5432
- 127.0.0.1:${POOLER_PROXY_PORT_TRANSACTION}:6543
Then add the file to the configuration:
sh run.sh config add local
The run.sh script is in the project directory and adds the file to COMPOSE_FILE in .env. Run sh run.sh config to see which files are active.
Supabase includes ready-to-use extensions for a reverse proxy. Caddy is the easiest option: it obtains the Let's Encrypt certificate itself, forwards WebSockets for realtime features, and protects Studio with your dashboard username and password. Add this line to .env:
PROXY_DOMAIN=supabase.example.com
Then enable the Caddy extension and start Supabase:
sh run.sh config add caddy
sh run.sh start
With Caddy, port 8000 no longer needs to be published, and Supabase is only accessible externally through ports 80 and 443. The first start takes a few minutes. Check the status of all containers with sh run.sh status, and view the logs with sh run.sh logs.
For nginx, use the corresponding extension with sh run.sh config add nginx, and also set CERTBOT_EMAIL in .env. If you already use your own proxy, forward it to port 8000, allow WebSockets for /realtime/v1/, and set the X-Forwarded headers. For the basics, see Set Up a Reverse Proxy with nginx and Create an SSL Certificate (Let's Encrypt).
Open https://supabase.example.com. Your browser will ask for the username and password for Supabase Studio. To view the values from your .env, run:
sh run.sh secrets
After signing in, you’ll see the “Default Project.” Your app can access the API at the same address, for example, https://supabase.example.com/rest/v1/. The official guide explains multiple dashboard users, CORS, and other options.
Your installation’s data is stored in the following locations in the project directory:
volumes/db/data: the Postgres database, including tables, user accounts, and settings.volumes/storage: files you upload to Storage.volumes/functions: your Edge Functions..env: all passwords and keys. Without it, your backed-up data and API keys won’t match.
The key for encrypted database values is also stored in the Docker volume supabase_db-config. Create a full backup while the containers are stopped:
cd ~/supabase-project
sh run.sh stop
tar -czf ~/supabase-backup-$(date +%F).tar.gz volumes .env
docker run --rm -v supabase_db-config:/data -v ~:/backup alpine tar -czf /backup/supabase-db-config-$(date +%F).tar.gz -C /data .
sh run.sh start
To export the database while it’s running, use pg_dump. The command writes the entire database to a file in compressed format:
docker compose exec -T db pg_dump -h localhost -U postgres -d postgres -Fc > ~/supabase-$(date +%F).dump
Store backups off the server and protect them, as they contain credentials.
Back up the database before every update. The included script then merges your configuration with the new version:
cd ~/supabase-project
sh update.sh --dry-run
sh update.sh
sh run.sh pull && sh run.sh recreate
--dry-run shows what will change beforehand. For information about conflicts and version changes, see the Update Guide. Don’t manually mix image versions, or Supabase can’t guarantee compatibility.
Whether you use the One-Click App or a manual installation, the steps are the same from here on.
Supabase provides two types of keys for your app:
- anon key (or publishable key): for browser and mobile apps. Anyone who knows it can only access what your Row Level Security rules allow.
- service_role key (or secret key): for your server or backend only. It bypasses all rules and has full access to the database.
So enable Row Level Security for every table accessible through the API and create rules. Here’s an example for the SQL Editor, where each signed-in user can only see their own entries:
alter table todos enable row level security;
create policy "read_own_todos"
on todos for select
to authenticated
using ( (select auth.uid()) = user_id );
Without a rule, a table with Row Level Security enabled returns no data through the anon key. This is safer than leaving a table open.
Your app needs the project URL and the anon key. For the One-Click App, the project URL is the Access link; for a manual installation, it’s the value of SUPABASE_PUBLIC_URL. The example above under “Connect your app to Supabase” shows how to connect using the JavaScript library. Official libraries are also available for Flutter, Swift, Kotlin, and Python, among others. Access the REST API at /rest/v1/ and sign-in at /auth/v1/.
For confirmation and password links to work, Supabase needs a mail server and your app’s correct address:
- Mail server: the
SMTP_*values—under App environment for the One-Click App, or in.envfor a manual installation. SITE_URL: your app’s address. Links in emails and sign-ins redirect users back here.ADDITIONAL_REDIRECT_URLS: other permitted addresses, such as a development environment, separated by commas.DISABLE_SIGNUP: when set totrue, users can no longer register themselves. You can create users under Authentication in Studio instead.
After making a change, restart the app: click Save for the One-Click App, or run sh run.sh recreate for a manual installation.
- One project per installation: Studio can’t manage additional projects or organizations. You need a second installation for a second project.
- No managed backups: Point-in-time recovery, branching, ETL, and the Management API are only available in the cloud. You’ll need to set up backups yourself.
- Logs and AI assistant: Logs & Analytics are disabled by default for manual installations. The AI assistant in Studio requires your own
OPENAI_API_KEY. - Support: For issues with Supabase itself, get help from the community on GitHub and Discord, not Supabase Support.
You’ve installed Supabase on your server, made it accessible over HTTPS, protected the database from external access, and learned how to connect your app securely, create backups, and install updates.
Prefer not to deal with Docker yourself? Choose the easy One-Click App option described above under “The easy way: Supabase as a One-Click App.” Set up your domain, HTTPS, keys, and updates in just a few clicks.
- Supabase.com – Official website
- Supabase.com/docs/guides/self-hosting – Supabase documentation
Still have questions that aren’t answered here? Our support team is available every day to help—just get in touch! 🙂
