Manish Saraan
Nov 5, 2024

How to Self-Host Supabase with Coolify

Want the power of Supabase, but on your own server, under your control, with a nice UI instead of wrestling raw Docker and docker-compose.yml files?

Set up Supabase on your own VPS using Coolify – a "self-hosted Heroku/Vercel" style platform.

By the end, you'll have:

  • A self-hosted Supabase instance (DB, Auth, Storage, etc.)
  • Running on your VPS
  • Behind your own domain + HTTPS
  • Managed by Coolify's dashboard (deployments, logs, env vars, the works)

Why Self-Host Supabase?

You might want to self-host if:

  • You need full control over data location and compliance.
  • You want to avoid vendor lock-in and long-term pricing surprises.
  • You already pay for VPS servers and want to consolidate hosting.
  • You just like tinkering and owning your infrastructure.

Supabase is open source, so you're allowed (and encouraged) to run it yourself. The "hard" part is orchestration, updates, SSL, and reverse proxy.

That's where Coolify comes in.

Quick Primer: Supabase & Coolify

What is Supabase?

Supabase is basically a Firebase alternative built on PostgreSQL. Out of the box you get:

  • PostgreSQL database
  • Auth (email/password, magic links, OAuth)
  • Storage (file storage)
  • REST & Realtime APIs
  • Edge Functions and more

The official team provides Docker setups so you can self-host, but you usually have to maintain a docker-compose.yml yourself.

What is Coolify?

Coolify is a self-hosted PaaS. Think of it as:

"Heroku/Vercel, but you run it on your own VPS."

With Coolify you get:

  • A web UI to deploy apps, databases, and 280+ services
  • Built-in reverse proxy and SSL (Let's Encrypt)
  • Environment variable management
  • Logs, health checks, and container lifecycle management
  • A Supabase template so you don't have to hand-craft your own compose file

Put simply:

Supabase = your backend platform Coolify = your hosting control panel for that backend

Before You Start: Checklist

Here's what you should have ready.

1. Server / Infrastructure

  • A VPS from Hetzner, DigitalOcean, Hostinger, etc.

  • OS: Ubuntu 20.04 or 22.04 (recommended)

  • Minimum resources:

    • 2 vCPUs
    • 2–4 GB RAM
    • 30–80 GB SSD
    • (Something like Hetzner CPX21: 3 vCPUs, 4 GB RAM, 80 GB SSD works great)
  • Root or sudo SSH access

2. Domain & DNS

  • A domain (e.g. yourdomain.com)

  • Ability to create DNS records (Cloudflare, Namecheap, etc.)

  • You'll use something like:

    • supabase.yourdomain.com for Supabase
    • Optionally coolify.yourdomain.com for the Coolify dashboard

3. Basic Knowledge

You don't need to be a DevOps guru, but:

  • Comfortable using SSH to run commands
  • Know what a DNS A record is
  • Have an email address (used for Let's Encrypt SSL)

4. Software (Coolify will help you here)

Coolify's installer will handle:

  • Docker
  • Docker Compose
  • Traefik (reverse proxy)

So you don't have to pre-install these, but it's good to know they're involved.


Step 1 – Set Up Your VPS and Install Coolify

1. Create the VPS

  • Log into your provider (Hetzner, DO, etc.)

  • Spin up a new server:

    • Image: Ubuntu 22.04 LTS
    • Size: at least 2 GB RAM (4 GB is safer for Supabase)
  • Note down the public IP.

2. Point your domain to the VPS

In your DNS provider (e.g. Cloudflare):

  • Create an A record:

    • Name: supabase
    • Value: YOUR_VPS_IP
  • If you want a custom domain for Coolify itself:

    • Name: coolify
    • Value: YOUR_VPS_IP

Tip: If using Cloudflare, some people temporarily turn off the orange cloud (proxy) during setup to avoid SSL/proxy weirdness. You can turn it back on later once everything is stable.

3. SSH into the VPS

From your local machine:

ssh root@YOUR_VPS_IP

(or the non-root user with sudo rights)

4. Install Coolify

Coolify provides a single-line install script in their official docs.

The flow is:

  1. Go to the Coolify website.
  2. Copy the install command from their docs.
  3. Run it on your server as root (or via sudo).

The installer will:

  • Install Docker & Docker Compose
  • Pull the Coolify images
  • Start Coolify as a Docker stack with Traefik

5. Access the Coolify dashboard

Once installation finishes, you'll see instructions like:

  • Visit https://coolify.yourdomain.com or
  • Visit http://YOUR_VPS_IP:PORT (if you didn't set a domain yet)

Open that in your browser and:

  • Complete the onboarding
  • Create your admin user

Nice. You now have your "self-hosted Heroku" running. Next: Supabase.


Step 2 – Create a Project in Coolify and Add Supabase

Inside Coolify:

  1. Go to the Projects tab.
  2. Click Add to create a new project.
  3. Name it something like supabase or backend.
  4. Choose Environment: production (you can add staging later if you like).

Now let's add Supabase as a resource:

  1. Enter your new project.

  2. Click Add New Resource.

  3. Search for Supabase in the list of services/templates.

  4. Pick the Supabase template.

  5. Choose Destination / Server:

    • If you only have one server, just select it.
  6. Configure basic details:

    • Service name: supabase
    • Domain: supabase.yourdomain.com (if prompted)

Click Save (or equivalent). Coolify will create a stack for you, wired with Traefik, ready for env vars and deployment.


Step 3 – Configure Environment Variables in Coolify

Before you deploy, you need to set up the environment variables that make your Supabase instance actually usable.

In Coolify:

  1. Go to your Supabase resource.
  2. Find the Environment Variables section.
  3. Switch to any "developer view" or key/value editor there.

Let's go through the key ones.

Database

  • POSTGRES_PASSWORD

    • Use a long, random password (32+ chars).
  • Optional (if you want custom names):

    • POSTGRES_USER
    • POSTGRES_DB

If you don't customize them, the template will usually use sensible defaults.

JWT & Keys

Supabase uses JWT secrets and keys for auth:

  • JWT_SECRET – core secret used to sign tokens
  • ANON_KEY – used by client-side apps (public, limited permissions)
  • SERVICE_ROLE_KEY – powerful key for server-side operations

You can generate these using JWT tools or the official docs. The main idea:

  • Keep them random and secret
  • Never commit them to Git
  • Store them inside Coolify's env vars only

URLs

You'll likely need variables like:

  • SITE_URL

    • The main site URL (used for emails, magic links, etc.).
    • For example: https://supabase.yourdomain.com or your app's front-end URL.
  • SUPABASE_PUBLIC_URL / SUPABASE_URL

    • Public API URL for clients.
    • Typically: https://supabase.yourdomain.com

The exact names can differ slightly depending on the template version, but the concept is the same: your Supabase URL(s) must match the domain you set up in Coolify.

OAuth (optional for now)

If you plan to support Google/GitHub login, you'll use env vars like:

  • ENABLE_GOOGLE_SIGNUP=true
  • GOOGLE_CLIENT_ID
  • GOOGLE_CLIENT_SECRET
  • GOOGLE_CALLBACK_URI=https://supabase.yourdomain.com/auth/v1/callback

We'll revisit OAuth in the advanced section – no need to wire it all up right this second.

Tip: Treat these env vars as secrets. Only store them in Coolify, a password manager, or your secret management system – never hardcode them in your codebase.


Step 4 – Log In to Supabase Studio and Test It

Open your browser and visit:

https://supabase.yourdomain.com

(or whatever domain you configured).

Coolify usually shows Service Specific Configuration for Supabase, which may include:

  • Admin email for Supabase Studio
  • Admin password or how to retrieve it

Use those credentials to log in.

Quick sanity check

Inside Supabase Studio:

  1. Go to Table editor.
  2. Create a new table, e.g. todos with a text column.
  3. Insert a test row.
  4. Hit the REST or SQL editor and check that you can query it.

If you want to test APIs:

  • REST: https://supabase.yourdomain.com/rest/v1/
  • Auth: https://supabase.yourdomain.com/auth/v1/
  • Storage: https://supabase.yourdomain.com/storage/v1/
  • Realtime: wss://supabase.yourdomain.com/realtime/v1/

You can find and copy the anon and service_role keys in:

Settings → API inside Supabase Studio.

At this point, you've got a working self-hosted Supabase on Coolify.


Wrap-Up: What You've Just Built

You now have:

  • A self-hosted Supabase backend
  • Running on your own VPS
  • Managed through Coolify's web UI
  • Using your own domain + HTTPS

From here, you can:

  • Connect your front-end (Next.js, React, Flutter, etc.) to your new Supabase URL and anon key.
  • Add more services in Coolify alongside Supabase (e.g. an app, n8n, Redis).
  • Gradually migrate off the hosted Supabase platform if you haven't already.
  • Experiment safely on staging environments before pushing to production.