Tutorial · 8 min read

How to Self-Host a Supabase Proxy on Cloudflare Workers (Free)

Complete walkthrough: from zero to a deployed Supabase reverse proxy on your own Cloudflare account. Covers every step including testing REST, Auth, and Realtime.


Prerequisites

You need two things before starting:

  • Node.js 18 or higher — check with node -v. Install from nodejs.org if needed.
  • A Cloudflare account — sign up free at dash.cloudflare.com. No credit card required.

You also need your Supabase project URL. Find it in your Supabase Dashboard under Settings → API → Project URL. It looks like https://abcdefgh.supabase.co.

1

Run the CLI

Open your terminal and run:

$ npx create-jiobase

This downloads and runs the setup wizard. On first run, npm may ask to confirm the package install — type y and press enter.

2

Enter your Supabase URL

The wizard asks for your Supabase project URL first. Paste the full URL or just the subdomain — the CLI normalizes it automatically:

  Step 1 of 5 -- Your Supabase project URL
   Supabase project URL
  |  https://abcdefgh.supabase.co
  

The CLI validates the URL format. You can enter abcdefgh.supabase.co without the protocol and it will add https:// automatically.

3

Configure services and CORS

Next, the wizard asks about CORS origins and which Supabase services to enable:

  • Allowed origins: Use * for development (allows all domains) or list specific origins like https://myapp.com
  • Services: Toggle which Supabase services the proxy should handle. All 6 are enabled by default (REST, Auth, Storage, Realtime, Edge Functions, GraphQL). Deselect any you don't use.
  • Worker name: Becomes your proxy URL: https://<name>.<you>.workers.dev
4

Deploy

The CLI scaffolds your project, installs dependencies, and asks if you want to deploy immediately. If you're not logged into Cloudflare yet, it opens wrangler login in your browser for OAuth authentication.

After deployment, you'll see your proxy URL:

 Project scaffolded at ./supabase-proxy
 Dependencies installed
 Deployed to https://supabase-proxy.you.workers.dev
5

Update your app code

Replace your Supabase URL with the proxy URL. Only one line changes:

supabaseClient.ts
// Before (blocked by ISP)
const supabase = createClient('https://abc.supabase.co', key)
// After (works everywhere)
const supabase = createClient('https://supabase-proxy.you.workers.dev', key)

Your anon key, service role key, and all RLS policies stay exactly the same. Only the base URL changes.

Testing your proxy

Verify the proxy works with a few quick tests:

REST API

curl https://supabase-proxy.you.workers.dev/rest/v1/ \
  -H "apikey: YOUR_ANON_KEY"

Health check

curl https://supabase-proxy.you.workers.dev/__health

WebSocket (Realtime)

If you enabled the Realtime service, test WebSocket connectivity by using the Supabase client in your app. Subscriptions should connect through wss://supabase-proxy.you.workers.dev/realtime/v1/websocket.

Troubleshooting

"Wrangler CLI not found"

The CLI offers to install wrangler globally. If that fails due to permissions, try sudo npm install -g wrangler on macOS/Linux or run your terminal as Administrator on Windows. Alternatively, use npx wrangler from inside the project directory.

"Not authenticated"

The CLI runs wrangler login automatically. If it fails, run it manually: npx wrangler login. This opens your browser for Cloudflare OAuth.

Deploy failed

You can always deploy later by navigating to your project directory and running npx wrangler deploy. The project is a standard Cloudflare Workers project.

Next steps

  • Add a custom domain instead of the workers.dev URL
  • Restrict CORS to your production domains instead of *
  • Disable services you don't need for a smaller attack surface
  • Consider the managed JioBase service if you need analytics and rate limiting

Sunith VS

Written and verified by

Sunith VS

Building tools that help Indian developers ship without ISP interference. Creator of JioBase.