Deployment guide

Hosting Supabase on a VPS

Deploy on a VPS Cloud →

Databases9 min read

Hosting Supabase on a VPS

Supabase is the open source alternative to Firebase built on PostgreSQL: database, authentication, storage, edge functions, and an auto-generated API. Self-hosting it on a VPS gives you a complete self-hosted backend, with no project cap or usage-based billing, with your data in your own Postgres.

Why self-host Supabase on a VPS

Supabase is not a black box: it's a set of open source services (PostgreSQL, GoTrue for auth, PostgREST for the API, Realtime, Storage, Kong as the gateway) orchestrated together. The cloud version bills per project and per active user, and pauses inactive free projects. By self-hosting on a VPS, you get a complete backend-as-a-service without these limits, with direct access to your PostgreSQL for migrations, extensions (pgvector, PostGIS), and tuning. It's ideal for an agency hosting several client apps, a startup SaaS wanting to control its costs, or any project requiring data sovereignty. You handle updates and backups yourself, in exchange for total freedom.

The concrete benefits of a self-hosted Supabase

  • Complete backend: Postgres database, Auth, Storage, Realtime, and REST/GraphQL API in one stack.
  • Direct access to the underlying PostgreSQL: SQL migrations, extensions, and RLS policies without limit.
  • No pausing and no billing per monthly active user.
  • Studio included: a web administration interface to manage tables, auth, and buckets.
  • AI extensions via pgvector for RAG and semantic search, enabled freely.
  • Multiple projects on a single VPS: convenient for an agency or a development studio.

Hardware and software prerequisites

Self-hosted Supabase launches around a dozen containers (Postgres, Kong, GoTrue, PostgREST, Realtime, Storage, Studio, Meta, Imgproxy...), so it's a more demanding stack than a simple database. Count on a minimum of 2 vCPU and 4 GB of RAM for a test environment, and rather 4 vCPU with 8 GB of RAM and 80 GB of SSD for production. On the software side: Ubuntu 22.04/24.04 LTS, Docker and Docker Compose v2, a domain name pointing to the VPS (e.g., api.mysaas.com) to expose the gateway over HTTPS, and a reverse proxy like Caddy, Traefik, or Nginx to handle SSL. Also plan to generate robust secrets (JWT_SECRET, anon and service_role keys).

Deploying self-hosted Supabase with Docker

01

Clone the official repository and prepare the environment

Get the docker folder from the Supabase repository, copy .env.example to .env, then generate unique secrets: POSTGRES_PASSWORD, JWT_SECRET, and the ANON_KEY / SERVICE_ROLE_KEY keys derived from the JWT. Never deploy with the example values.

02

Configure the URLs and the Studio password

In .env, set SITE_URL, API_EXTERNAL_URL, and SUPABASE_PUBLIC_URL with your domain, and protect Supabase Studio with DASHBOARD_USERNAME and DASHBOARD_PASSWORD: the Studio gives full admin access to your project.

03

Launch the stack

Start with docker compose up -d, then follow the services' startup via docker compose ps. The first Postgres initialization and the application of internal migrations take one to two minutes; check for the absence of errors in docker compose logs.

04

Set up a reverse proxy with SSL

Put Caddy or Traefik in front of Kong (the gateway's port 8000) to expose your API over HTTPS. Caddy automatically obtains and renews Let's Encrypt certificates: a simple mysaas.com { reverse_proxy localhost:8000 } block is enough. Never expose Postgres (5432) publicly.

05

Enable RLS policies

Log in to the Studio, create your tables, then enable Row Level Security on each one and define your policies. Without RLS, your anon key exposes all your data: this is the number one security point of a self-hosted Supabase.

06

Back up Postgres and the Storage

Schedule a daily pg_dump of the database and archive the Storage volume (file buckets) to external storage. Test a full restore on a staging VPS before relying on it in production.

Supabase vs Appwrite: which self-hosted BaaS to choose?

CriterionSupabaseAppwrite
DatabaseNative PostgreSQL, full SQLMariaDB internally, document/collection API
Data modelRelational, Postgres RLSDocuments and collections, rule-based permissions
Auto-generated APIREST (PostgREST) + GraphQLREST, GraphQL, and multiple SDKs
AuthenticationGoTrue, OAuth, magic linksBuilt-in Auth, OAuth, teams, JWT
Resource footprintHeavier (~10 containers)Moderate, more compact stack
Vector / AI searchNative via pgvectorNot native, must be externalized
Ideal forRelational apps, RAG, advanced SQLDocument-oriented mobile/web apps
Learning curveComfortable if you know SQLFast for front-end/mobile developers

Update Supabase with caution: since the images are versioned in the docker-compose.yml, always take a full pg_dump and a VPS snapshot before a docker compose pull && docker compose up -d. Some version upgrades touch the internal schema of the services. For production, isolate Postgres on a dedicated high-IOPS volume and enable pgvector from the start if you plan on semantic search: adding it later requires a schema migration.

Self-host your Supabase backend

The ServOrbit Cloud VPS with a preconfigured Docker template and generous RAM hosts the entire Supabase stack: Postgres, Auth, Storage, and API, over HTTPS.

Need help?

Browse our help center and FAQ, or write to our team — support in French, English and Arabic.