Skip to content

Conversation

@dario-piotrowicz
Copy link
Member

@dario-piotrowicz dario-piotrowicz commented Oct 31, 2025

Description

This PR adds various open-next improvements to the site (mainly for better performance)

The changes are:

  • bumped @opennextjs/cloudflare to the latest version (1.12.0)
  • replaced the kv incremental cache with the more performance r2 + regional cache implementation
  • Added a DurableObject queue that was missing for time-based revalidation
  • Enabled the open-next cache interception
  • Added a custom image loader for the Cloudflare deployment
  • Build open-next version of the site using --turbo 🚀
  • Remove the no longer needed build:default script

Validation

I've validated these changes locally by running pnpm cloudflare:preview

The workflow running on this PR also validates the open-next build.

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

Copilot AI review requested due to automatic review settings October 31, 2025 18:34
@dario-piotrowicz dario-piotrowicz requested review from a team as code owners October 31, 2025 18:34
@vercel
Copy link

vercel bot commented Oct 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nodejs-org Ready Ready Preview Nov 25, 2025 10:13pm

@dario-piotrowicz
Copy link
Member Author

@vicb it would be great if you could have a look and validate the open-next changes if you get a chance 🙂

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR upgrades the @opennextjs/cloudflare package from version 1.6.4 to 1.11.0 and implements enhanced caching and image optimization features for the Cloudflare deployment.

Key changes:

  • Upgraded @opennextjs/cloudflare to version 1.11.0, which includes updated dependencies like @opennextjs/aws and new packages (rclone.js, @types/rclone.js, adm-zip)
  • Migrated from KV-based caching to R2-based incremental caching with regional cache support and Durable Objects queue
  • Added custom Cloudflare image loader to leverage Cloudflare's image transformation service

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pnpm-lock.yaml Updated package versions including @opennextjs/cloudflare (1.6.4→1.11.0), @opennextjs/aws (3.7.4→3.8.5), and added new dependencies (rclone.js, @types/rclone.js, adm-zip)
apps/site/package.json Upgraded @opennextjs/cloudflare dependency specification to ^1.11.0
apps/site/wrangler.jsonc Replaced KV namespace with R2 bucket configuration and added Durable Objects bindings for queue handling
apps/site/open-next.config.ts Updated configuration to use R2-based incremental cache with regional caching, DO queue, and cache interception
apps/site/next.config.mjs Added conditional image loader configuration to use Cloudflare's custom image loader when deploying to Cloudflare
apps/site/cloudflare-image-loader.ts New file implementing custom image loader for Cloudflare's image transformation service
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.37%. Comparing base (563f9eb) to head (8b26595).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8304      +/-   ##
==========================================
- Coverage   76.40%   76.37%   -0.03%     
==========================================
  Files         118      118              
  Lines        9928     9928              
  Branches      334      335       +1     
==========================================
- Hits         7585     7583       -2     
- Misses       2341     2343       +2     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dario-piotrowicz dario-piotrowicz force-pushed the dario/open-next-improvements branch from 93cdecb to 28ccc13 Compare October 31, 2025 18:40
@avivkeller avivkeller changed the title Apply various open-next improvements chore(open-next): apply various improvements Oct 31, 2025
@avivkeller avivkeller added the github_actions:pull-request Trigger Pull Request Checks label Oct 31, 2025
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Oct 31, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 31, 2025

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟠 78 🟠 88 🟢 100 🟢 100 🔗
/en/about 🟢 100 🟢 93 🟢 100 🟠 88 🔗
/en/about/previous-releases 🟢 99 🟢 93 🟢 100 🟢 100 🔗
/en/download 🟢 97 🟢 96 🟢 100 🟢 100 🔗
/en/download/archive/current 🟢 100 🟢 100 🟢 100 🟢 100 🔗
/en/blog 🟢 100 🟢 100 🟢 96 🟢 100 🔗

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.

Changes look good to me when comments are addressed, thanks Dario!

A few notes:

  • Cloudflare images need to be enabled/configured for the account
  • R2 batch upload had been implemented recently to speed up cache asset upload. There are a few environment variables to set for this to work. I'll write the doc for it this week. Before that R2 upload could be slow.

@ovflowd
Copy link
Member

ovflowd commented Nov 3, 2025

Thanks Victor for the updates. Will keep an eye on your docs. Also, where can we enabled Cloudflare Images?

@dario-piotrowicz
Copy link
Member Author

where can we enabled Cloudflare Images?

https://developers.cloudflare.com/images/get-started/#enable-transformations-on-your-zone

I already did that on the testing/staging account

@vicb
Copy link
Contributor

vicb commented Nov 3, 2025

Thanks Victor for the updates. Will keep an eye on your docs. Also, where can we enabled Cloudflare Images?

opennextjs/docs#189 about R2 batching was just merged to the docs.

The 3 environments variables should be added the build time time env vars (provided you use Cloudflare CD).

@dario-piotrowicz dario-piotrowicz force-pushed the dario/open-next-improvements branch from 0192bce to dbf3b69 Compare November 25, 2025 21:57
Co-authored-by: Claudio Wunder <[email protected]>
Signed-off-by: Dario Piotrowicz <[email protected]>
Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

LGTM!

@ovflowd
Copy link
Member

ovflowd commented Nov 25, 2025

:shipit: :shipit: 🚀

@dario-piotrowicz
Copy link
Member Author

dario-piotrowicz commented Nov 25, 2025

we should have a specific document/documentation for the specific image loader and how it works and external ref.

@ovflowd regarding the image loader documentation, I've added a very fried section in the md file with a link to the cloudflare docs: dbf3b69 as I didn't feel like more was needed, but please let me know if you think that this might not suffice 🙂

@dario-piotrowicz
Copy link
Member Author

LGTM!

Thanks @ovflowd! Sorry this PR took a while! 😅

@ovflowd
Copy link
Member

ovflowd commented Nov 25, 2025

we should have a specific document/documentation for the specific image loader and how it works and external ref.

@ovflowd regarding the image loader documentation, I've added a very fried section in the md file with a link to the cloudflare docs: dbf3b69 as I didn't feel like more was needed, but please let me know if you think that this might not suffice 🙂

Yeah, if it has a link to other external resources (if any available) that'd be good, except that. Feel free to merge the PR

LGTM!

Thanks @ovflowd! Sorry this PR took a while! 😅

You good! Appreciate for the patience here ❤️

@dario-piotrowicz
Copy link
Member Author

I've enabled auto-merge 🙂

@avivkeller could you go back to the unresolved conversations you started and make sure you're happy where we landed, and in that case resolve the conversations? 🙂
(of course if you're not happy with any them let's discuss further 😄)

@dario-piotrowicz dario-piotrowicz added this pull request to the merge queue Nov 25, 2025
Merged via the queue into nodejs:main with commit 3a1c20c Nov 25, 2025
12 checks passed
@dario-piotrowicz dario-piotrowicz deleted the dario/open-next-improvements branch November 25, 2025 22:26
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.

5 participants