-
Fork the repository to your GitHub account.
-
Create a KV namespace (under Storage & Databases -> KV), and copy the namespace ID.
-
Update the
kv_namespacesID inwrangler.jsoncwith your own namespace ID. -
(Optional) For OpenGraph image upload, create an R2 bucket named
sink(or runwrangler r2 bucket create sink). If you don't need this feature, comment out ther2_bucketssection inwrangler.jsonc. -
Create a project in Cloudflare Workers.
-
Select the
Sinkrepository and use the following build and deploy commands:- Build command:
pnpm run buildornpm run build - Deploy command:
npx wrangler deploy
- Build command:
-
Save and deploy the project.
-
After deployment, go to Settings -> Variables and Secrets -> Add, and configure the following environment variables:
NUXT_SITE_TOKEN: Must be at least 8 characters long. This token grants access to your dashboard.NUXT_CF_ACCOUNT_ID: Find your account ID.NUXT_CF_API_TOKEN: Create a Cloudflare API token with at leastAccount.Account Analyticspermission. See reference.- (Optional)
NUXT_WEBHOOK_URL: The HTTPS endpoint that enables and receives click webhooks. - (Optional)
NUXT_WEBHOOK_SECRET: Awhsec_-prefixed Base64 secret. Generate one withprintf 'whsec_%s\n' "$(openssl rand -base64 32)"and store it as a secret in the dashboard, not inwrangler.jsonc. If omitted, delivery is unauthenticated and unsigned, which is not recommended over untrusted networks.
-
Enable Analytics Engine. In Workers & Pages, go to Account details in the right panel, locate Analytics Engine, and click Set up to enable the free tier. Name them
sinkandANALYTICS, or else overwrite it withNUXT_DATASETand update yourwrangler.jsoncaccordingly -
Redeploy the project.
-
To update your code, refer to the official GitHub documentation: Syncing a fork branch from the web UI.
To optionally protect the dashboard with Cloudflare Zero Trust while keeping short links public, refer to Cloudflare Access Authentication.
Click webhook delivery is best effort and has no retries. See Click Webhooks for payload, signature, and privacy details.