sd416/cloudflare-worker-stats
sd416/cloudflare-worker-stats has 38 GitHub stars and 30 forks. Star changes are not measured yet. Last checked 2026-11-14 03:49 UTC. Last push 2026-10-16.
What you can do
- Fetches the last 7-30 days of request data from the Cloudflare GraphQL Analytics API (?days=N)
- Displays total requests in compact format (e.g. 2.14M)
- Shows avg/day and peak day stats on every theme
- Shows bandwidth (data served) and unique visitors (zone mode) when available
측정된 스타 증가
- in 24h
- 기록 수집 중
- in 7 days
- 기록 수집 중
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
소개
Generate beautiful, live SVG badges for your GitHub profile, project README, or dashboard using Cloudflare Workers. Track website traffic, worker requests, API usage, and custom metrics with automatic updates.
데이터README.md
Originalcloudflare-worker-stats
A Cloudflare Worker that generates a dynamic SVG bar chart showing the last 7-30 days of traffic from the Cloudflare Analytics API. Designed for embedding in a GitHub profile README.
Supports two modes:
- Zone mode - tracks HTTP requests for a specific domain using
CF_ZONE_ID - Worker mode - tracks Worker invocations across your account using
CF_ACCOUNT_ID(ideal for Workers on*.workers.devor unbound from a specific zone)
Theme Options
Choose a theme by appending the theme name to your worker URL. The default theme is Neon Terminal.
| Theme | Path | Description |
|---|---|---|
| Neon Terminal | / or /neon |
Dark terminal aesthetic with vertical bar chart, dot grid, glow effects, and Cloudflare Orange |
| Minimal | /minimal |
Clean card with full-width sparkline area chart and emerald accents |
| Gradient | /gradient |
Vibrant gradient background with horizontal daily breakdown bars (cyan-to-purple) |
| Dashboard | /dashboard |
Stat tile grid (avg/day, peak, bandwidth, visitors) with sparkline and indigo accents |
| Badge | /badge |
Compact shields.io-style pill (~28px tall) with label and total, ideal inline in a README |
| Heatmap | /heatmap |
GitHub contribution-graph style grid of daily cells, best with ?days=30 |
| Ticker | /ticker |
Stock-market candlestick style with green/red daily bars, change %, and HI/LO/VOL |
Neon Terminal (/neon, default)
Vertical bar chart with a terminal/hacker aesthetic. Monospace fonts, dot grid background, glow effects.
Minimal (/minimal)
Full-width sparkline area chart with a clean, lightweight card design. Green accent line with shaded area fill.
Gradient (/gradient)
Horizontal daily breakdown bars with day-of-week labels and per-day request counts. Gradient background with cyan-to-purple bar fills.
Dashboard (/dashboard)
Stat tile grid showing average requests/day, peak day, bandwidth, and unique visitors alongside the total and a sparkline.
Badge (/badge)
Compact shields.io-style pill showing the label and total, perfect inline next to other badges.
Heatmap (/heatmap)
GitHub contribution-graph style grid where each cell is a day, colored by traffic intensity. Pairs well with ?days=30.
Ticker (/ticker)
Stock-market candlestick aesthetic with green/red daily bars vs. the previous day, change %, and HI/LO/VOL stats.
All themes automatically adapt to light/dark mode via the prefers-color-scheme media query.
Options
Append query parameters to any theme URL:
| Parameter | Description |
|---|---|
?days=N |
Number of days to chart (1-30, default 7). Charts and labels adapt automatically. |
?refresh |
Bypass the 1-hour cache. |

Features
- Fetches the last 7-30 days of request data from the Cloudflare GraphQL Analytics API (
?days=N) - Displays total requests in compact format (e.g.
2.14M) - Shows avg/day and peak day stats on every theme
- Shows bandwidth (data served) and unique visitors (zone mode) when available
- Renders a 480×160 SVG chart
- Seven distinct UI themes: Neon Terminal, Minimal, Gradient, Dashboard, Badge, Heatmap, and Ticker
- Automatically adapts to light/dark theme via
prefers-color-schememedia query - One-click deploy via the button above
Quick Start
1. Deploy
Click the Deploy to Cloudflare Workers button above, or deploy manually:
npm install
npm run deploy
2. Configure Secrets
After deploying, set the required secrets. See Generating Secrets below for how to obtain these values.
npx wrangler secret put CF_API_TOKEN
# Then set ONE of the following:
npx wrangler secret put CF_ZONE_ID # for zone-level HTTP traffic
npx wrangler secret put CF_ACCOUNT_ID # for account-level Worker events
If both
CF_ZONE_IDandCF_ACCOUNT_IDare set, zone mode takes precedence.
3. Embed
Add the worker URL to your GitHub profile README (or anywhere that renders Markdown).
Default theme (Neon Terminal):

Choose a specific theme:
<!-- Neon Terminal (default) -->

<!-- Minimal Clean -->

<!-- Gradient Modern -->

<!-- Dashboard -->

<!-- Badge (compact pill) -->

<!-- Heatmap (best with 30 days) -->

<!-- Ticker -->

HTML embed (for more control):
<img src="https://your-worker.your-subdomain.workers.dev/minimal" alt="Cloudflare Usage" width="480" />
Bypass cache with ?refresh:

Chart a different time range with ?days:

Generating Secrets
CF_API_TOKEN - Cloudflare API Token
This token allows the worker to read analytics data.
- Log in to the Cloudflare dashboard.
- Click your profile icon (top-right) → My Profile.
- Select the API Tokens tab.
- Click Create Token.
- Under Custom token, click Get started.
- Configure the token:
- Token name: e.g.
cf-usage-graph-read - Permissions:
- For zone mode: select Zone → Analytics → Read
- For worker mode: select Account → Workers Scripts → Read and Account → Analytics → Read
- Zone Resources (zone mode only): choose Include → Specific zone and pick the zone you want to track (or select All zones if you prefer)
- Account Resources (worker mode only): choose Include → your account
- Token name: e.g.
- Click Continue to summary → Create Token.
- Copy the token value. You will not be able to see it again.
CF_ZONE_ID - Cloudflare Zone ID (zone mode)
The Zone ID identifies which domain's traffic data to query.
- Log in to the Cloudflare dashboard.
- Select the domain (zone) you want to track.
- On the Overview page, scroll down to the right-hand sidebar.
- Under API, copy the Zone ID value.
CF_ACCOUNT_ID - Cloudflare Account ID (worker mode)
The Account ID identifies your Cloudflare account for querying Worker invocation data. Use this when your Worker runs on a *.workers.dev subdomain or is not bound to a specific zone.
- Log in to the Cloudflare dashboard.
- On the left sidebar, select Workers & Pages.
- Your Account ID is displayed in the right-hand sidebar.
Storing the Secrets
After you have the required values, store them as Wrangler secrets so they are encrypted and available to the deployed worker:
npx wrangler secret put CF_API_TOKEN
# Paste your API token when prompted
# For zone mode:
npx wrangler secret put CF_ZONE_ID
# Paste your Zone ID when prompted
# For worker mode:
npx wrangler secret put CF_ACCOUNT_ID
# Paste your Account ID when prompted
Note: Never commit these values to source control. Wrangler secrets are encrypted at rest and injected into the worker environment at runtime.
Development
npm install # Install dependencies
npm run dev # Start local dev server
npm test # Run tests (bun test, using the Bun version installed as a devDependency)
npm run screenshots # Regenerate theme screenshots from sample data
npm run deploy # Deploy to Cloudflare Workers
Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request.
License
This project is open-source. See the repository for license details.
관련 프로젝트 살펴보기
Asabeneh/30-Days-Of-Python
30 Days of Python 프로그래밍 챌린지는 Python 프로그래밍 언어를 30일 동안 배우기 위한 단계별 가이드입니다. 이 챌린지는 100일 이상 걸릴 수 있습니다. 자신의 속도에 맞춰 진행하세요. 다음 동영상도 도움이 될 수 있습니다: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,711 스타grafana/grafana
개방적이고 조합 가능한 옵저버빌리티 및 데이터 시각화 플랫폼입니다. Prometheus, Loki, Elasticsearch, InfluxDB, Postgres 등 여러 소스의 메트릭, 로그, 트레이스를 시각화합니다.
77,894 스타redis/redis
실시간 데이터 기반 애플리케이션을 구축하는 개발자에게 Redis는 가장 선호되고, 가장 빠르며, 기능이 가장 풍부한 캐시, 데이터 구조 서버이자 문서 및 벡터 쿼리 엔진입니다.
77,490 스타apache/superset
Apache Superset는 데이터 시각화 및 데이터 탐색 플랫폼입니다.
75,522 스타