Skip to content

About

Agent-first, open-source analytics that runs in your own Cloudflare account.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Dataflare

Open-source product analytics that lives in your Cloudflare account.
Web analytics, funnels and retention, session replay, feature flags and A/B tests. Deployed with one command, queried by your coding agent. Your data never leaves your account.

npm CI MIT licence

Live demo · Docs · Cost calculator · Comparisons

The Dataflare dashboard: visitors, page views, sessions and bounce rate against the previous period, a 30-day chart, and tables of pages, countries and devices.
npx dataflare-cli init

Or paste this into your coding agent:

Add Dataflare analytics to this project: run npx dataflare-cli init, track signups and purchases, then show me today's visitors.

Why Dataflare

  • No vendor. Dataflare is a Worker, a D1 database and an R2 bucket in your Cloudflare account. There is no Dataflare server, account or bill: you pay Cloudflare's list prices, which is $0 on Workers Free for small sites and the $5/month Workers Paid plan for most others (calculator).
  • Built for agents. dataflare init writes instructions, a skill and an MCP server config for your agent. Every query result carries its SQL and a dashboard link, and session replays come with a text transcript an agent can read.
  • Four tools, one event stream. Web stats, funnels/retention/trends on any property, session replay, and flags with Bayesian A/B testing. A funnel step links to the replays of the people who dropped out.
  • Small and readable. The browser SDK is about 4 KB gzipped. The Worker has one runtime dependency (zod). Every number in the dashboard can show the SQL behind it.
A funnel from visit to signup to payment, with conversion and drop-off at each step.

Funnels, trends and retention on any event

A session replay beside a timeline of clicks, a TypeError, a failed request and rage clicks.

Session replay with a transcript agents can read

An experiment where the test variant converts at 23.9% against 16.8% for control, with a 98% chance to beat control.

Flags and A/B tests with Bayesian results

The SQL editor with a query grouping events by name and the results as a table.

Read-only SQL behind every number

How it compares

Dataflare PostHog Google Analytics Plausible
Where your data lives Your Cloudflare account PostHog Cloud, or your servers Google Plausible Cloud (EU), or your servers
Source MIT MIT (some paid features separate) Proprietary AGPL-3.0
Session replay Yes, with agent transcripts Yes No No
Flags and A/B tests Yes Yes No No
Raw SQL Yes Yes BigQuery export No

Each comparison on the site says where the other product is the better choice: PostHog, Google Analytics, Plausible, Amplitude, Mixpanel, Umami, Cloudflare Web Analytics.

Quick start

  1. Create a Cloudflare API token at dash.cloudflare.com/profile/api-tokens with Workers Scripts: Edit, D1: Edit, Workers R2 Storage: Edit and Account Settings: Read.

  2. Deploy from your project directory:

    CLOUDFLARE_API_TOKEN=… npx dataflare-cli init

    This creates the database, the replay bucket and the Worker, then prints the snippet for your framework.

  3. Add the snippet to every page:

    <script defer src="https://glass.<you>.workers.dev/s.js" data-project="my-app"></script>
  4. Track what matters:

    glass.capture('signup_completed', { plan: 'pro' });
    glass.identify(user.id, { plan: user.plan }); // after login
  5. Ask. Open https://glass.<you>.workers.dev/app (sign in with npx dataflare-cli key), or ask your agent: "Which traffic source converts best to signup?"

Run npx dataflare-cli status any time to check everything end to end. See docs/getting-started.md for frameworks, custom domains and EU data residency.

What you get

Web analytics Visitors, pageviews, sessions, bounce rate, top/entry/exit pages, referrers, UTMs, countries, devices, errors, Core Web Vitals. Cookieless mode available.
Product analytics Trends, funnels and retention on any event, with filters and breakdowns on any event or person property. Read-only SQL for everything else.
People identify() links anonymous visits to users, so funnels span the moment of signup. Person properties are snapshotted on every event.
Session replay rrweb recording with inputs masked, sampling and "record when an error happens", plus console messages and network requests. A player with a timeline of clicks, errors and notes; search by what went wrong; patterns across sessions. Each session has a transcript agents read: pages, clicks with selectors, rage and dead clicks, errors with stacks, failed requests.
Flags and experiments Flags evaluated server-side in your Worker, with targeting rules. Experiments report exposures, conversion, Bayesian probability to beat control, lift intervals and sample-ratio mismatch.
Agent interface An MCP server with 41 tools, a CLI with --json everywhere, an HTTP API, and llms.txt.

How it works

browser ──/s.js, /e, /r, /f──▶  Dataflare Worker  ──▶  D1 (events, people, flags, experiments, replay index)
agents  ──/mcp, /api───────▶  (your account) ──▶  R2 (replay chunks)
you     ──/app─────────────▶                  ──▶  optional: Pipelines → Iceberg on R2 → Basin SQL

Every query (web, trends, funnels, retention, experiments) compiles to SQL that runs on both D1 (SQLite) and Basin SQL, so you can start on the free plan and move high-volume event storage to the lake with dataflare init --lake. More in docs/architecture.md.

Documentation

Status

Dataflare is new. The D1 store, SDK, dashboard, MCP server and CLI are covered by unit, integration and browser end-to-end tests. The lake store is checked against DataFusion in CI and has been load-tested on production Basin SQL at 30 million events; it relies on Cloudflare Pipelines, which is still in beta. See ROADMAP.md.

Contributing

Contributions are welcome. CONTRIBUTING.md explains the layout, how to run everything locally without a Cloudflare account (pnpm dev), and where to add things. Coding agents should read AGENTS.md.

License

MIT

About

Agent-first, open-source analytics that runs in your own Cloudflare account.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages