โ† All skills
Tencent SkillHub ยท Productivity

Vercel to Cloudflare Worker Migration

Migrate Next.js projects from Vercel to Cloudflare Workers with Supabase/Hyperdrive support. Use when user wants to move a Next.js app off Vercel to reduce c...

skill openclawclawhub Free
0 Downloads
0 Stars
0 Installs
0 Score
High Signal

Migrate Next.js projects from Vercel to Cloudflare Workers with Supabase/Hyperdrive support. Use when user wants to move a Next.js app off Vercel to reduce c...

โฌ‡ 0 downloads โ˜… 0 stars Unverified but indexed

Install for OpenClaw

Quick setup
  1. Download the package from Yavira.
  2. Extract the archive and review SKILL.md first.
  3. Import or place the package into your OpenClaw setup.

Requirements

Target platform
OpenClaw
Install method
Manual import
Extraction
Extract archive
Prerequisites
OpenClaw
Primary doc
SKILL.md

Package facts

Download mode
Yavira redirect
Package format
ZIP package
Source platform
Tencent SkillHub
What's included
SKILL.md, references/env-patterns.md, references/hyperdrive-setup.md, scripts/analyze_project.py

Validation

  • Use the Yavira download entry.
  • Review SKILL.md after the package is downloaded.
  • Confirm the extracted package contains the expected setup assets.

Install with your agent

Agent handoff

Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.

  1. Download the package from Yavira.
  2. Extract it into a folder your agent can access.
  3. Paste one of the prompts below and point your agent at the extracted folder.
New install

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

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.

Trust & source

Release facts

Source
Tencent SkillHub
Verification
Indexed source record
Version
1.0.0

Documentation

ClawHub primary doc Primary doc: SKILL.md 8 sections Open source page

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

Category context

Workflow acceleration for inboxes, docs, calendars, planning, and execution loops.

Source: Tencent SkillHub

Largest current source with strong distribution and engagement signals.

Package contents

Included in package
3 Docs1 Scripts
  • SKILL.md Primary doc
  • references/env-patterns.md Docs
  • references/hyperdrive-setup.md Docs
  • scripts/analyze_project.py Scripts