About this project

Dashflare is a privacy-first, open-source analytics platform designed to monitor websites hosted behind Cloudflare. Instead of using traditional client-side tracking scripts, Dashflare collects data through a Cloudflare Edge Worker, making it lightweight and cookie-free. Architecture The system consists of three components: 1. Cloudflare Edge Worker — intercepts and processes page view events at the network edge. Data collection requires no changes to the target website; requests are forwarded via Cloudflare Routes from the primary domain to the `.workers.dev` worker subdomain. 2. Grafana Loki — stores event logs as the persistence layer. 3. Grafana — provides dashboards and visualization for the collected analytics data. Features - Privacy-focused: No cookies, no personal data storage. Visitor sessions are identified by hashed fingerprints derived from a secret key. - Geolocation: Basic country detection is included out of the box. Optional integration with ipgeolocationapi.com adds richer geographic data. - Self-hosted deployment: A Docker Compose setup spins up Grafana and Loki locally for development or production use. - Cloudflare-native: Designed specifically for sites already using Cloudflare. The worker is deployed via Cloudflare's Wrangler CLI. Installation A minimal environment is launched with `docker-compose up`. Grafana is accessible at `http://localhost:3000/` with default credentials `admin/admin` (prompted to change on first login). Key environment variables include `LOKI_HOST` (the URL of the Loki instance, must be a reachable domain, not an IP), `DOMAIN` (the primary website domain for automatic route generation), `FINGERPRINT` (a random key for session hashing), and optionally `IPINFO` to enable extended geolocation via ipgeolocationapi.com. For the Edge Worker deployment, Wrangler must be installed (`npm install -g @cloudflare/wrangler`) and authenticated against your Cloudflare account. A `wrangler.toml` configuration file is generated from a template using `make wrangler`, then published with `wrangler publish`. Note on Loki accessibility Cloudflare Edge Workers can only reach endpoints on ports 80 or 443 over domain names. If Loki runs on a non-standard port, it must be placed behind a reverse proxy or exposed directly through a subdomain. For local development, services like ngrok can forward traffic to make Loki reachable from the edge. Dashboard Once running, Grafana presents a preconfigured analytics dashboard showing visitor metrics, geographic distribution, and other website performance indicators.