Supabase Realtime pricing: what you pay for, and when to self-host
Supabase Realtime pricing comes down to one rule: you pay per message, and a message is counted every time it’s delivered, not once per event. A Broadcast also counts once for the send. On paid plans, each million messages beyond the 5 million included costs $2.50, and the data those messages carry counts as egress too. So the bill follows fan-out, the number of subscribers each event reaches, and an app with many subscribers per topic can spend far more on Realtime than on its database.
We moved a real-time trading platform off hosted Realtime after it reached roughly $640 a day. Here’s what drove that number, and when running Realtime yourself pays off.
How Supabase Realtime billing works
Supabase charges for Realtime messages and peak connections. Free includes 2 million messages and 200 peak connections a month; Pro and Team include 5 million and 500. Above that, messages cost $2.50 per million, billed in whole million-message packages, and peak connections cost $10 per 1,000. Check Supabase’s pricing page for current numbers.
- Broadcast: one message for the send, plus one for every subscribed client that receives it. One broadcast to 4 listeners is 5 messages.
- Postgres Changes: one message per client listening to that change.
- Presence: counted as messages too.
Then there’s egress. Data Realtime pushes to clients counts toward your egress, $0.09 per GB on Pro beyond the included 250 GB. Across this client’s billing cycle, that egress came to about a fifth of the message charge.
Connections are usually the small line: for this client they cost under 1% of what messages did.
Supabase Realtime limits
Billing quotas and connection limits are different things. Pro includes 500 peak connections in its price, and its hard limit rises to 10,000 when you turn off the spend cap. Supabase’s published Realtime limits:
| Limit | Free | Pro | Pro, no spend cap | Team |
|---|---|---|---|---|
| Concurrent connections | 200 | 500 | 10,000 | 10,000 |
| Messages per second | 100 | 500 | 2,500 | 2,500 |
| Channel joins per second | 100 | 500 | 2,500 | 2,500 |
| Channels per connection | 100 | 100 | 100 | 100 |
Go past the messages-per-second limit and Supabase disconnects clients until throughput drops.
Postgres Changes vs Broadcast
Per delivery, they cost about the same: Broadcast adds one message for the send, Postgres Changes doesn’t. The real difference is database work. Postgres Changes checks every event against each subscriber’s access and processes changes on a single thread, so a change with 100 listeners means 100 authorization checks. Supabase recommends Broadcast at scale.
Postgres Changes is also the easiest way to pay for updates nobody sees: a broad subscription delivers every change to every listener, whether or not it’s on screen. In a smaller Lovable app we worked on, that made Realtime 45% of the running costs, until polling and narrower subscriptions cut it by about 90%.
Fan-out was the bill
The platform pushed live order book updates on one Broadcast topic per market, at most once a second while that market’s book changed. Two things multiplied every send:
- Bots subscribed to everything. API users’ trading bots joined every market topic, whether they traded it or not. Some hit the 100-channels-per-connection limit.
- Every message carried the full order book, not just what changed.
On the busiest day we measured, the app sent about 4.3 million messages and Supabase billed 316 million. Each message was billed about 74 times. Across the billing cycle, Realtime messages and the egress they caused made up roughly 90% of the project’s Supabase bill.
First, we bounded the publish pipeline
Before moving anything, we fixed publishing. One night, hosted broadcast latency climbed from about 30 ms to several seconds, and batches of 100 messages began timing out. The app kept market updates in an outbox and retried failed sends without limit, so the backlog grew until the query claiming due rows took about 70% of production database time.
We replaced it with a bounded buffer. Each topic holds at most one pending batch, new changes merge into it, and the publisher removes it before sending it once. Anything older than 30 seconds is dropped. Clients spot a gap from a revision number and refetch over the API. Realtime became a best-effort notification layer, with the database as the source of truth.
Self-hosting Supabase Realtime
Realtime is open source. We run it on a Hetzner cloud server with 4 dedicated vCPUs and 16 GB of memory, about $130 a month, behind Cloudflare’s proxy. The server’s firewall only accepts Cloudflare’s IP ranges. The main design choices:
- Its own Postgres. Realtime needs Postgres for its metadata and authorization checks, so it gets a local database holding none of the app’s tables. Never point a second Realtime at your production database: it would run migrations and replication on a schema hosted Realtime also manages.
- Claims-only authorization. The token the app mints lists the topics that user may join, and the server checks only those claims instead of querying app tables. The tradeoff: a revoked permission reaches new joins only when the token next refreshes, up to three hours here.
- The same signing secret as the Supabase project, so existing keys and tokens work on both servers during the move.
Self-hosted defaults are sized for a demo: 100 events a second, 100 joins a second, 200 concurrent users and one database connection per tenant. The events-per-second limit counts deliveries, so we raised it far enough that fan-out couldn’t close channels.
Load testing found two bottlenecks
We load-tested about 32,000 channels, then dropped every socket at once.
Stock Realtime collapsed. Its per-client channel limit keeps every channel of a tenant under one registry key, so each join scans the whole registry and cleanup grows quadratically, in one process whose backlog never drained.
With that fixed, authorization was next. Every join runs a database transaction, so 99.9% of channels took about two minutes to rejoin, delivery lag reached 15–22 seconds, and up to 183,000 messages were lost.
We added two patches behind flags: an Elixir authorizer that decides joins from the token’s claims (a port of our SQL policy, tested side by side with it), and a shortcut that lets the server’s own publishes skip the per-topic database write check. Then 99.9% of channels rejoined in 8.5 seconds, 95% of events arrived within 165 ms, and nothing was lost. A 4-hour soak held memory flat and CPU at 6–7%.
We reported all three problems upstream with reproductions: the registry cost, which Supabase’s Realtime team is now fixing in their own change, the write check with a fix, and the read authorization cost.
The cutover
- Dual-publish. The publisher sent every batch to both servers. Hosted stayed primary, and the self-hosted send got a one-second budget so it couldn’t slow the primary.
- Compare. A small tool subscribed to the same topics on both servers and diffed what arrived. Self-hosted delivered about 165 ms earlier at the median. Its few misses (0.34%) came from the publisher’s one-second budget, not the server.
- Flip clients with config. The browser’s Realtime URL is an environment variable, and bots get theirs from the app’s token endpoint, so browsers moved as tabs reloaded and bots on restart. Self-hosted became primary.
- Retire hosted. We stopped publishing to it, then suspended it through the Supabase Management API.
The result
Hosted Realtime went from roughly $640 a day to zero. The replacement costs about $130 a month for the server and about $50 a month for bandwidth: it sends about 1.4 TB a day, which Hetzner bills per terabyte beyond the included allowance. The same bytes as Supabase egress would cost over $120 a day.
When self-hosting is worth it
On the bill alone, a $130 server matches about 50 million messages a month of overage. But the server isn’t the real cost; the patches, load tests and staged cutover are. Self-hosting is worth it when:
- Realtime is a four-figure monthly line even after you’ve cut fan-out and payload size. This client was at 200–320 million messages a day.
- Most traffic is Broadcast sent from your server, which is the easiest kind to move.
- Someone on the team will own a server, its upgrades and its alerts.
If Realtime is in the low hundreds a month, fix fan-out and payloads instead. That cuts the bill either way.
What self-hosting costs you
- Operations. A server, proxy, certificates and firewall, with your project’s signing secret on the server.
- A fork. Every upstream upgrade means rebasing the patches, a 25-minute build and a staging deploy first. The access policy now exists twice, in SQL and in Elixir.
- Monitoring. A probe sends a private broadcast every five minutes and alerts after three failures. It doesn’t prove delivery, so we also compare delivered counts.
- Proxy reloads. A Caddy reload closes every WebSocket. supabase-js reconnects within a second; realtime-py 2.32 never reconnects from that close code and silently misses everything after. Proxy changes need a maintenance window and a notice to API users.
- Grant resets. Supabase’s own Realtime migrations reset grants on the
realtimeschema. On hosted, an automatic update once dropped a custom role’s access and every private channel join failed. Write policies on token claims, not custom roles, and re-apply them on every deploy.
How to check your own app
- Compare billed messages to messages you send. Supabase’s usage page shows the first; your logs show the second. The ratio is your fan-out.
- Search your code for
.channel(. For each, ask who subscribes and to how many topics. Clients that subscribe to everything are the usual culprits. - Measure payload size. Send what changed, or an ID the client can fetch, instead of the full object.
- Look for retry loops. Rejected joins that retry forever and publishers that retry without limit both cost money.
- Make channels private. Turn off public access in Realtime settings so topics can’t be joined with the public key alone. Our guide to row-level security covers the policies behind it.
If Realtime is the biggest line on your Supabase bill, our app rescue starts by finding which subscriptions you’re paying for and cutting the ones nobody needs.
