Praful Divani
← All writing

How a Cloudflare CDN cut my Firebase bill by up to 70%

Menu images were the biggest line on my Firebase bill. Putting Cloudflare in front of them cut load times and storage egress costs.

Praful Divani2 min read
CloudflareFirebasePerformance

The biggest line on my Firebase bill wasn't compute or the database. It was downloads.

menu.link is a digital menu platform. Restaurants upload photos of their dishes, diners scan a QR code and open the menu on their phone. Every one of those opens downloads the same images again, so a read-heavy product with 2.7M+ menu views adds up quickly.

The problem

All menu images live in Firebase Storage, and Storage charges for every byte that leaves it (egress). A public menu has no login, no personalisation and images that almost never change, yet each view fetched them from Storage again. I was paying again and again to deliver the same files.

It also made the page slower than it needed to be, because every image was a round trip to the storage bucket, however far the diner was from it.

The fix

I put a Cloudflare proxy in front of the public menu images and let it act as a CDN. After the first request for an image, Cloudflare keeps a copy at the edge and serves it from there. Firebase Storage only sees the first request, not every view.

Two things made this safe to do on a public page:

  • Images on a public menu are the same for everyone, so there is nothing per-user to leak into a shared cache.

The result

Menu pages load faster because images come from a nearby edge location. The bigger win was the bill. Cutting Storage egress brought the overall Firebase bill down by up to 70%.

What I would tell anyone doing the same

  1. Look at what you are actually paying for before optimising anything. For a read-heavy product, it was egress.
  2. If the content is public and the same for everyone, a CDN in front of it is one of the cheapest changes you can make.
  3. Decide up front how an updated file reaches users, because a cache that never refreshes is its own bug.
Open to select work

Hiring, or building something?

Whether it's a full-time role or a product that needs an engineer who can take it end to end, let's talk.

Praful Divani© 2026