npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@main12/payload-cloudflare-widgets

v0.1.1

Published

Payload CMS plugin providing Cloudflare analytics dashboard widgets

Readme

@main12/payload-cloudflare-widgets

A Payload CMS plugin that adds Cloudflare analytics widgets to your admin dashboard. Visualize traffic, bandwidth, cache performance, threats, and more — all powered by the Cloudflare GraphQL API.

Widgets

| Widget | Description | |---|---| | CloudflareTraffic | Requests & unique visitors over time | | CloudflareBandwidth | Data transferred over time | | CloudflareCacheRate | Cache hit vs. miss ratio | | CloudflareDevices | Visitor breakdown by device type | | CloudflareProtocol | HTTP version distribution | | CloudflareStatusCodes | Response status code breakdown | | CloudflareThreats | Threat and firewall event counts | | CloudflareTopPaths | Top requested URL paths | | CloudflareWorldMap | Choropleth map of visitor countries |

Requirements

  • Payload CMS ^3.84.1
  • Node.js ^18.20.2 || >=20.9.0
  • A Cloudflare account with an active zone
  • Cloudflare API credentials (Zone ID + API Token)

Installation

pnpm add @main12/payload-cloudflare-widgets
# or
npm install @main12/payload-cloudflare-widgets

Environment Variables

Add these to your .env file:

CLOUDFLARE_ZONE_ID=your_zone_id
CLOUDFLARE_API_TOKEN=your_api_token

Your API token needs the Zone / Analytics / Read permission.

Usage

Add the plugin to your payload.config.ts:

import { buildConfig } from 'payload'
import { cloudflareWidgetsPlugin } from '@main12/payload-cloudflare-widgets'

export default buildConfig({
  plugins: [
    cloudflareWidgetsPlugin(),
  ],
  // ...rest of your config
})

All 9 widgets will appear on the Payload admin dashboard automatically.

Plugin Options

cloudflareWidgetsPlugin({
  // Optional: customize the analytics API route
  // Defaults to '/analytics/cloudflare' → accessible at /api/analytics/cloudflare
  apiPath: '/analytics/cloudflare',

  // Optional: disable the plugin without removing it from config
  disabled: false,
})

Cherry-picking Widgets

If you only want specific widgets, import them individually:

import { buildConfig } from 'payload'
import {
  CloudflareTrafficWidget,
  CloudflareBandwidthWidget,
  CloudflareWorldMapWidget,
} from '@main12/payload-cloudflare-widgets'

export default buildConfig({
  admin: {
    dashboard: {
      widgets: [
        CloudflareTrafficWidget,
        CloudflareBandwidthWidget,
        CloudflareWorldMapWidget,
      ],
    },
  },
  // Note: you still need to register the analytics endpoint manually
  // when not using the plugin function.
})

How It Works

The plugin registers:

  1. A server-side API endpoint at /api/analytics/cloudflare that proxies requests to the Cloudflare GraphQL API using your credentials from environment variables. Your API token is never exposed to the browser.

  2. Dashboard widgets that call that endpoint and render charts using Recharts (all widgets except the world map) and react-simple-maps (world map).

License

MIT