vercel-to-cloudflareMigrate 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...
Install via ClawdBot CLI:
clawdbot install jiafar/vercel-to-cloudflareMigrate a Next.js + Supabase project from Vercel to Cloudflare Workers with Hyperdrive connection pooling.
python3 scripts/analyze_project.py <project-path>
python3 scripts/migrate.py <project-path>
npm install @opennextjs/cloudflare
Update next.config.js or next.config.ts if needed.
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');
}
// 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.
name = "my-app"
main = ".open-next/worker.js"
compatibility_date = "2024-09-23"
compatibility_flags = ["nodejs_compat"]
[[hyperdrive]]
binding = "HYPERDRIVE"
id = "<your-hyperdrive-id>"
getCloudflareContext() only works during request handling, not at module load time.Generated Feb 25, 2026
A startup using Next.js and Supabase on Vercel faces escalating hosting costs as user traffic grows. They migrate to Cloudflare Workers to leverage lower pricing and global edge deployment, integrating Hyperdrive for efficient database connection pooling to maintain performance while reducing expenses.
An e-commerce platform experiences latency issues with their Vercel-hosted Next.js app during peak sales events. By migrating to Cloudflare Workers, they achieve faster edge responses and use Hyperdrive to optimize Supabase connections, improving page load times and customer experience.
A web development agency manages multiple client projects on Vercel but struggles with deployment complexity and costs. They adopt this skill to standardize migrations to Cloudflare Workers, streamlining workflows with automated scripts and Hyperdrive setup for consistent, scalable deployments.
A SaaS company expanding internationally needs lower-latency deployments across regions. They migrate from Vercel to Cloudflare Workers to utilize edge computing, configuring Hyperdrive for reliable Supabase connectivity to support global users with reduced data transfer delays.
Offer a free analysis tool to scan projects for migration readiness, with paid tiers for automated migration scripts, Hyperdrive configuration support, and ongoing maintenance. Revenue comes from subscription plans and one-time setup fees for enterprise clients.
Provide expert consulting services to help businesses migrate from Vercel to Cloudflare Workers, including custom code refactoring, Hyperdrive integration, and performance tuning. Revenue is generated through hourly rates or project-based contracts.
Conduct workshops and online courses teaching developers how to use this skill for migrations, covering best practices, pitfalls, and hands-on exercises. Revenue streams include course fees, certification programs, and corporate training packages.
π¬ Integration Tip
Ensure Hyperdrive connects to Supabase on port 5432, not the pooler port 6543, and disable SSL for Hyperdrive connections to avoid common errors during migration.
Automatically update Clawdbot and all installed skills once daily. Runs via cron, checks for updates, applies them, and messages the user with a summary of what changed.
Full desktop computer use for headless Linux servers. Xvfb + XFCE virtual desktop with xdotool automation. 17 actions (click, type, scroll, screenshot, drag,...
Essential Docker commands and workflows for container management, image operations, and debugging.
Tool discovery and shell one-liner reference for sysadmin, DevOps, and security tasks. AUTO-CONSULT this skill when the user is: troubleshooting network issues, debugging processes, analyzing logs, working with SSL/TLS, managing DNS, testing HTTP endpoints, auditing security, working with containers, writing shell scripts, or asks 'what tool should I use for X'. Source: github.com/trimstray/the-book-of-secret-knowledge
Deploy applications and manage projects with complete CLI reference. Commands for deployments, projects, domains, environment variables, and live documentation access.
Monitor topics of interest and proactively alert when important developments occur. Use when user wants automated monitoring of specific subjects (e.g., product releases, price changes, news topics, technology updates). Supports scheduled web searches, AI-powered importance scoring, smart alerts vs weekly digests, and memory-aware contextual summaries.