linkoi docsWebsite ↗

Deploy the Worker

Run your metadata endpoint on Cloudflare.

Developer preview

Version 0.1.1 is available on npm. Install @linkoi/core to use the extraction library, or add @linkoi/worker for Cloudflare deployment.

Prepare the workspace#

sh
npm init -y
npm install @linkoi/core@0.1.1 @linkoi/worker@0.1.1
npm install --save-dev wrangler

Create index.js containing export { default } from "@linkoi/worker"; and a wrangler.json file:

json
{
  "name": "my-linkoi",
  "main": "index.js",
  "compatibility_date": "2026-09-24",
  "compatibility_flags": ["nodejs_compat"],
  "workers_dev": false,
  "kv_namespaces": [{"binding": "META_CACHE", "id": "REPLACE_WITH_YOUR_KV_NAMESPACE_ID"}],
  "vars": {"SELF_HOSTS": "YOUR-WORKER.YOUR-SUBDOMAIN.workers.dev"}
}

Create the cache#

sh
npx wrangler kv namespace create META_CACHE

Replace REPLACE_WITH_YOUR_KV_NAMESPACE_ID in wrangler.json with the returned namespace ID. Choose your own Worker name. Keep nodejs_compat enabled.

Configure the Worker#

SettingDefault
MAX_HTML_BYTES2097152
FETCH_TIMEOUT_MS5000
FRESH_TTL_SECONDS86400
STALE_TTL_SECONDS604800
SELF_HOSTSComma-separated hostnames to reject. Set this to your API hostname.

Deploy and set secrets#

To avoid exposing an unauthenticated endpoint during setup, add "workers_dev": false to the config and leave routes unset for the first deployment.

sh
npx wrangler deploy --config wrangler.json
npx wrangler secret put API_KEY --config wrangler.json
# Optional provider integration
npx wrangler secret put YOUTUBE_API_KEY --config wrangler.json

After the secrets are configured, enable workers_dev or add your custom domain and deploy again. Add rate limits appropriate to your use case.

Verify the endpoint#

sh
curl "https://YOUR-WORKER.YOUR-SUBDOMAIN.workers.dev/health" \
  -H "Authorization: Bearer $LINKOI_API_KEY"

Expect { "ok": true }. Then test an extraction using the HTTP API guide.

Linkoi · PolyForm Shield 1.0.0