MCPcopy Index your code
hub / github.com/eidam/cf-workers-status-page

github.com/eidam/cf-workers-status-page @v1.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.2.0 ↗ · + Follow
22 symbols 45 edges 16 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Cloudflare Worker - Status Page

Monitor your websites, showcase status including daily history, and get Slack notification whenever your website status changes. Using Cloudflare Workers, CRON Triggers, and KV storage. Check my status page out! 🚀

Status Page

Slack notifications

Pre-requisites

You'll need a Cloudflare Workers account with

Also, prepare the following secrets

  • Cloudflare API token with Edit Cloudflare Workers permissions
  • Slack incoming webhook (optional)

Getting started

You can either deploy with Cloudflare Deploy Button using GitHub Actions or deploy on your own.

Deploy with Cloudflare Deploy Button

Deploy to Cloudflare Workers

  1. Click the button and follow the instructions, you should end up with a clone of this repository
  2. Navigate to your new GitHub repository > Settings > Secrets and add the following secrets:

```yaml - Name: CF_API_TOKEN (should be added automatically)

  • Name: CF_ACCOUNT_ID (should be added automatically)

  • Name: SECRET_SLACK_WEBHOOK_URL (optional)

  • Value: your-slack-webhook-url ```

  • Navigate to the Actions settings in your repository and enable them

  • Edit config.yaml to adjust configuration and list all of your websites/APIs you want to monitor

```yaml settings: title: 'Status Page' url: 'https://status-page.eidam.dev' # used for Slack messages logo: logo-192x192.png # image in ./public/ folder daysInHistogram: 90 # number of days you want to display in histogram collectResponseTimes: false # experimental feature, enable only for <5 monitors or on paid plans

 # configurable texts across the status page
 allmonitorsOperational: 'All Systems Operational'
 notAllmonitorsOperational: 'Not All Systems Operational'
 monitorLabelOperational: 'Operational'
 monitorLabelNotOperational: 'Not Operational'
 monitorLabelNoData: 'No data'
 dayInHistogramNoData: 'No data'
 dayInHistogramOperational: 'All good'
 dayInHistogramNotOperational: 'Some checks failed'

# list of monitors monitors: - id: workers-cloudflare-com # unique identifier name: workers.cloudflare.com description: 'You write code. They handle the rest.' # default=empty url: 'https://workers.cloudflare.com/' # URL to fetch method: GET # default=GET expectStatus: 200 # operational status, default=200 followRedirect: false # should fetch follow redirects, default=false ```

  1. Push to main branch to trigger the deployment
  2. 🎉
  3. (optional) Go to Cloudflare Workers settings and assign custom domain/route
  4. e.g. status-page.eidam.dev/* (make sure you include /* as the Worker also serve static files)
  5. (optional) Edit wrangler.toml to adjust Worker settings or CRON Trigger schedule, especially if you are on Workers Free plan

Telegram notifications

To enable telegram notifications, you'll need to take a few additional steps.

  1. Create a new Bot
  2. Set the api token you received when creating the bot as content of the SECRET_TELEGRAM_API_TOKEN secret in your github repository.
  3. Send a message to the bot from the telegram account which should receive the alerts (Something more than /start)
  4. Get the chat id with curl https://api.telegram.org/bot<YOUR TELEGRAM API TOKEN>/getUpdates | jq '.result[0] .message .chat .id'
  5. Set the retrieved chat id in the SECRET_TELEGRAM_CHAT_ID secret variable
  6. Redeploy the status page using the github action

Deploy on your own

You can clone the repository yourself and use Wrangler CLI to develop/deploy, extra list of things you need to take care of:

  • create KV namespace and add the KV_STATUS_PAGE binding to wrangler.toml
  • create Worker secrets (optional)
  • SECRET_SLACK_WEBHOOK_URL

Workers KV free tier

The Workers Free plan includes limited KV usage, but the quota is sufficient for 2-minute checks only

  • Change the CRON trigger to 2 minutes interval (crons = ["*/2 * * * *"]) in wrangler.toml

Known issues

  • Max 25 monitors to watch in case you are using Slack notifications, due to the limit of subrequests Cloudflare Worker can make (50).

The plan is to support up to 49 by sending only one Slack notification per scheduled run.

Future plans

Stay tuned for more features coming in, like leveraging the fact that CRON instances are scheduled around the world during the day so we can monitor the response times. However, we will most probably wait for the Durable Objects to be in open beta as they are better fit to reliably store such info.

Core symbols most depended-on inside this repo

getKVMonitors
called by 2
src/functions/helpers.js
getOperationalLabel
called by 2
src/functions/helpers.js
getKvMonitors
called by 1
src/cli/gcMonitors.js
saveKVMonitors
called by 1
src/cli/gcMonitors.js
loadConfig
called by 1
src/cli/gcMonitors.js
setKVMonitors
called by 1
src/functions/helpers.js
setKV
called by 1
src/functions/helpers.js
notifySlack
called by 1
src/functions/helpers.js

Shape

Function 22

Languages

TypeScript100%

Modules by API surface

src/functions/helpers.js10 symbols
src/cli/gcMonitors.js3 symbols
src/functions/cronTrigger.js2 symbols
src/components/monitorFilter.js2 symbols
pages/index.js2 symbols
src/components/themeSwitcher.js1 symbols
src/components/monitorHistogram.js1 symbols
src/components/monitorDayAverage.js1 symbols

For agents

$ claude mcp add cf-workers-status-page \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page