Self-Host Supabase: Build Your Own Firebase Alternative with PostgreSQL (2026)
Supabase is an open-source Firebase alternative: PostgreSQL database, Auth, Storage, Realtime, and Edge Functions in one stack. Supabase Cloud starts at $25/mo for production — self-hosting on a Liquid Web VPS cuts costs and gives you data sovereignty and full control. This guide covers server requirements, installation, configuration, SSL, migration from cloud, and maintenance.
What Is Supabase?
Supabase provides:
- PostgreSQL — Full SQL, Row Level Security (RLS), extensions
- Auth — Email, OAuth, magic links (GoTrue)
- Storage — S3-compatible file storage
- Realtime — WebSocket subscriptions for DB changes
- Edge Functions — Deno-based serverless (optional)
It's a Batteries-included backend. The client SDKs match Firebase's ergonomics but use PostgreSQL under the hood.
Why Self-Host?
- Cost — Cloud Pro is $25/mo; a VPS can run the stack for less
- Data sovereignty — Data stays on your infrastructure
- Control — Tune PostgreSQL, add extensions, customize Auth
- Compliance — Meet regional or industry requirements
Trade-off: You manage backups, updates, and scaling. Use a Liquid Web VPS for managed monitoring and SSD performance.
Server Requirements
| Resource | Minimum | Recommended |
|---|---|---|
| RAM | 4 GB | 8 GB |
| CPU | 2 cores | 4 cores |
| Storage | 20 GB SSD | 40+ GB SSD |
| OS | Ubuntu 22.04 | Ubuntu 24.04 |
PostgreSQL performance is I/O-bound. SSD is essential. For production with Realtime and Storage, 8 GB RAM is safer.
Setup
Clone and configure
git clone --depth 1 https://github.com/supabase/supabase
cd supabase/docker
cp .env.example .env
Edit .env:
POSTGRES_PASSWORD— Strong password for PostgreSQLJWT_SECRET— Generate withopenssl rand -base64 32ANON_KEYandSERVICE_ROLE_KEY— Use Supabase CLI or generate from JWTAPI_URL— Your public URL (e.g.https://supabase.yourdomain.com)SITE_URL— Frontend URL for Auth redirects
Start services
docker compose up -d
Wait for services to be healthy: docker compose ps. Core services include PostgreSQL, Kong (API gateway), GoTrue (Auth), Realtime, Storage, PostgREST, and others.
Configure Kong, GoTrue, Realtime, Storage
Kong routes traffic to PostgREST, GoTrue, Realtime, and Storage. Set KONG_HTTP_PORT and URLs in .env so Kong can reach each service.
GoTrue — Set GOTRU_* vars for site URL, redirect URLs, and JWT.
Realtime — Uses WebSocket. Ensure your reverse proxy (Traefik or Nginx) supports WebSocket (Connection: Upgrade, Upgrade: websocket).
Storage — Default is local filesystem. For S3: set STORAGE_BACKEND=s3 and AWS credentials. Useful for multi-instance or large files.
SSL with Traefik or Nginx
Put Traefik in front of Kong:
labels:
- "traefik.http.routers.supabase.rule=Host(`supabase.yourdomain.com`)"
- "traefik.http.routers.supabase.tls.certresolver=letsencrypt"
- "traefik.http.services.supabase.loadbalancer.server.port=8000"
Use Let's Encrypt for certificates. For Realtime, ensure Traefik passes WebSocket headers. See the Traefik guide for middleware and headers.
Migrating from Supabase Cloud
- Export —
pg_dumpfrom your cloud project (Supabase dashboard → Database → Backups, or direct connection). - Import —
pg_restoreinto your self-hosted PostgreSQL. - Update client — Change
SUPABASE_URLandSUPABASE_ANON_KEYto your self-hosted Kong URL and keys. - Storage — If using Storage, migrate files to your self-hosted Storage or S3.
Maintenance: Backups and Monitoring
- Backups — Run
pg_dumpdaily. Store off-server (S3, backup service). - Monitoring — Use
pg_stat_statementsfor slow queries. Monitor container health and disk usage. Liquid Web provides proactive monitoring. - Updates — Pull latest Supabase images periodically. Test in staging before production.
Self-Hosted Supabase vs Cloud vs Alternatives
| Feature | Self-Hosted Supabase | Supabase Cloud | PlanetScale | Neon |
|---|---|---|---|---|
| Cost | VPS only | $25+/mo | Serverless pricing | Serverless pricing |
| PostgreSQL | Full | Full | MySQL (Vitess) | PostgreSQL |
| Auth | GoTrue | GoTrue | External | External |
| Realtime | Yes | Yes | No | Limited |
| Data location | Your server | Supabase regions | PlanetScale | Neon regions |
| Maintenance | You | Managed | Managed | Managed |
| Best for | Cost, sovereignty | Ease, scale | MySQL serverless | PG serverless |
Self-host when cost and control matter. Use Cloud when you want zero-ops. Pair self-hosted Supabase with Docker Compose production patterns and VPS hardening for a robust backend. Add Traefik for TLS and routing.
Use default Storage (local) and Realtime config first. Add S3 and tune PostgreSQL once the stack is stable. Incremental customization reduces debugging.
VPS cost only: roughly $15–40/mo for 4–8 GB RAM. Supabase Cloud Pro is $25/mo. Self-hosting saves money at scale and gives full control.
Yes. Edge Functions run as Deno containers. Configure in docker-compose. You manage scaling and deployment.
Use pg_dump for PostgreSQL. Schedule daily dumps to S3 or backup storage. For Storage, sync files to S3 or another backup destination.
Yes. The client SDKs connect to your Kong URL and use the same API. Update SUPABASE_URL and SUPABASE_ANON_KEY in your app.
WebSocket requires Connection: Upgrade and Upgrade: websocket headers. Ensure Traefik or Nginx passes these through. Check Realtime container logs for errors.




