simulated traffic

lightning bugs

Watch everything visiting your site, live, as a field of fireflies.

One bug per visitor. People, search crawlers, AI crawlers and vulnerability scanners each flash and move in their own way. It runs on one Cloudflare Worker on the free plan, with nothing added to your app.

How to install See it on real traffic →

Field guide

Seven kinds of visitor, told apart at a glance

Real fireflies are identified by their flash pattern. So are these. Each request makes its bug flash and types the path it asked for into the grid, so the field ends up written in your own traffic.

KindWho it isFlashMovement

How it works

A Worker in front of your site, and nothing inside it

Cloudflare already sees every request to a site it proxies. The kit adds one Worker on that path. Your app, your server and your database are untouched.

RequestA visitor asks for a pageThe request reaches Cloudflare first, as it does today.
WorkerPassed straight throughThe Worker hands it to your origin and returns the response unchanged. If the Worker fails, the request still goes through.
Durable ObjectClassified and anonymisedAfterwards, a small event (kind, path, rough location) goes to a Durable Object that keeps the last 30 minutes.
PagePushed to the fieldAnyone with /lightning-bugs open gets each event over a WebSocket, and a bug flashes.

Install

About ten minutes, if your domain is already on Cloudflare

You need three things before you start.

A Cloudflare accountThe free plan is enough.Sign up ↗
Your domain on CloudflareAdded as a site, with its DNS records proxied (the orange cloud).Add a site ↗   Proxy status ↗
Node.js 20 or newerOnly to run Cloudflare's deploy tool, Wrangler. Nothing is installed globally.Get Node.js ↗
  1. Download the kit and unzip it

    It is one folder. Open a terminal inside it.

  2. Put your domain in wrangler.toml

    Replace example.com with your domain, in both places on each line. Delete the www line if you don't use it.

    routes = [
      { pattern = "example.com/*", zone_name = "example.com" },
      { pattern = "www.example.com/*", zone_name = "example.com" },
    ]
  3. Check the scanner rules against your site

    Anything asking for a path your site never serves, such as .php or /wp-admin, is labelled a scanner. If your site really serves one of those (WordPress does), delete it from the lists at the top of src/classify.js.

  4. Choose what to record optional

    By default every request becomes a bug. The [vars] section of wrangler.toml narrows that down, for example to people only, only AI and search crawlers, or only your blog. Change it any time and deploy again.

    [vars]
    KINDS = "human,ai,search"   # or "all"
    IGNORE_PATHS = "/api/*,/healthz"
    ONLY_PATHS = ""             # e.g. "/blog/*"
    IGNORE_FILES = "images,scripts,styles,fonts"

    Kinds are human, search, ai, unfurl, monitor, scanner and script. File groups are images, scripts, styles, fonts, media, documents and data; plain extensions like pdf work too, and all skips every static file. A path ending in * matches everything under it. Requests you leave out still reach your site as normal, and the legend only lists the kinds you record.

    These settings don't lower your Worker request count. The Worker still runs to decide what to skip. To save requests on a busy site, see the note below this list.

  5. Log in to Cloudflare

    A browser tab opens for you to approve access.

    npx wrangler login
  6. Deploy

    This uploads the Worker, creates its Durable Object and attaches it to your domain. It takes effect immediately.

    npx wrangler deploy

    If the first deploy ends in an error on a /subdomain request, saying "This Worker does not exist on your account" (code 10007), the upload has still worked. Cloudflare hasn't finished registering the new Worker yet. Run the same command again and it goes through.

  7. Open your-domain/lightning-bugs

    The badge should read live. Browse your site in another tab and watch yourself appear. To check the raw feed, open your-domain/__traffic/snapshot.

One setting to change. The free plan allows 100,000 Worker requests a day. In the Cloudflare dashboard, set this Worker route's request limit failure mode to fail open, so that past the limit requests go straight to your site instead of failing. Cloudflare has moved this setting around, so look in either place: your domain → Workers Routes → Edit on the route, or Workers & Pages → this Worker → Settings → Domains & Routes. If neither shows it, your account may be on Workers Paid, where the daily limit doesn't apply. Worker limits ↗

What does a busy site look like?

At everyday traffic, every visitor gets a bug. Once there are more visitors than the screen can hold, the page draws a steady sample instead, and the field keeps getting busier as traffic grows without washing out. The counts in the key still include everyone, and a note there says how many are being drawn. Here is the page at about 45 requests a second, with nearly 4,000 visitors in the last ten minutes:

The field on a laptop screen at heavy traffic: a few hundred glowing bugs spread across the grid, paths typed between them, and the key reading 1 in 7 visitors.
Laptop
The same field on a phone: a dense but readable scatter of bugs, with 1 in 18 shown in the key.
Phone

Busy site on the free plan? Cloudflare counts a Worker request whenever a route sends a request to the Worker, before any of the settings above run. To keep part of your site off the Worker entirely, go to your domain → Workers Routes → Add route, enter a folder such as example.com/images/* and choose Worker: None. The more specific route wins, so those requests go straight to your site and aren't counted. Static files are usually the bulk of the traffic, so this can cut your count a long way. Route patterns match folders, not file extensions, and they have to be added in the dashboard rather than in wrangler.toml. Requests you route around the Worker don't appear as bugs. Routes ↗

To remove everything, run npx wrangler delete and your site is back to how it was.

The kit

Ten small files, no dependencies

Plain JavaScript, HTML and CSS. Open any file to read it before you run it, or copy files one at a time.

Before you ship it

Private by default, and honest about its limits

The page is public: anyone who knows the address can watch. The defaults are set with that in mind.

What visitors are protected from

  • IP addresses are never stored or sent to viewers.
  • Visitor ids are random hashes that reset every day and can't be traced back.
  • People are shown by country and region only: no city, network or referrer.
  • Browsers that send Global Privacy Control are shown with no location.
  • Query strings are never recorded, and nothing is kept beyond 30 minutes.

What to know going in

  • The Worker sits in front of all your traffic. It is written to fail open, but test it on a site you can afford to watch for a day.
  • The kinds are educated guesses from user agents, paths and network names. Cloudflare's own bot scores are not available on the free plan.
  • It only sees requests that pass through Cloudflare's proxy.
  • To keep the page private, put Cloudflare Access in front of /lightning-bugs* and /__traffic/*.
  • If your visitors are covered by privacy laws such as GDPR, mention the page in your privacy notice. This is not legal advice.