Cursor·Prompt

Cursor Prompt: Deploy Next.js to Cloudflare Workers

When to Use This Prompt

Use this when you want to deploy your Next.js app to Cloudflare's global edge network instead of Vercel.

The Prompt

Configure this Next.js app for deployment to Cloudflare Workers:

1. Install @opennextjs/cloudflare
2. Create wrangler.jsonc with proper configuration
3. Create open-next.config.ts
4. Add deploy scripts to package.json:
   - 'preview': local preview with wrangler dev
   - 'deploy': production deployment
5. Set up D1 database binding if using a database
6. Configure environment variables via wrangler secrets
7. Set up custom domain in wrangler.jsonc

Make sure to handle:
- Edge runtime compatibility
- Static asset serving
- API route compatibility
- Environment variable access

What to Customize

Update the database binding name and custom domain to match your project. Add any additional Cloudflare bindings you need.

Expected Output

Configuration files (wrangler.jsonc, open-next.config.ts) and updated package.json scripts. 3-4 files.