A short url system based on cloudflare worker
120
stars
43
commits
TypeScript
primary language
Jun 1, 2026
updated
Based on Cloudflare Workers & Vercel
Notice: I found the test site u.li2niu.com was abused by phishing emails. So I cancelled the deployment. Please deploy the version of your own.
Try it now: https://cf-url-admin.li2niu.com/
Please don't delete data with many clicks. We believe you won't.

You must have:
Fork this repo and clone it to your local machine. Then start the deployment process.
The frontend code is in /fe, which is a Next.js project. Vercel is highly recommended.
If you want google analytics, remember to add the following env NEXT_PUBLIC_GA_MEASUREMENT_ID=< your ga4 key e.g G-xxxxxxxxxx>
NEXT_PUBLIC_GA_MEASUREMENT_ID=G-xxxxxxxxxx

Fill in the KV namespace ID in wrangler.toml below. It is not necessary to name your namespace LINKS because it is just a global variable exposed to the worker.
[[kv_namespaces]]
binding = "LINKS"
id = "7f0bf9809c464f51871b753cdda2c124" ## Change it to yours


Don't expose your vars in wrangler.toml
USERNAME = "li2niu" # Change it and don't expose it in this file
PASSWORD = "li2niu" # Change it and don't expose it in this file
JWT_SECRET = "li2niu" # Change it and don't expose it in this file
DEFAULT_PAGE = "https://blog.li2niu.com" # Change it
RECORD_CLICKS = true
FE_ADMIN_DOMAIN = "https://cf-url-admin.li2niu.com" # Replace it with your admin domain, important for cross-origin allowlist
git clone yourrepo
npm install -g wrangler
wrangler login
wrangler publish
Create your short URL in the frontend admin. Enjoy!
Use a long, difficult-to-guess username, password, and JWT secret for security.
Cloudflare free plan has limits for KV, especially write times. Even in a paid plan, the write speed for the same key is limited to 1 time/second, potentially causing inaccuracies in high concurrency. Click history is not recommended for free plan users.
Vercel has limits for free users, but it is unlikely to be easily overused.
43 commits
TypeScript
63.9%
JavaScript
35.0%
CSS
1.0%
A short url system based on cloudflare worker
120
stars
43
commits
TypeScript
primary language
Jun 1, 2026
updated
Based on Cloudflare Workers & Vercel
Notice: I found the test site u.li2niu.com was abused by phishing emails. So I cancelled the deployment. Please deploy the version of your own.
Try it now: https://cf-url-admin.li2niu.com/
Please don't delete data with many clicks. We believe you won't.

You must have:
Fork this repo and clone it to your local machine. Then start the deployment process.
The frontend code is in /fe, which is a Next.js project. Vercel is highly recommended.
If you want google analytics, remember to add the following env NEXT_PUBLIC_GA_MEASUREMENT_ID=< your ga4 key e.g G-xxxxxxxxxx>
NEXT_PUBLIC_GA_MEASUREMENT_ID=G-xxxxxxxxxx

Fill in the KV namespace ID in wrangler.toml below. It is not necessary to name your namespace LINKS because it is just a global variable exposed to the worker.
[[kv_namespaces]]
binding = "LINKS"
id = "7f0bf9809c464f51871b753cdda2c124" ## Change it to yours


Don't expose your vars in wrangler.toml
USERNAME = "li2niu" # Change it and don't expose it in this file
PASSWORD = "li2niu" # Change it and don't expose it in this file
JWT_SECRET = "li2niu" # Change it and don't expose it in this file
DEFAULT_PAGE = "https://blog.li2niu.com" # Change it
RECORD_CLICKS = true
FE_ADMIN_DOMAIN = "https://cf-url-admin.li2niu.com" # Replace it with your admin domain, important for cross-origin allowlist
git clone yourrepo
npm install -g wrangler
wrangler login
wrangler publish
Create your short URL in the frontend admin. Enjoy!
Use a long, difficult-to-guess username, password, and JWT secret for security.
Cloudflare free plan has limits for KV, especially write times. Even in a paid plan, the write speed for the same key is limited to 1 time/second, potentially causing inaccuracies in high concurrency. Click history is not recommended for free plan users.
Vercel has limits for free users, but it is unlikely to be easily overused.
43 commits
TypeScript
63.9%
JavaScript
35.0%
CSS
1.0%