# Send Vercel to Cloudflare Worker Migration to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "vercel-to-cloudflare",
    "name": "Vercel to Cloudflare Worker Migration",
    "source": "tencent",
    "type": "skill",
    "category": "效率提升",
    "sourceUrl": "https://clawhub.ai/jiafar/vercel-to-cloudflare",
    "canonicalUrl": "https://clawhub.ai/jiafar/vercel-to-cloudflare",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/vercel-to-cloudflare",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=vercel-to-cloudflare",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md",
      "references/env-patterns.md",
      "references/hyperdrive-setup.md",
      "scripts/analyze_project.py"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "vercel-to-cloudflare",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-01T14:42:50.393Z",
      "expiresAt": "2026-05-08T14:42:50.393Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=vercel-to-cloudflare",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=vercel-to-cloudflare",
        "contentDisposition": "attachment; filename=\"vercel-to-cloudflare-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "vercel-to-cloudflare"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/vercel-to-cloudflare"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/vercel-to-cloudflare",
    "downloadUrl": "https://openagent3.xyz/downloads/vercel-to-cloudflare",
    "agentUrl": "https://openagent3.xyz/skills/vercel-to-cloudflare/agent",
    "manifestUrl": "https://openagent3.xyz/skills/vercel-to-cloudflare/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/vercel-to-cloudflare/agent.md"
  }
}
```
## Documentation

### Vercel to Cloudflare Worker Migration

Migrate a Next.js + Supabase project from Vercel to Cloudflare Workers with Hyperdrive connection pooling.

### Quick Start

Run the analysis script to scan the project:
python3 scripts/analyze_project.py <project-path>


Review the migration report
Run the migration script:
python3 scripts/migrate.py <project-path>


Configure Hyperdrive: see references/hyperdrive-setup.md

### 1. Install @opennextjs/cloudflare adapter

npm install @opennextjs/cloudflare

Update next.config.js or next.config.ts if needed.

### 2. Rewrite environment variable access

All process.env.XXX for Cloudflare bindings (Hyperdrive, KV, D1, etc.) must use getCloudflareContext():

// BEFORE (Vercel/Node.js)
const url = process.env.DATABASE_URL;

// AFTER (Cloudflare Worker)
import { getCloudflareContext } from '@opennextjs/cloudflare';

function getConnectionInfo() {
  const env = getCloudflareContext().env;
  const hyperdrive = env.HYPERDRIVE as { connectionString?: string } | undefined;
  if (hyperdrive?.connectionString) {
    return { connectionString: hyperdrive.connectionString, source: 'hyperdrive' };
  }
  // Fallback for local dev
  const local = env.CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE;
  if (local) {
    return { connectionString: local, source: 'hyperdrive-local' };
  }
  throw new Error('HYPERDRIVE is not configured');
}

### 3. Refactor global DB singleton to per-request pattern

// BEFORE: Global singleton
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
const client = postgres(process.env.DATABASE_URL!);
export const db = drizzle(client);

// AFTER: Per-request with React cache
import { cache } from 'react';

export const getDb = cache(() => {
  const { connectionString, source } = getConnectionInfo();
  return createDatabase({
    connectionString,
    enableSSL: source === 'hyperdrive' ? false : 'require',
  });
});

Then replace all import { db } with import { getDb } and add const db = getDb() at the start of each function.

### 4. Configure wrangler.toml

name = "my-app"
main = ".open-next/worker.js"
compatibility_date = "2024-09-23"
compatibility_flags = ["nodejs_compat"]

[[hyperdrive]]
binding = "HYPERDRIVE"
id = "<your-hyperdrive-id>"

### Critical Pitfalls

Hyperdrive must connect to Supabase Direct Connection (port 5432), NOT the Pooler (port 6543). Hyperdrive IS a connection pooler — connecting pooler-to-pooler causes errors.


SSL must be disabled for Hyperdrive connections — Worker ↔ Hyperdrive is internal network. Only enable SSL for direct database connections (local dev, build stage).


Cannot initialize DB at module top level — getCloudflareContext() only works during request handling, not at module load time.


Supabase Free Tier direct connection is IPv6 only — local dev may fail if your network doesn't support IPv6. Use the Pooler URL (port 6543) for local development.

### Detailed References

Hyperdrive setup & Supabase config: Read references/hyperdrive-setup.md
Environment variable patterns: Read references/env-patterns.md
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: jiafar
- Version: 1.0.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-01T14:42:50.393Z
- Expires at: 2026-05-08T14:42:50.393Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/vercel-to-cloudflare)
- [Send to Agent page](https://openagent3.xyz/skills/vercel-to-cloudflare/agent)
- [JSON manifest](https://openagent3.xyz/skills/vercel-to-cloudflare/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/vercel-to-cloudflare/agent.md)
- [Download page](https://openagent3.xyz/downloads/vercel-to-cloudflare)