---
title: "Deploy Supabase Edge Functions"
description: "Self-hosted Deno edge functions next to your Postgres"
category: "Storage"
url: https://railway.com/deploy/deploy-supabase-edge-functions
---

# Deploy Supabase Edge Functions

Self-hosted Deno edge functions next to your Postgres

**[Deploy Supabase Edge Functions on Railway](https://railway.com/template/deploy-supabase-edge-functions)**

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

- **Creator:** onepush
- **Category:** Storage

## Template content

### realtime

- **Image:** supabase/realtime:v2.134.10@sha256:cbcc6a7986fc28b6dcffa798b077d5fb9c69cd25500371ab49147a86d7edbb03

### meta

- **Image:** supabase/postgres-meta:v0.99.0@sha256:9a079ac1c94d89629262822a4bd1902d5b1be4adb464e5a0a8fd078aaed72158
- **Health check:** /health

### studio

- **Image:** ghcr.io/onepush-dev/supabase-studio:2026.10@sha256:38b4da0f64779557c9e45ddaad54fb6fc13c43342b6a3735ebc4caa3f1d38134
- **Health check:** /api/platform/profile

### rest

- **Image:** postgrest/postgrest:v14.17@sha256:c9dc201e555f5d8e37e7f39cdd4df0229774996e213bfd7de8d10ac609030f2c

### supabase

- **Image:** ghcr.io/onepush-dev/supabase-gateway:2026.10@sha256:d7489fa86d5ea212547271e2fc5d29bcf8d04b8d7ab3c4f5db026feacee7fed9
- **Public domain:** Yes

### functions

- **Image:** ghcr.io/onepush-dev/supabase-functions:2026.10@sha256:1b6159cc1316fd11f26176cd7a0483e42dffb7642a2e20c1a816b07e357a8063

### auth

- **Image:** supabase/gotrue:v2.196.0@sha256:c0c25187a6b835e65a6f6e6c6b39d090e832d40e6de5186f2c038e0411944232
- **Health check:** /health

### db

- **Image:** ghcr.io/onepush-dev/supabase-db:2026.10@sha256:4936b9cfac0cb3899f7635423af568aa6c2274f9604aa3fcad0a54fd055ca1fc

### storage

- **Image:** ghcr.io/onepush-dev/supabase-storage:2026.10@sha256:d9018525e8cd4f28844b9392f22c9be52c3c4639d28c3f1afe123dca2a91c8c5
- **Health check:** /status

## Documentation

# Deploy and Host self hosted Supabase Edge Functions (Self-Hosted Supabase Edge Functions on Deno) on Railway

This template adds Supabase Edge Functions to a self-hosted Supabase stack on Railway. For Deno developers running functions beside their own Postgres.

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

This template runs the whole self-hosted Supabase stack, nine services in one project, data in a Postgres volume you own. Railway rebuilds on commit, wires private networking, and generates the JWT secret and derived keys.

## Why Deploy Supabase Edge Functions, the Supabase Cloud alternative on Railway (Railway Free Trial)

Supabase Cloud bills per org from 25 USD a month and runs your functions on their infrastructure; here the edge-runtime container sits next to your own Postgres, Auth and Storage on one Railway project, and you own the Dockerfile that builds it.

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 Edge Functions 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 Edge Functions self hosting

| Provider | What You Get with Railway | What You Get with the Other Provider |
| --- | --- | --- |
| DigitalOcean | Gateway logs print your URL and anon key; redeploy functions to ship a new folder. | A Droplet where you install Docker, clone Supabase, set every secret, and run docker compose. |
| AWS | Nine services on one project; anon and service_role keys derive from JWT_SECRET. | ECS or EC2 plus RDS and a load balancer; Postgres and the runtime are separate pieces. |
| Hetzner | Usage billing, about 20-40 USD/mo for nine small services at light use. | Cheap cores, but you own the compose file, backups, and Deno upgrades. |

## Common Use Cases for hosted Supabase Edge Functions

- **Webhook receivers:** a Stripe or GitHub endpoint that checks the signature, then writes the event into a Postgres table through the service role key, all inside one function at `/functions/v1/stripe-webhook`.
- **Small internal APIs:** endpoints that need the service role key server-side, so they bypass RLS safely without ever shipping that key to a browser.
- **Post-signup email:** a function that fires after an Auth signup, reads the new user, and calls your mail provider with a secret pulled from the functions service variables.
- **File work near Storage:** resizing an image or extracting text from a PDF right after upload, since the function runs beside the Storage API on the same stack.
- **Scheduled jobs:** pg_cron plus pg_net in Postgres calling a function URL on a timer, so cleanup and digest jobs stay inside the database you already run.

## Dependencies for Supabase Edge Functions Docker hosted on Railway

The functions service runs supabase/edge-runtime v1.76.2 from the template's functions/Dockerfile, which copies the functions directory into /home/deno/functions and starts the main router.

### Deployment Dependencies for Managed Supabase Edge Functions Service (Serverless Functions)

- The functions service built from functions/Dockerfile on supabase/edge-runtime v1.76.2.
- A functions folder with main/index.ts and the hello example, copied at build time.
- The supabase gateway on port 8000, routing /functions/v1 to functions.
- Shared JWT_SECRET and VERIFY_JWT, so the router checks the Authorization header before a worker runs.
- SUPABASE_URL, SUPABASE_PUBLIC_URL and SUPABASE_DB_URL as service variables; the main router derives the anon and service_role keys from JWT_SECRET.

### Implementation Details for Supabase Edge Functions (Using Supabase official docker image)

Add a function by putting a folder with an index.ts calling Deno.serve into your copy of the template source and letting Railway rebuild the functions service.

## How does Supabase Edge Functions compare against other ways to run server-side functions next to Postgres

### Self-hosted Supabase vs Supabase Cloud (Hosted Edge Functions)

- **Deploy model:** Cloud takes `supabase functions deploy`. Here a function is a folder copied into the edge-runtime image at build, so you fork and redeploy.
- **Latency:** Cloud runs near users in many regions. This is one container next to your Postgres: fast for database work, slower far away.
- **Where Cloud wins:** branch previews, per-deploy dashboards, and rollback without touching git.

### Supabase Edge Functions vs Cloudflare Workers (V8 Isolates)

- **Runtime:** Workers use V8 isolates with their own APIs. Edge Functions run Deno in your container, so `npm:` and `jsr:` imports need fewer rewrites.
- **Data path:** a Worker reaches Postgres over the public internet unless you add Hyperdrive. A function here uses `SUPABASE_DB_URL` on the same network.
- **Where Cloudflare wins:** global anycast, millisecond cold starts, and KV, R2 and Durable Objects.

### Supabase Edge Functions vs Vercel Functions (Serverless Functions)

- **Coupling:** Vercel functions live with a Vercel deployment. These share a stack with Auth and PostgREST, dispatched at `/functions/v1/NAME`.
- **Auth:** with Vercel you wire session checks. Here the router checks the JWT when `VERIFY_JWT` is true, before your code runs.
- **Where Vercel wins:** preview deploys per branch, edge caching, and image optimization.

### Supabase Edge Functions vs Firebase Cloud Functions (Google Cloud Functions)

- **Database:** Firebase functions orbit Firestore, a proprietary NoSQL store. These talk to ordinary Postgres with SQL and RLS.
- **Where Firebase wins:** managed triggers on document writes, built-in scheduling, no server to keep alive.

## How to use Supabase Edge Functions (the OSS backend platform)?

1. Open the supabase service deploy logs. The gateway prints the public URL and the anon key; copy both.
2. Call the bundled hello function with the anon key:

```bash
curl -H "Authorization: Bearer ANON_KEY" https://your-domain/functions/v1/hello
```

3. Fork or eject the template source so you own the functions folder.
4. Add functions/my-func/index.ts:

```ts
Deno.serve((req) => new Response("ok"));
```

5. Commit. Railway rebuilds the functions service from functions/Dockerfile.
6. Call it the same way. Swap in a user JWT if VERIFY_JWT is true:

```bash
curl -H "Authorization: Bearer ANON_KEY" https://your-domain/functions/v1/my-func
```

Always commit: edits made inside the running container vanish on redeploy.

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

The upstream repo is the fastest path to a working stack on a plain VPS, though it brings the whole self-hosted Supabase, not just the runtime.

### Clone the Repository

```bash
git clone --depth 1 https://github.com/supabase/supabase
cd supabase/docker
```

### Install Dependencies

Install Docker Engine and the Compose plugin, then confirm both respond. Budget at least 4 GB RAM for the full stack.

### Configure Environment Variables

```bash
cp .env.example .env
```

Change every secret in `.env`: `JWT_SECRET`, `POSTGRES_PASSWORD`, `ANON_KEY` and `SERVICE_ROLE_KEY` derived from it, plus the dashboard password. Leave `VERIFY_JWT` set to true unless you have a reason.

### Start the Supabase Edge Functions Application

```bash
docker compose pull
docker compose up -d
```

The functions container runs the main router, which sends `/functions/v1/NAME` to a worker per function and checks the JWT before dispatching.

## Official Pricing of Supabase Edge Functions (Supabase pricing)

Supabase Edge Runtime is open source and free to run yourself, so the only bill is the infrastructure. No per-invocation fee applies on this stack.

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

Same edge-runtime image, so features barely move. What changes is who owns deploys and logs.

### Monthly cost of self hosting Supabase Edge Functions on Railway

Supabase Cloud Pro starts at 25 USD/mo per org, after a Free tier that pauses projects after a week idle. It climbs as Postgres grows, but you pay once for Auth, Storage and Studio too. The 5 USD trial covers a first look.

### System Requirements for Hosting Supabase Edge Functions on a VPS

Upstream suggests at least 4 GB RAM for the full stack, and that holds here since edge-runtime is one container of nine. Workers are memory-capped, so a runaway handler won't starve Postgres.

## Frequently Asked Questions (FAQs)

### Can I deploy functions with the Supabase CLI?

No. supabase functions deploy targets Supabase Cloud projects, not this stack. Add a folder under functions/ in your copy of the template source and redeploy the functions service.

### How do I add secrets to a function?

Set them as Railway variables on the functions service and read them with Deno.env.get. Redeploy or restart so the router hands the new env to its workers.

### Can functions reach Postgres directly?

Yes. SUPABASE_DB_URL is set on the template, so you can open a client with npm:postgres. Most handlers just call PostgREST or supabase-js with the service role key instead.

### Is JWT verification on?

It follows VERIFY_JWT on the functions service. When it's true the main router rejects any request without a valid Authorization Bearer token before your code runs.

### What runtime version runs?

supabase/edge-runtime v1.76.2, pinned in the functions Dockerfile. Change the FROM tag and redeploy to move it.

### How do I see logs?

Read the functions service logs in Railway. console.log and console.error from your handler land there; Logflare analytics is not part of this stack.


## 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/deploy-supabase-edge-functions
