Deploy Supabase
Self-hosted Supabase: Postgres, Auth, REST, Realtime, Storage, Studio
Supabase
Just deployed
Postgres
Just deployed
Just deployed
Just deployed
Realtime
Just deployed
Just deployed
Just deployed
Just deployed
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:
- Wait 2 to 4 minutes for the first start while Postgres creates the Supabase schemas.
- Open the
Supabaseservice.SUPABASE_URL,SUPABASE_PUBLISHABLE_KEYandSUPABASE_SECRET_KEYare in its variables. - Open the URL and log in to Studio with
DASHBOARD_USERNAMEandDASHBOARD_PASSWORD. - Create tables in Studio, turn on Row Level Security and add policies.
- 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,
psqland 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.
Template Content
Supabase
caddy:2.10.2-alpinePostgres
supabase/postgres:17.6.1.136GOTRUE_SMTP_HOST
SMTP server for confirmation, magic link and password reset emails
GOTRUE_SMTP_PASS
SMTP password
GOTRUE_SMTP_USER
SMTP user
ADDITIONAL_REDIRECT_URLS
Other allowed redirect URLs, comma separated
Realtime
supabase/realtime:v2.148.3OPENAI_API_KEY
Optional: enables the AI assistant and SQL generation in Studio
