Self-Hosted Supabase on Docker: Build a Complete Firebase Alternative in Your HomeLab

Why Move Your Backend to a HomeLab?

Firebase makes it easy to get authentication, a database, and file storage running in an afternoon. Everything feels effortless until your app crosses the Spark plan’s 50,000 daily Firestore reads, a buggy client loop triggers a $150 overnight bill, or you need relational joins that NoSQL fights at every turn.

Managed backends trade control for convenience. You do not own the runtime, the data model, or the billing rules.

Running self-hosted Supabase on Docker solves this cleanly inside your HomeLab. You get an open-source Backend-as-a-Service built on proven tools: PostgreSQL for relational data, GoTrue for auth, PostgREST for instant REST endpoints, Realtime for WebSockets, and an S3-compatible Storage API.

Supabase Studio gives you a clean web UI, and the client SDKs work much like Firebase’s—except your data stays on your own drives. On a modest home server, an idle stack uses roughly 2 GB of RAM and stays rock-solid for months.

Installation: Setting Up Supabase on Docker

Supabase runs around a dozen interconnected containers, so a 1 GB Raspberry Pi will swap itself to a crawl. Make sure your HomeLab node meets these baseline specs before pulling images:

  • 64-bit Linux host (Ubuntu 22.04 or 24.04 LTS)
  • 4 GB of RAM minimum (8 GB recommended if you share the host with other apps)
  • 20 GB of free SSD storage
  • Docker Engine and Docker Compose v2

Rather than maintaining a massive Compose file by hand, grab the official Docker setup from the Supabase repository. Clone only the latest commit, copy the Docker directory into /opt/supabase, and create your .env file:

git clone --depth 1 https://github.com/supabase/supabase.git /tmp/supabase-repo
sudo mkdir -p /opt/supabase
sudo cp -rf /tmp/supabase-repo/docker/* /opt/supabase/
sudo cp /tmp/supabase-repo/docker/.env.example /opt/supabase/.env
rm -rf /tmp/supabase-repo
cd /opt/supabase

Pull the container images first so you can spot any registry or network hiccups early:

sudo docker compose pull

Downloading all images takes 2 to 5 minutes on a typical 100 Mbps connection. Hold off on starting the containers until we replace the default secrets below.

Configuration: Securing Secrets, Auth, and Networking

The sample .env.example file ships with publicly known passwords and JWT signing keys. Leaving those defaults in place lets anyone on your LAN log into Studio or forge valid API tokens.

Open /opt/supabase/.env and swap out the credentials before booting the stack for the first time.

1. Generate Strong Secrets and JWT Keys

Create a 48-character hex password for Postgres (hex avoids special characters like + or / that break database connection URIs) and a 32-byte base64 string for your JWT secret:

openssl rand -hex 24
openssl rand -base64 32

Supabase signs its API keys using JWT_SECRET, so your ANON_KEY and SERVICE_ROLE_KEY must match it. You can generate both tokens locally with Python and pyjwt (pip install pyjwt):

import jwt, datetime

secret = "YOUR_NEW_JWT_SECRET"
now = int(datetime.datetime.now(datetime.timezone.utc).timestamp())
exp = now + (10 * 365 * 24 * 60 * 60)  # 10 years

for role in ["anon", "service_role"]:
    token = jwt.encode({"role": role, "iss": "supabase", "iat": now, "exp": exp}, secret, algorithm="HS256")
    print(f"{role.upper()}_KEY={token}")

2. Update Dashboard and URL Settings

Update the core variables in /opt/supabase/.env to match your generated keys and HomeLab IP:

POSTGRES_PASSWORD=your_strong_postgres_password
JWT_SECRET=your_32_plus_char_jwt_secret
ANON_KEY=your_generated_anon_key
SERVICE_ROLE_KEY=your_generated_service_role_key

DASHBOARD_USERNAME=admin
DASHBOARD_PASSWORD=your_strong_dashboard_password

SITE_URL=http://192.168.1.50:3000
API_EXTERNAL_URL=http://192.168.1.50:8000
SUPABASE_PUBLIC_URL=http://192.168.1.50:8000

Swap 192.168.1.50 for your server’s actual LAN IP or local hostname. Want to skip SMTP setup during early testing? Set ENABLE_EMAIL_AUTOCONFIRM=true in the same file so new test users are verified automatically.

3. Start the Stack and Plan Remote Access

Boot all containers in detached mode:

sudo docker compose up -d

Give PostgreSQL 30 to 60 seconds to initialize and run its migrations. (If you already booted the stack before editing .env, Postgres will ignore the new POSTGRES_PASSWORD; wipe ./volumes/db/data on a fresh install and run up -d again.)

Do not forward port 8000 directly on your router if you need external access. Put the Kong gateway (http://localhost:8000) behind Caddy, Nginx Proxy Manager, or a Cloudflare Tunnel with HTTPS, then point API_EXTERNAL_URL and SUPABASE_PUBLIC_URL to that domain.

Verification & Monitoring: Keeping Your BaaS Healthy

Check that every container settled into an Up or healthy state without crash-looping:

sudo docker compose ps

Core services like supabase-db, supabase-kong, supabase-auth, supabase-rest, supabase-realtime, supabase-storage, and supabase-studio should all appear healthy. If a container keeps restarting, tail its logs right away:

sudo docker compose logs -f --tail=50 auth db

Open http://<your-homelab-ip>:8000 in a browser and sign in with your DASHBOARD_USERNAME and DASHBOARD_PASSWORD. Create a quick notes table with a title text column, insert one row, and query it over REST using your ANON_KEY:

curl -s "http://192.168.1.50:8000/rest/v1/notes?select=*" \
  -H "apikey: YOUR_ANON_KEY" \
  -H "Authorization: Bearer YOUR_ANON_KEY"

A response like [{"id":1,"title":"First note"}] confirms that Kong, PostgREST, and Postgres are wired up properly.

Resource Checks and Nightly Backups

Check memory and CPU usage after 24 hours of normal traffic to spot any unexpected spikes:

sudo docker stats --no-stream

A single power loss can corrupt unbacked database volumes, so automate your backups early. Add a root cron job (0 3 * * *) that dumps your entire PostgreSQL cluster to a separate drive or NAS share at 3:00 AM:

sudo docker exec -t supabase-db pg_dumpall -c -U postgres > /var/backups/supabase_$(date +%F).sql

You now have a private, predictable backend running on your own hardware—ready for side projects, internal dashboards, and mobile apps without surprise cloud bills.

Share: