Deploy Sink on Cloudflare Workers
- Fork the repository.
- Create a KV namespace and copy its ID.
- Create D1 and copy its ID:
pnpm wrangler d1 create sink. - Create an R2 bucket named
sink, or runpnpm wrangler r2 bucket create sink. The deployment always includesR2; OpenGraph uploads and automatic compatibility backups depend on it. - Create a Cloudflare Workers project connected to the fork.
- Configure these commands:
- Build command:
pnpm build - Deploy command:
pnpm deploy:worker
- Build command:
- Under Workers Builds → Build variables and secrets, configure:
DEPLOY_D1_DATABASE_ID(required)DEPLOY_KV_NAMESPACE_ID(required, used for production and preview KV bindings)DEPLOY_D1_DATABASE_NAME(optional, defaultsink)DEPLOY_R2_BUCKET_NAME(optional, defaultsink; the bucket must exist)DEPLOY_ANALYTICS_DATASET(optional, defaultsink)NUXT_API_CORS(optional, build only)- Each
NUXT_PUBLIC_*value needed by the instance
DEPLOY_* values are deployment-only. Do not add them as Worker runtime variables or edit tracked wrangler.jsonc. The deploy command creates gitignored wrangler.deploy.jsonc, applies pending D1 migrations, and publishes the Worker.
- Save and deploy.
- Under the Worker's Settings → Variables and Secrets, configure runtime values:
- Repeat all
NUXT_PUBLIC_*build values. - Set a strong
NUXT_SITE_TOKEN; use at least eight characters and avoid predictable values such as digit-only tokens. - Set
NUXT_CF_ACCOUNT_IDand anNUXT_CF_API_TOKENwith at least Account Analytics permission. - Add other runtime
NUXT_*values as needed, includingNUXT_DATASET, Access, and webhook settings.
- Repeat all
- Enable Analytics Engine under Workers & Pages → Account details and keep
NUXT_DATASETaligned withDEPLOY_ANALYTICS_DATASET. - Redeploy the project.
D1 is the authoritative link store. KV is a write-through read cache and a temporary legacy source before migration completion. For upgrades with existing KV links, use the migration API after applying D1 migrations.
For optional dashboard protection, see Cloudflare Access. For event delivery details, see Click Webhooks. To update a fork, follow GitHub's syncing a fork guide.