---
title: "Deploy Supabase"
description: "Self-hosted Supabase: Postgres, Auth, REST, Realtime, Storage, Studio"
category: "Storage"
url: https://railway.com/deploy/supabase-1
---

# Deploy Supabase

Self-hosted Supabase: Postgres, Auth, REST, Realtime, Storage, Studio

**[Deploy Supabase on Railway](https://railway.com/template/supabase-1)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/supabase-1/manifest.json

- **Creator:** My Projects
- **Category:** Storage

## Template content

### Supabase https://cdn.jsdelivr.net/gh/selfhst/icons/svg/supabase.svg

- **Image:** caddy:2.10.2-alpine
- **Start command:** `/bin/sh -c 'printenv GATEWAY_RUN_SH > /tmp/run.sh; exec /bin/sh /tmp/run.sh'`
- **Health check:** /gateway-health
- **Public domain:** Yes

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** supabase/postgres:17.6.1.136
- **Start command:** `/bin/sh -c 'printenv POSTGRES_INIT_SH > /tmp/run.sh; exec /bin/sh /tmp/run.sh'`

### Auth https://cdn.jsdelivr.net/gh/selfhst/icons/svg/supabase.svg

- **Image:** supabase/gotrue:v2.197.0
- **Start command:** `/bin/sh -c 'printenv AUTH_RUN_SH > /tmp/run.sh; exec /bin/sh /tmp/run.sh'`

### REST https://cdn.jsdelivr.net/gh/selfhst/icons/svg/supabase.svg

- **Image:** postgrest/postgrest:v14.18

### Realtime https://cdn.jsdelivr.net/gh/selfhst/icons/svg/supabase.svg

- **Image:** supabase/realtime:v2.148.3
- **Start command:** `/bin/bash -c 'printenv REALTIME_RUN_SH > /tmp/run.sh; exec /bin/bash /tmp/run.sh'`

### Storage https://cdn.jsdelivr.net/gh/selfhst/icons/svg/supabase.svg

- **Image:** supabase/storage-api:v1.89.12
- **Start command:** `/bin/sh -c 'printenv STORAGE_RUN_SH > /tmp/run.sh; exec /bin/sh /tmp/run.sh'`
- **Health check:** /status

### Meta https://cdn.jsdelivr.net/gh/selfhst/icons/svg/supabase.svg

- **Image:** supabase/postgres-meta:v0.100.0

### Studio https://cdn.jsdelivr.net/gh/selfhst/icons/svg/supabase.svg

- **Image:** supabase/studio:2026.11.02-sha-a05e7ec
- **Start command:** `/bin/sh -c 'printenv STUDIO_RUN_SH > /tmp/run.sh; exec /bin/sh /tmp/run.sh'`
- **Health check:** /api/platform/profile

## Documentation

# Deploy and Host Supabase on Railway

Supabase is an open-source Firebase alternative built on Postgres. It gives you a Postgres database with an auto-generated REST and GraphQL API, user sign-up and login, file storage, realtime subscriptions and a web dashboard (Studio) to manage it all. Apps talk to it with the `supabase-js` client or any HTTP client, and Row Level Security in Postgres decides what each user can read and write.

## About Hosting Supabase

Self-hosted Supabase is a set of services around one Postgres database: Auth (GoTrue), REST (PostgREST), Realtime, Storage, Postgres Meta and Studio, behind an API gateway that checks API keys. Supabase's docker-compose setup expects you to generate a JWT secret, sign the anon and service_role keys with it, and paste them into every service. It also mounts several SQL files into Postgres on first start and shares volumes between containers, which Railway doesn't allow.

This template does all of that for you. Every secret is generated at deploy time, the API keys are derived from the JWT secret when each service starts, and the database is set up on first start with Supabase's own SQL. You get one public URL, a publishable key and a secret key, ready for `supabase-js`.

## Common Use Cases

- Backend for a web or mobile app: database, REST API, auth and file uploads in one place
- Moving off hosted Supabase or Firebase to keep data on your own infrastructure
- Internal tools and dashboards on Postgres with row-level access rules
- Realtime features such as chat, live dashboards and presence
- Prototypes that need sign-up, login and storage without writing a backend

## Dependencies for Supabase Hosting

- Supabase Postgres 17 (Postgres with Supabase's extensions and roles)
- Caddy, as the API gateway in front of every service

### Deployment Dependencies

- Supabase: https://github.com/supabase/supabase
- Self-hosting guide: https://supabase.com/docs/guides/self-hosting/docker
- Docker setup: https://github.com/supabase/supabase/tree/master/docker
- Client libraries: https://supabase.com/docs/reference/javascript

### Implementation Details

**What you set:** nothing. Database password, JWT secret, API keys, Studio password and encryption keys are generated. Optionally set `SITE_URL` on the Auth service to your app's URL.

**After deploy:**

1. Wait 2 to 4 minutes for the first start while Postgres creates the Supabase schemas.
2. Open the `Supabase` service. `SUPABASE_URL`, `SUPABASE_PUBLISHABLE_KEY` and `SUPABASE_SECRET_KEY` are in its variables.
3. Open the URL and log in to Studio with `DASHBOARD_USERNAME` and `DASHBOARD_PASSWORD`.
4. Create tables in Studio, turn on Row Level Security and add policies.
5. In your app: `createClient(SUPABASE_URL, SUPABASE_PUBLISHABLE_KEY)`.

**This template:**

- Runs the official Supabase images: Postgres 17.6, Auth v2.197, PostgREST v14.18, Realtime v2.148, Storage v1.89, Postgres Meta v0.100 and Studio, all pinned
- Generates every secret and derives the legacy anon and service_role JWTs from the JWT secret on start, so nothing has to be generated by hand or on an external website
- Gives you the new opaque keys (`sb_publishable_...`, `sb_secret_...`); the gateway swaps them for JWTs as hosted Supabase does. The legacy JWT keys work too
- Puts Studio behind a login; REST, Auth, Realtime and the database metadata API need an API key, and admin endpoints need the secret key
- Sets up Postgres on first start with Supabase's own SQL (roles, Realtime, webhooks, JWT settings) and keeps the Vault encryption key in a variable
- Waits for Postgres before starting Auth, Storage and Realtime, so the first deploy needs no manual redeploys
- Stores the database, uploaded files and Studio's saved SQL snippets on volumes
- Exposes Postgres over a TCP proxy for migrations, `psql` and the Supabase CLI, with a generated password

**Notes:** Edge Functions, the log explorer (Logflare/Vector), image resizing (imgproxy) and the connection pooler (Supavisor) are not included. New email users are confirmed automatically until you set SMTP on the Auth service and set `GOTRUE_MAILER_AUTOCONFIRM` to `false`. Sign-up is open to anyone with the publishable key, as in Supabase; set `GOTRUE_DISABLE_SIGNUP` to `true` to close it.

## Why Deploy Supabase on Railway?

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.


## Similar templates

- [RustFS | (Just Updated) S3 Object Store, Public URL and Keys Set](https://railway.com/deploy/rustfs-or-just-updated-s3-object-store-p) — S3-compatible object store, keys and public URL preset, volume kept
- [TimescaleDB](https://railway.com/deploy/timescaledb-railway-template) — A PostgreSQL-based time-series database for analytics on Railway.
- [Garage S3 Storage](https://railway.com/deploy/garage-s3-storage) — Ultra-light S3 server: fast, open-source, plug-and-play.

Open this page in a browser: https://railway.com/deploy/supabase-1
