mirror of
https://github.com/jakejarvis/shortty.git
synced 2025-04-25 08:25:23 -04:00
🩳 shortty
A very, very simple (less than 100 LoC, for whatever that's worth) link shortener powered by Cloudflare Workers and Hono.
Setup
The docs are pretty much already written... But essentially:
- Create a Cloudflare KV store:
npx wrangler kv namespace create my-links
- Update wrangler.jsonc with that namespace's ID, your worker's name, and your own domain.
- Set a random authentication token:
npx wrangler secret put BEARER_TOKEN
- Deploy:
npx wrangler deploy
Usage
There is no GUI. Quite literally everything is done via curl
requests in your terminal (hence the name).
Add a link with a random shortcode
curl -X POST \
-H "Authorization: Bearer <BEARER_TOKEN>" \
-H "URL: https://ubuntu.com/download/server/thank-you?version=24.04.2&architecture=amd64<s=true" \
https://jrvs.io
Add a link with a specific shortcode
curl -X PUT \
-H "Authorization: Bearer <BEARER_TOKEN>" \
-H "URL: https://github.com/jakejarvis/shortty/blob/main/README.md" \
https://jrvs.io/readme
Delete a link
curl -X DELETE \
-H "Authorization: Bearer <BEARER_TOKEN>" \
https://jrvs.io/readme
List all links
Soon, maybe. 🤷♂️
License
Description
🩳 A very, very simple link shortener. Maybe too simple, quite frankly.
https://jrvs.io/shortty
bitlycloudflarecloudflare-kvcloudflare-workershonolink-shortenerserverlessstarter-templatetypescripturl-shortener
Readme
MIT
41 KiB
Languages
TypeScript
100%