Skip to content

axeelz/cloudflare-maintenance-page-cli

Repository files navigation

cloudflare-maintenance-page-cli

Simple CLI using Cloudflare API and Workers to deploy a maintenance page to a domain

npm version

screenshot

setup

Install Bun runtime

Install the CLI globally:

bun i -g cloudflare-maintenance-page-cli

Then use the command cfmp anywhere.

Or run without installing globally:

bunx cloudflare-maintenance-page-cli <command>

commands

  • cfmp deploy - deploys the maintenance page worker to Cloudflare at /maintenance on your domain
  • cfmp enable - enables maintenance mode (routes all traffic to the worker)
  • cfmp disable - disables maintenance mode (back to normal)

configuration

At the first run, it will create ~/.config/cloudflare-maintenance-page-cli/config.json, then prompt for your Cloudflare information:

To edit the config, just run cfmp config.

Your API token is NOT stored in plain text in the config file. It is stored securely using the operating system's keychain. To delete it, you can run cfmp config --delete.

The config has two sections:

  • CLOUDFLARE - your Cloudflare information
  • PAGE - customize the maintenance page

You can also use environment variables (example CLOUDFLARE_ACCOUNT_ID=your_id... cfmp deploy). This doesn't apply to the token.

worker

The CLI will deploy a Cloudflare Worker on your Cloudflare account named maintenance-<domain>-<start_of_zone_id>.

Cloudflare Workers limits apply according to your plan. See Cloudflare Workers limits.

development

To install dependencies:

bun install

To link globally:

bun link

Then use cfmp anywhere.


This project was created using bun init in bun v1.2.19. Bun is a fast all-in-one JavaScript runtime.

About

Easy to use CLI using Cloudflare API and Workers to deploy a customizable maintenance page to a domain — made with Effect/cli

Topics

Resources

Stars

Watchers

Forks