Skip to content

Deploy on Cloudflare Workers ​

1. Create resources ​

Using the source repository you were given access to, deploy it to a Cloudflare Worker. In the Cloudflare dashboard, create:

Binding nameProductRequired?Description
DBD1 databaseYesStores links
KVKV namespaceYesSpeeds up redirects
ANALYTICSAnalytics Engine datasetRecommendedVisit stats
R2R2 bucketOptionalBackups and social images
AIWorkers AIOptionalAI suggestions

Copy the D1 database ID and KV namespace ID from each resource’s detail page.

Analytics is optional — short links still work without it. Setup: Analytics and Realtime.

2. Connect Git (Workers Builds) ​

In the Cloudflare dashboard, create a Worker with Git integration and connect your fork:

  • Production branch: master
  • Build command: pnpm build
  • Deploy command: pnpm deploy:cf

pnpm deploy:cf neutralizes the secret values for the build, verifies that no secret reached .output and that no internal file would be served publicly, then applies remote D1 migrations and publishes. Use pnpm deploy:build for the same checks without publishing.

Add these build variables (do not put production IDs into tracked wrangler.jsonc — set DEPLOY_* instead):

VariableValue
DEPLOY_D1_DATABASE_IDYour D1 database ID (from the D1 detail page)
DEPLOY_KV_NAMESPACE_IDYour KV namespace ID (from the KV detail page) → kv_namespaces[].id
DEPLOY_KV_PREVIEW_NAMESPACE_IDOptional Wrangler preview KV → preview_id (defaults to DEPLOY_KV_NAMESPACE_ID)
DEPLOY_R2_BUCKET_NAMEYour R2 bucket name (only if you use R2; omit to skip R2) → bucket_name
DEPLOY_R2_PREVIEW_BUCKET_NAMEOptional Wrangler preview R2 → preview_bucket_name (defaults to DEPLOY_R2_BUCKET_NAME)
DEPLOY_D1_DATABASE_NAMEOptional; default sink
DEPLOY_ANALYTICS_DATASETOptional; default sink (keep in sync with NUXT_DATASET if you change it)

pnpm deploy:cf generates gitignored wrangler.deploy.jsonc from these values, updates the D1 schema, then deploys. When you connect the repo, Cloudflare creates a deploy token — no extra credential to paste.

3. App settings (login password and more) ​

Under Settings → Variables and Secrets, add:

VariableTypePurpose
NUXT_SITE_TOKENEncrypted secretAPI password for MCP/scripts/curl (at least 8 characters, no whitespace, keep it stable)
NUXT_SESSION_SECRETEncrypted secretSigns dashboard sessions — Google sign-in fails without it
NUXT_GOOGLE_CLIENT_IDVariableGoogle OAuth client id (Web application type)
NUXT_GOOGLE_CLIENT_SECRETEncrypted secretGoogle OAuth client secret
NUXT_SUPER_ADMIN_EMAILSVariableYour Google address — grants the superadmin role
NUXT_CF_ACCOUNT_IDVariableRecommended for analytics
NUXT_CF_API_TOKENEncrypted secretRecommended for analytics

Register https://<your-domain>/api/auth/google/callback as an authorized redirect URI in the Google Cloud console.

Analytics details: Analytics and Realtime. Full list: configuration.

Confirm bindings use the exact names DB, KV, ANALYTICS, R2, and AI.

4. Deploy and first use ​

Start a build from master and wait until it finishes.

  1. Open /dashboard and sign in with Google
  2. Open Dashboard → Links once (one-time storage setup)
  3. Create a link

First open of Links

Until storage setup finishes, creating links may fail with “storage not ready” (HTTP 423).

Later upgrades: Upgrading Sink.