This is a simple URL shortener application that allows users to create short links for long URLs. The app is built using Cloudflare Workers and uses Workers KV for storage.
Tip
To prevent abuse, the app may be protected by an authentication token.
-
Issue a new Cloudflare API token with the following scopes (
Workers KV Storage:Edit
,Workers Scripts:Edit
) and save it -
Create a new KV (key-value) storage namespace on the Cloudflare "Storage & Databases" page and name it, for example,
url-shortener-kv
-
Create the following GitHub Actions secrets in the repository settings:
AUTH_TOKEN
- the token to protect creating short links only for authenticated users (e.g.,suPaPA$$w0rd
)CLOUDFLARE_PAGES_DEPLOY_TOKEN
– the API token you created in the first stepCLOUDFLARE_ACCOUNT_ID
– your Cloudflare account ID (available on the Cloudflare Account Home Page)
-
Create the following GitHub Actions variables (not secrets!) in the repository settings:
CLOUDFLARE_PROJECT_NAME
– the name of your Cloudflare Worker project, e.g.,url-shortener-app
CLOUDFLARE_KV_ID
– the ID of the KV storage namespace you created in the second step
-
Run the deployment workflow (open "Actions" in your fork, click on "🚀 Deploy", and then click on "Run workflow")