· Engineering
Product analytics without ClickHouse: one Durable Object per project, and what it costs
Why FlarePanel keeps each project’s events in its own Durable Object instead of a ClickHouse cluster, what that costs at 1 and 10 million events a month, and where the design has limits.
By FlarePanel team
Most open-source product analytics tools store events in ClickHouse. OpenPanel, which FlarePanel is forked from, does too, next to Postgres, Redis and Redpanda. FlarePanel replaces all four with Cloudflare services. The central choice is that every project gets its own Durable Object, and that object is the project’s database. This post explains why, what it costs, and where it stops.
Why not a ClickHouse cluster
ClickHouse is excellent at scanning billions of rows. It is also a server you have to run, size, back up and upgrade, and it costs money when nobody is looking at a dashboard. For most sites that use a self-hosted analytics tool, the data per project is small and the traffic is uneven: busy at noon, silent at night.
A Durable Object fits that shape. It is a small single-threaded actor with its own SQLite database. It exists only while it has work, it runs near the traffic, and Cloudflare stores its data. One object per project means one project’s spike never slows another, and an idle project uses no compute at all.
What one project’s object holds
- Events as gzip-compressed JSON chunks, one row per group commit. These are the source of truth.
- Daily rollups: visitors as a HyperLogLog sketch, sessions, bounces, duration, page views and revenue, plus per-day counts by page, source, place and device. The overview reads these instead of scanning events.
- Sessions and profiles, checkpointed so a restart does not lose them.
Around it: R2 keeps a full raw archive, one file per project and hour. D1 holds accounts, projects and settings. Queues and a Cron Trigger that runs every minute handle scheduled jobs.
Group commit: how one object keeps up
A single-threaded object cannot write one row per event at high traffic, so it does not. Incoming events are collected and written together:
commit when any of these is true:
200 events are waiting
500 ms have passed since the first one arrived
the batch is about to pass 1 MB of raw JSONThe tracking request is answered only after its group is stored, so a 200 means the event is saved. At low traffic that can take up to half a second; the browser does not wait on it to render anything. At steady traffic, storage writes stay well below one row per event. Rollups stay in memory and are written at checkpoints every few minutes; after a restart, anything newer is rebuilt from the chunks.
What it costs
Each tracking request is one Worker request and one Durable Object request. From a short sample of our own production API, a warm tracking request used about 1 ms of CPU, and the first request after a cold start about 60 ms. The estimate below assumes 5 ms to leave room.
One project, Workers Paid plan, 30-day month
1M events 10M events
Workers Paid plan $5.00 $5.00
Worker requests $0 ~$0.02
Worker CPU $0 $0.40
Durable Object requests ~$0.15 ~$1.50
Durable Object duration $0 $0
Rows written $0 $0
Total ~$5.15 ~$7Beyond that, each extra million events adds about $0.30 for Worker requests, $0.10 for CPU and $0.15 for Durable Object requests: roughly $0.55 per million, plus storage.
Duration is the part people worry about, so here is the upper bound. An object that never sleeps for a whole 30-day month uses 2,592,000 seconds × 128 MB = 331,776 GB-s. The plan includes 400,000 GB-s, so even one project busy around the clock stays inside it. Each further project that busy can add up to about $4.15. A quiet project costs nothing: once its sessions end, no alarm runs and the object sleeps.
The full table, storage prices and the assumptions are in the docs: What it costs on Cloudflare. Check Cloudflare’s current pricing pages before you rely on the numbers.
Where the design has limits
- One object per project is one writer. A project’s write throughput is bounded by what a single object can do. Group commit is how FlarePanel stays inside that bound; a very large single project would hit it before a sharded ClickHouse cluster would.
- Long ranges read the archive. The object keeps 90 days of raw events by default. Reports that reach further back read hourly files from R2, at most 3,000 files per report, so very long ranges on very busy projects show what was read.
- No Workers Free plan. The API bundle is about 4.6 MB compressed, above the Free plan’s 3 MB limit.
- Ad-hoc SQL over everything is not what this layout is for. Reports are built from rollups and chunk scans, not arbitrary queries across all projects.
If those limits matter more than having no servers, FlarePanel also runs on your own machine with Docker, and that version uses ClickHouse.
Try it
The code is on GitHub (AGPL-3.0). The architecture page lists every table, and the deploy guide puts it on your own Cloudflare account with two Deploy to Cloudflare buttons. Or create a project on FlarePanel Cloud, from $1 a month.
Questions
- Can you run product analytics without ClickHouse?
- Yes. FlarePanel keeps each project’s events in its own Cloudflare Durable Object with a SQLite database, keeps daily rollups next to them, and archives raw events to R2. There is no ClickHouse, Postgres or Redis to run.
- What does self-hosted FlarePanel cost on Cloudflare?
- About $5.15 a month for one project with 1 million events, and about $7 for 10 million, on the $5 Workers Paid plan. Each extra million events adds roughly $0.55, plus storage. These are estimates from Cloudflare’s published prices.
- Does FlarePanel run on the Workers Free plan?
- No. The API bundle is about 4.6 MB compressed, above the Free plan’s 3 MB limit, so self-hosting needs Workers Paid.