Skip to content

tarampampam/url-shortener

Repository files navigation

URL shortener

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.

Steps to reproduce the project

  • Issue a new Cloudflare API token with the following scopes (Workers KV Storage:Edit, Workers Scripts:Edit) and save it

    Screenshot

    screenshot

  • Create a new KV (key-value) storage namespace on the Cloudflare "Storage & Databases" page and name it, for example, url-shortener-kv

    Screenshot

    screenshot

  • 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 step
    • CLOUDFLARE_ACCOUNT_ID – your Cloudflare account ID (available on the Cloudflare Account Home Page)
    Screenshot

    screenshot

  • 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
    Screenshot

    screenshot

  • Run the deployment workflow (open "Actions" in your fork, click on "🚀 Deploy", and then click on "Run workflow")

About

🌩 A simple URL shortener app built with Cloudflare Workers

Topics

Resources

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors 2

  •  
  •