Supabase Free Tier to Self-Hosted: How We Cut API Latency by 98%

A data-driven writeup of how I migrate cloudjobs.io's database, auth, and storage off Supabase's free tier onto an existing $5.35/mo VPS, with real before/after latency numbers.

Last Updated: November 2026

Over the past week, we moved cloudjobs.io from Supabase off the free tier and onto the VPS that already hosted the site. Median API latency dropped from ~209ms to ~4ms. This post covers how we did it and what the results were.


Why We Left

Two things pushed us off the managed version:

  • The 500MB database cap. Our Postgres database was around 450MB and growing. Even trimming analytics, rolling up old data, and archiving, we consistently hit the limit. 500MB is generous-ish for a free tier, but it's not a lot of space. We had plenty to spare.
  • Latency. Supabase free tier runs on shared compute. Our edge logs showed p50th percentile origin times spiking past 16 seconds during busy windows. C'mon. 16 seconds for a database response?

I had already rolled up analytics data into a separate table, but the main database was still growing. We would have to move soon either way. But the latency was bugging me too. Supabase is amazing technology and we're extremely grateful; it almost felt rude to abuse their free tier when we already had a VPS that could handle the workload up and running.


The Before Times

Supabase logs record origin_time for each request. This is the amount of time it took for their backend to respond. I pulled the last 24 hours of logs and filtered to our traffic.

In the 17 hours before cutover, the app made ~95,000 PostgREST calls:

Endpoint Requests Avg p50 p95 Max
/rest/v1/* (all) 94,628 274ms 89ms 580ms 27.5s
/rest/v1/jobs 35,800 409ms 112ms 1,173ms n/a
/rest/v1/sessions 6,099 673ms 88ms 1,920ms n/a
/rest/v1/questions 834 711ms 125ms 1,980ms n/a
/rest/v1/rpc/increment_bot_hit 48,614 104ms 79ms 144ms n/a
/storage/v1/* 214 453ms 473ms 927ms n/a
/auth/v1/* 176 346ms 105ms 1,877ms n/a

Hourly Supabase API request volume and origin latency in the 24 hours before cutover

I noticed two patterns:

  • A nightly batch window. Between 01:00–06:00 UTC (our GitHub Actions crons), we pushed 8,000–19,000 requests/hour with healthy ~100–160ms averages. Daytime interactive traffic was consistently slower: 200–550ms on average, with the 95th percentile (p95) frequently over 1 second.
  • Tail latency was brutal. The worst hour averaged 3,267ms with a p95 of 16,970ms.

Per-endpoint request volume vs p95 latency for app-server traffic

pg_stat_statements told the same story from the database side: 15.5 million queries, ~34 hours of cumulative execution time. Our hottest query, a jobs table SELECT, averaged 597ms across 18,533 calls.

The nighttime latency being measurably lower was not a surprise. A lot of internet users live in EST/PST timezones, that's when there's more traffic. But I was still surprised by the tail latency. A 16 second response time is comically high, and averaging 3+ seconds over an hour may be even worse.

Next, I isolated network vs. server time by benchmarking both backends from the VPS ~90 minutes after cutover (the old project was still live as a fallback, so this was a clean same-day comparison):

Request Hosted Supabase (before) Self-hosted (after) Speedup
GET /rest/v1/jobs TTFB 257ms avg / 582ms p95 4.0ms avg / 5.1ms p95 ~64x
POST /rest/v1/rpc/increment_bot_hit 160ms avg / 294ms p95 4.6ms avg / 7.7ms p95 ~35x
GET /auth/v1/health 127ms avg / 149ms p95 2.2ms avg / 2.8ms p95 ~58x

Before/after benchmark: TTFB for the same requests against hosted vs self-hosted Supabase

An engineer better than me (Claude) was able to see data on the TCP handshake.

With managed Supabase, requests typically took ~35ms to establish a connection and reach Cloudflare's edge. Then, there was another 90–220ms of processing on Supabase's side. After self-hosting, the application uses the local network to communicate with Supabase instead of making a round trip across the internet. The result is connection times around 0.4ms and total request times in the single-digit milliseconds.

Keep in mind that this is for each request; this becomes even more important when multiple users are making requests simultaneously. If requests take longer, concurrent requests can accumulate. While the requests wait in the queue, they continue to consume memory: memory, open sockets, connection slots, even worker processes (probably).


Methodology: How We Did It

1. Trim the stack, don't lift-and-shift

We didn't install the full Supabase docker-compose (which runs Studio, Realtime, imgproxy, Edge Functions, Supavisor, and more). Our compose file runs exactly five services:

  • supabase-db: Postgres 17.6
  • supabase-auth: GoTrue v2.197
  • supabase-rest: PostgREST v14.18
  • supabase-storage: storage-api v1.89.12 (file backend)
  • supabase-envoy: API gateway bound to 127.0.0.1:8000 only

You can read more about that here.

2. Keep the JWT secret identical

Since the self-hosted GoTrue uses the same JWT secret as the hosted project, we preserved all user sessions and refresh tokens. Nobody got logged out. We minted legacy HS256 anon/service-role JWTs from that secret and updated /opt/cloudjobs/env.

3. Migrate data with pg_dump, carefully

  • Dumped the hosted DB through the session-mode pooler (transaction mode breaks pg_dump).
  • Restored as supabase_admin, not postgres, because that role isn't a superuser in the supabase/postgres image. It cost us one failed restore.
  • Hit a real gotcha: the image's init migrations pre-create auth/storage schemas at the self-hosted version, which collided with the hosted dump's older structure. Fix: DROP SCHEMA auth CASCADE; DROP SCHEMA storage CASCADE;, restore those schemas from a targeted dump, then re-apply our public RLS policies and one foreign key that the cascade dropped.
  • Copied all storage objects (user files) with a small Node script.

4. Cut over atomically, keep the old project as rollback

The whole cutover was one env file edit (SUPABASE_URL=http://localhost:8000) and one systemctl restart. The edge logs show the cliff: ~20–90 requests/minute right up until 17:21 UTC, then 1–3/minute (those requests being my own benchmark traffic).

Requests per minute to the hosted Supabase project, showing the cliff at cutover

5. Verify, don't assume

Post-cutover checks:

  1. User count parity (the user count actually increased, a new user signed up within five minutes of the cutover)
  2. Refresh token count
  3. Storage object count
  4. RLS policy parity across all three schemas
  5. A signed-URL fetch through cloudjobs.io/storage/v1 returning 200

Everything checked out.


After: The Numbers

Metric Before (hosted free) After (self-hosted)
Median REST TTFB (benchmark) ~209ms ~4ms
p95 REST TTFB (benchmark) 582ms 5ms
Worst hourly p95 (edge logs) 16,970ms n/a (no tail yet)
Database size ~450MB 128MB (dump compacted bloat)
Stack memory n/a (shared) ~442MB of 3.8GB VPS
Monthly cost $0 (but capped) ~$0 incremental
Uptime responsibility Supabase Us

In the first ~90 minutes post-cutover, Envoy logged ~570 API requests, overwhelmingly 200/204, with a few transient 503s while backends finished their health checks. Every single one of the app's ~100k daily database calls now happens locally.


Should I Self-Host Supabase?

Good indicators:

  1. Your app server and database can live in the same region (or same server, ideally)
  2. Your dataset fits comfortably in a few GB
  3. You already have a VPS
  4. You're comfortable owning backups and patching

Bad indicators:

  1. You need Realtime, Edge Functions, or a managed dashboard
  2. You have compliance requirements that favor a hosted SLA
  3. Your database is large enough that you want managed connection pooling and read replicas

For a hobby project that turned into a real product with thousands of daily users, the trade was obvious: ~98% lower API latency, no usage caps, and no added cost. I'm sure there are plenty of products with three-tier architectures that could dramatically cut cost and latency by self-hosting. If that sounds like you or your team, consider it. I hope this was useful!


Conclusion

If you're launching a product or proof-of-concept, the Supabase free tier is a good place to start. If you're serving thousands of visitors every day and your database is between 300MB and a few GB, consider self-hosting. There's no reason to let empty space on your server go to waste, especially if that space could be turned into faster responses and lower costs.

This is just one case study, but our median API call dropped from 209ms to 4ms for every user on every page load.

John Mehler

Written by John Mehler

Founder & Lead Engineer at CloudJobs.

John is a senior DevOps engineer with more than a decade of experience at Google, Microsoft, Deloitte, and a boutique private equity fund. He currently holds the CISSP, AWS Solutions Architect, Microsoft DevOps Engineer Expert, Security+, and Terraform Associate credentials. He previously held the Google Cloud Professional Cloud Architect and Azure Solutions Architect Expert.

← Back to Insights