Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 2.71 KB

File metadata and controls

30 lines (25 loc) · 2.71 KB

Deployment on Cloudflare Pages

  1. Fork the repository to your GitHub account.

  2. Create a project in Cloudflare Pages.

  3. Select the Sink repository and choose the Nuxt.js preset.

  4. 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 least Account.Account Analytics permission. See reference.
    • (Optional) NUXT_WEBHOOK_URL: The HTTPS endpoint that enables and receives click webhooks.
    • (Optional) NUXT_WEBHOOK_SECRET: A whsec_-prefixed Base64 secret. If omitted, delivery is unauthenticated and unsigned, which is not recommended over untrusted networks.
  5. Save and deploy the project.

  6. Cancel the deployment, then go to Settings -> Bindings -> Add:

    • KV Namespace: Bind the variable name KV to a KV namespace (create a new one under Storage & Databases -> KV).
    • Workers AI (Optional): Bind the variable name AI to the Workers AI Catalog.
    • R2 Bucket (Optional, for OpenGraph image upload): Create an R2 bucket under Storage & Databases -> R2, then bind the variable name R2 to the bucket.
    • 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.
      • Return to Settings -> Bindings -> Add and select Analytics engine.
      • Bind the variable name ANALYTICS to the sink dataset.
  7. Add Compatibility flags

    • Go to Settings -> Runtime -> Compatibility flags and set the following flags nodejs_compat.
  8. Redeploy the project.

  9. To update 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.