// COST ALERTS

Your app went viral.
Your bill went with it.

You built a Lovable app. It got posted on Twitter. Traffic spiked 100x. Your Cloudflare bill went from $5 to $500 overnight. Cloudflare's dashboard didn't tell you for 15 minutes — by then, the damage was done. FlareLog alerts you in real-time, before the invoice lands, before you panic.

How vibe coders get surprise bills

KV write loop

Your AI generated a loop that writes to KV on every request instead of caching. 100k requests = 100k KV writes = $5 in one day. You didn't know KV writes cost money.

D1 query per request

Your app runs a D1 query on every page load instead of caching the result. Viral traffic = millions of D1 row reads. Cloudflare charges per-row-read. Surprise.

Durable Object fan-out

Your WebSocket app creates a new Durable Object per connection. 10k connections = 10k DOs = 10k the cost. The AI didn't mention hibernation.

R2 upload storm

Your file upload feature stores every file in R2. Class A operations (writes) cost $4.50/million. A bot hitting your upload endpoint 1000 times = $4.50 gone in minutes.

FlareLog alerts you before the invoice

FlareLog's Tail Worker estimates the cost of every request in real-time. When your spend crosses a threshold you set, we ping you instantly:

  • - Slack notification with the spike source (which endpoint, which resource)
  • - Discord webhook for team alerts
  • - Custom HTTP webhook for PagerDuty / email / whatever
  • - Daily spend summary so you always know where you stand
  • - Rate-of-change alerts ("KV writes spiked 5x in 10 min")

The 15-minute lag problem

Cloudflare's own dashboard updates cost metrics with a 15-30 minute delay. That means:

2:00 AM — Your app goes viral. KV writes spike 100x.
2:00 AM — FlareLog detects the spike. Alerts Slack instantly.
2:01 AM — You wake up. You fix the caching bug. You deploy.
2:15 AM — Cloudflare's dashboard finally shows the spike.
2:16 AM — You already fixed it 15 minutes ago.

Set up cost alerts in 3 steps

# 1. Deploy the Tail Worker (if you haven't already)
#    See /vibe-coding/crash-capture for instructions

# 2. Set your alert webhook
wrangler secret put ALERT_WEBHOOK_URL
# Paste your Slack/Discord webhook URL

# 3. Enable cost tracking in your Tail Worker config
# In wrangler.toml:
# [vars]
# TRACK_COST = "true"
# DAILY_SPEND_LIMIT = "5"  # alert me at $5/day

FAQ

How does FlareLog know my Cloudflare costs?

FlareLog's Tail Worker estimates costs based on the execution outcome of each request — Worker invocations, KV reads/writes, R2 operations, D1 queries. We use Cloudflare's public pricing to calculate real-time cost estimates. The estimates are approximate but close enough to catch runaway spending before it hits your invoice.

What's the '15-minute lag'?

Cloudflare's own dashboard updates cost metrics with a 15-30 minute delay. If your app spikes at 2:00 AM, you won't see it in Cloudflare until 2:15-2:30 AM. FlareLog alerts you within seconds because the Tail Worker processes each request in real-time.

Can I set a custom alert threshold?

Yes. Set a daily spend limit (e.g., $5/day) and FlareLog will ping your Slack/Discord/webhook when you cross it. You can also set rate-of-change alerts (e.g., 'alert me if KV writes spike 5x in 10 minutes').

Does this work if I'm on the Cloudflare free tier?

Yes. FlareLog tracks your usage against the free tier limits (100k Worker requests/day, 100k KV reads/day, etc.) and alerts you before you hit the cap. If you're on the paid plan, it tracks against your included + billable usage.

Never get a surprise Cloudflare bill again

Set up cost alerts