Deploy Supabase

Self-hosted Supabase: Postgres, auth, storage & edge functions

Deploy Supabase

Just deployed

Just deployed

/var/lib/postgresql/data

/app/snippets

/var/lib/storage

Deploy and Host self hosted Supabase (Open-Source Firebase Alternative) on Railway

This Railway template gives you the full open-source Supabase stack in one click with zero deploy-time input. It runs 9 services with pinned images, generated secrets, and verified healthy on a fresh deploy. You get Postgres, Auth, Realtime, Storage, Edge Functions, Studio, and the public gateway.

About Hosting Supabase open-source software on Railway (self hosted Supabase template)

The template runs nine services: supabase gateway (Envoy v1.39.1, port 8000, routes all Supabase APIs and Studio behind HTTP basic auth), db (supabase/postgres 17.6.1.136, volume, init SQL for roles, realtime, webhooks, JWT), auth (gotrue v2.196.0), rest (postgrest v14.17), realtime (v2.134.10), storage (v1.74.0, file backend volume, 50 MB limit, image transformation off), meta (postgres-meta v0.99.0), functions (edge-runtime v1.76.2, main router and hello example), and studio (2026.09.07 dashboard, volume for snippets and function files).

Railway generates JWT_SECRET, POSTGRES_PASSWORD, DASHBOARD_PASSWORD (username supabase), PGSODIUM_ROOT_KEY, and encryption keys. The anon and service_role API keys derive from JWT_SECRET at start by every service, so they always match. The gateway logs print the Supabase URL and anon key. Email signup is on, autoconfirm on (no SMTP), phone auth off, anonymous users off, PostgREST exposes public, storage, graphql_public with max 1000 rows.

After deploy, open the supabase service domain, log into Studio with supabase and DASHBOARD_PASSWORD from the supabase service variables, create tables, enable Row Level Security, copy the anon key from gateway logs, and use supabase-js with the public URL.

Why Deploy Supabase, the Firebase alternative on Railway (Railway Free Trial)

Self-hosted Supabase replaces proprietary Firestore with Postgres, giving you SQL, joins, transactions, and full data ownership. The Railway template removes docker compose edits, secret rotation scripts, and version drift. Start with the 5 USD trial, then scale each service independently.

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Supabase on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

Railway vs Other Hosting Providers and VPS for Supabase self hosting

ProviderStrengths for Supabase self-hostingWeaknesses or notes
DigitalOceanCheap VPS, simple droplets, good docs. Run docker compose yourself.Manual setup, secret rotation, no per-service scaling.
AWSECS/EKS autoscaling, IAM secrets, RDS option.High complexity, costs can balloon, harder logs.
HetznerVery cheap dedicated servers, great price-to-RAM.No managed containers by default, manual security.

Common Use Cases for hosted Supabase

Self-hosted Supabase fits any app needing Postgres plus auth, realtime, storage, and edge functions. Typical uses: mobile or web backends, SaaS with Row Level Security, internal tools using Studio, realtime chat or collaboration, and file uploads. You can run raw SQL, use Postgres extensions, and connect BI tools directly.

Dependencies for Supabase Docker hosted on Railway

The stack depends on Postgres 17 plus 8 companion services over the internal Railway network. All image versions are pinned by tag and digest, so redeploys never pull a newer major silently. The template creates two persistent volumes: one for Postgres data, one for storage files and Studio snippets. Secrets are shared via Railway variables. Only the gateway needs a public domain; other services stay private.

Deployment Dependencies for Managed Supabase Service (Postgres Backend)

Managed Supabase Cloud means depending on Supabase's infrastructure for Postgres, auth, storage, and edge functions. Self-hosting on Railway replaces that with your own Postgres container and upstream open-source services. The only external dependency you might add is SMTP for email. Railway provides TLS on the default domain.

Implementation Details for Supabase (Using official Supabase docker images)

Every service runs an official upstream image; db, storage, studio, functions, and the gateway add thin Railway wrappers on top. db runs supabase/postgres:17.6.1.136 with init scripts creating roles (authenticator, anon, service_role, supabase_admin). auth runs gotrue:v2.196.0 and derives JWT keys from JWT_SECRET. rest runs postgrest:v14.17 exposing public, storage, graphql_public. realtime runs v2.134.10 with logical replication.

How does Supabase compare against other backend platforms

Supabase vs Firebase

  • Firebase: Google's proprietary BaaS with NoSQL Firestore and vendor lock-in. Supabase is open source (Apache-2.0) on Postgres with SQL, joins, constraints, and self-hosting.

Supabase vs Appwrite

  • Appwrite: Open-source (BSD-3) BaaS on MariaDB, abstracting the database. Supabase exposes Postgres directly, with stronger SQL tooling and extensions. Appwrite self-hosts as one container but is less flexible for raw SQL.

Supabase vs PocketBase

  • PocketBase: Single Go binary with SQLite (MIT), ideal for small apps. Supabase is a multi-service Postgres stack with realtime, storage, edge functions, and row-level security. PocketBase is lighter but lacks Postgres features.

Supabase vs Neon

  • Neon: Serverless Postgres only, no auth, storage, or functions. Supabase includes those on top of Postgres. If you only need a database, Neon is great. For a full backend, Supabase is complete.

How to use Supabase (the OSS Postgres backend)?

After deploy, open the supabase service domain, enter basic auth (supabase / DASHBOARD_PASSWORD) to reach Studio. Create a table, enable Row Level Security, write a policy. Copy the anon key from gateway logs. In your frontend, install supabase-js, create a client with the public URL and anon key, then sign up users, insert rows, subscribe to realtime, upload files, call edge functions. Never expose the service_role key in a browser.

How to self host Supabase on other VPS Services (Supabase self hosting guide)

Upstream provides a docker compose setup for any VPS; the Railway template automates this. For manual setup, you need Docker, Docker Compose, at least 4 GB RAM, and a Linux VPS with a public IP.

Clone the Repository

Run git clone --depth 1 https://github.com/supabase/supabase and cd supabase/docker. This gives you the official compose file and example env.

Install Dependencies

Install Docker and Docker Compose via your package manager. On Ubuntu, run sudo apt update then sudo apt install docker.io docker-compose-v2.

Configure Environment Variables

Copy .env.example to .env. Change every secret: POSTGRES_PASSWORD, JWT_SECRET, ANON_KEY, SERVICE_ROLE_KEY, PGSODIUM_ROOT_KEY, and others. Use long random strings. Set GOTRUE SMTP variables if you want email and turn off autoconfirm.

Start the Supabase Application

Run docker compose pull then docker compose up -d. Check docker compose ps for healthy services. Access Studio at http://your-domain:8000 with dashboard credentials. Put Nginx or Caddy in front for HTTPS.

Official Pricing of Supabase (Supabase pricing)

Supabase Cloud: Free tier (2 projects, 500 MB database, pauses after 1 week inactivity), Pro from 25 USD/mo per org including 10 USD compute credits, Team 599 USD/mo, Enterprise custom. Self-hosting is free (Apache-2.0); you pay only for infrastructure.

Supabase cloud vs self hosted comparison (Pricing, features, costs, and more)

Supabase Cloud gives managed backups, branching, multiple projects, platform UI, global edge network. Self-hosted gives full control, no per-project fees, own hardware, direct database access. You lose branching and managed recovery, but you handle backups, monitoring, scaling. Self-hosting on Railway is often cheaper at low to medium scale.

Monthly cost of self hosting Supabase on Railway

On Railway, the nine services at light use cost about 20 to 40 USD per month. Postgres with a volume is the largest cost, followed by gateway and Studio. Costs rise with database size or RAM needs. The 5 USD trial lets you test before paying.

System Requirements for Hosting Supabase on a VPS

Upstream recommends at least 4 GB RAM. CPU needs are modest but realtime and functions can spike. Start with 20 GB disk. On Railway, each service has its own limits, so give the database 1 GB RAM and scale individually. For hundreds of concurrent users, consider 8 GB total.

Frequently Asked Questions (FAQs)

Is self-hosted Supabase really free?

Yes, the software is Apache-2.0 and you pay only for infrastructure. The Railway template has no license fees.

Do I need to configure SMTP for email?

Not to start. Autoconfirm is on, so test signups work without SMTP. For real password reset or invite emails, set GOTRUE SMTP variables and turn autoconfirm off.

How do I get the anon key?

Open the supabase gateway service logs in Railway. Its deploy logs print the public URL and anon key when the gateway starts. You can also derive it from JWT_SECRET.

Is this stack production-ready?

It uses the same upstream images and config as the official guide, with pinned versions and generated secrets. Many run it in production, but you handle backups, monitoring, and scaling.

What is missing compared to Supabase Cloud?

Cloud-only features include branching, managed backups, multiple projects, platform billing/team UI, and Logflare analytics. Core database, auth, realtime, storage, and edge functions are all present.


Template Content

More templates in this category

View Template
NEW
RustFS | (Just Updated) S3 Object Store, Public URL and Keys Set
S3-compatible object store, keys and public URL preset, volume kept

SuperSlowSloth
0
View Template
NEW
TimescaleDB
A PostgreSQL-based time-series database for analytics on Railway.

Rakit
1
View Template
Garage S3 Storage
Ultra-light S3 server: fast, open-source, plug-and-play.

PROJETOS
8