Uptime is a lightweight, serverless monitoring tool built on Cloudflare Workers to keep track of your websites' availability. It monitors a configurable list of websites and sends Telegram alerts when issues arise—keeping you informed of your services' status at all times.
- 🔍 Active Monitoring: Periodically checks the availability of configured websites.
- ⚡ Serverless: Runs on Cloudflare Workers with minimal latency and no infrastructure overhead.
- 🔔 Instant Alerts: Sends alerts via Telegram when a monitor fails or recovers.
- 🔐 Zero Trust Support: Works with sites behind Cloudflare Zero Trust via client credentials.
- Configure a list of websites to monitor in the project settings.
- Uptime periodically checks the availability of each website.
- If at least one website monitor fails, a notification is sent via Telegram.
- No further failure notifications are sent for the same incident to avoid spam.
- Once all monitors report a healthy status, a recovery message is sent via Telegram.
- Cloudflare Workers
- Workers KV
- Wrangler for development and deployment
- TypeScript
- Telegram Bot API
- GitHub Actions (optional deployment)
- A Cloudflare account
- A Telegram bot and a chat for notifications
- Create a KV namespace for storing monitor states:
This will output a namespace ID, which you need to add to your
cd packages/uptime-worker/ npx wrangler kv namespace uptimewrangler.jsonfile under thekv_namespacessection:{ "kv_namespaces": [ { "binding": "uptime", "id": "<your-namespace-id>" } ] } - Add the Telegram secrets to your Cloudflare Workers environment variables:
cd packages/uptime-worker/ npx wrangler secret put TELEGRAM_BOT_TOKEN npx wrangler secret put TELEGRAM_CHAT_ID - Optionally, set up Cloudflare Zero Trust if your websites are protected by it.
cd packages/uptime-worker/ npx wrangler secret put CF_ACCESS_CLIENT_ID npx wrangler secret put CF_ACCESS_CLIENT_SECRET
- Clone or download the Uptime repository.
- Install the required dependencies:
npm install
- Generate the Cloudflare type definitions:
npm run cf-typegen
- Configure your list of websites to monitor in the configuration file. Example:
export default { monitors: [ { name: "Example Site", target: "https://example.com", statusPageLink: "https://status.example.com", // Optional: Link to a status page, defaults to the target URL expectedCodes: [200], // Optional: Expected HTTP status codes, defaults to [200] timeout: 5000, // Optional: Request timeout in milliseconds, defaults to 5000 ms protectedByZeroTrust: false, // Optional: Set to true if the site is protected by Cloudflare Zero Trust headers: {}, // Optional: Additional headers to send with the request body: undefined, // Optional: Body to send with the request (for POST or PUT requests) }, // Add more monitors as needed ], };
- Deploy the project to Cloudflare Workers:
npm run deploy
Deploy Uptime to Cloudflare Workers using the following command:
npm run deployTo enable automatic deployments from GitHub Actions, you'll need to set up a Cloudflare API token:
- Generate a Cloudflare API token by following the instructions at: https://developers.cloudflare.com/fundamentals/api/get-started/create-token/
- Add the token as a GitHub repository secret:
- Go to your GitHub repository
- Navigate to Settings > Secrets and variables > Actions
- Click New repository secret
- Name:
CLOUDFLARE_API_TOKEN - Value: Your generated Cloudflare API token
- The GitHub Actions workflow will automatically deploy your changes when you push to the main branch.
- Install dependencies:
npm install
- Create a
.dev.varsfile in thepackages/uptime-worker/directory with the following content:CF_ACCESS_CLIENT_ID=<value> CF_ACCESS_CLIENT_SECRET=<value> TELEGRAM_BOT_TOKEN=<value> TELEGRAM_CHAT_ID=<value> - Start the development server:
npm run dev
- Test the worker locally by calling the scheduled endpoint. This simulates a scheduled CRON event locally using the
__scheduledendpoint.curl "http://localhost:8787/__scheduled?cron=*+*+*+*+*"
Once deployed, Uptime will automatically start monitoring the configured websites and send notifications to Telegram based on the status of the monitors.
Contributions are welcome! Please feel free to submit issues or pull requests to improve Uptime. Before submitting a PR, please run:
npm run lintThis project is licensed under the MIT License. See the LICENSE file for details.