Skip to content

Conversation

@2u841r
Copy link

@2u841r 2u841r commented Nov 24, 2025

This PR introduces a new CLI workflow that automates the 10+ step migration process for existing Next.js applications moving to OpenNext.js for Cloudflare.

What’s included

  • Adds support for:

    npx opennextjs-cloudflare migrate
    
  • Automatically generates or updates all required files for Cloudflare deployment:

    • wrangler.jsonc
    • open-next.config.ts
    • .dev.vars
    • Next.js configuration updates
    • Package.json scripts (dev, deploy, etc.)
  • Detects whether the project uses the Edge runtime and configures accordingly.

  • Provides an interactive package manager selector with keyboard navigation:

    • npm
    • pnpm
    • yarn
    • bun
    • deno
  • Performs a full end-to-end setup with zero manual steps.

Why this is useful

The existing migration guide requires following more than 10 manual steps. This flow automates the entire process, reducing setup time from several minutes to just a few seconds.
It ensures consistency, prevents misconfiguration, and improves the onboarding experience for developers migrating their existing projects.

Notes

  • This PR only affects the CLI workflow and does not change the underlying runtime.
  • Documentation can later include this automated command as the recommended approach for existing app migration.

@changeset-bot
Copy link

changeset-bot bot commented Nov 24, 2025

🦋 Changeset detected

Latest commit: e7b6473

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

}

// Step 3: Create/update wrangler.jsonc
console.log("⚙️ Creating wrangler.jsonc...");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 "services": [
    {
      "binding": "WORKER_SELF_REFERENCE",
      // The service should match the "name" of your worker
      "service": "my-app",
    },
  ],

missing in templates/wrangler.jsonc
also- comments/explanation only for r2_buckets, not other keys.

while in docs comments for almost all keys/values + "services" key is there.

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

Definitely a good idea but the implementation needs some work.

(I'll comment further later)

@2u841r
Copy link
Author

2u841r commented Nov 24, 2025

Thanks for the PR.

Definitely a good idea but the implementation needs some work.

(I'll comment further later)


  • Allow edits by maintainers

Thanks for the feedback!
I’ve done everything I could from my side — feel free to adjust or rewrite anything as you think best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants