Skip to content

Conversation

@Biki-dev
Copy link
Collaborator

@Biki-dev Biki-dev commented Dec 8, 2025

Summary

This PR adds a detailed, beginner-friendly deployment guide for running the project on Cloudflare Workers with R2-backed Incremental Static Regeneration (ISR). It includes step-by-step instructions for creating the R2 bucket, configuring open-next.config.ts, and the required wrangler.jsonc changes, plus troubleshooting tips for Windows users.

What I changed

  • Added/updated Cloudflare Workers deployment doc (docs/Cloudflare_Workers_Deploy.md or README section)
  • Included open-next.config.ts examples for enabling R2
  • Provided wrangler.jsonc example with r2_buckets binding
  • Clarified .dev.vars usage and .env.local guidance
  • Listed common errors and fixes (R2 binding, compatibility_date, resvg.wasm Windows issue)

How to test

  1. Ensure your Cloudflare account has R2 enabled and a payment method.
  2. Create an R2 bucket named next-inc-cache in Cloudflare.
  3. Update open-next.config.ts and wrangler.jsonc per the new docs.
  4. Run:
    npm install
    npm run deploy
    

Closes #146

@vercel
Copy link

vercel bot commented Dec 8, 2025

@Biki-dev is attempting to deploy a commit to the dayuanjiang's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Biki-dev
Copy link
Collaborator Author

Biki-dev commented Dec 8, 2025

@DayuanJiang pls review

@DayuanJiang
Copy link
Owner

Thanks again! I’ll review it shortly.

One small suggestion: since the added doc is quite long, it would be nicer as a separate file (easier to read and maintain).

Out of curiosity — have you tried deploying this change on Cloudflare yourself yet?

@Biki-dev
Copy link
Collaborator Author

Biki-dev commented Dec 8, 2025

Out of curiosity — have you tried deploying this change on Cloudflare yourself yet?

Yes i did

- Move Cloudflare_Deploy.md to docs/ folder
- Add 'Deploy without R2' option for simple/free deployments
- Add workers.dev subdomain registration instructions
- Add missing global_fetch_strictly_public flag
- Add troubleshooting for common deployment issues
- Update README.md link to new location
Resolved conflicts in package.json and package-lock.json:
- Combined cloudflare scripts (preview, deploy, upload, cf-typegen) with electron scripts
- Added @opennextjs/cloudflare dependency
- Updated @openrouter/ai-sdk-provider to ^1.5.4
- Added wrangler to devDependencies
- Preserved wait-on and overrides from main
- Use dynamic import for @opennextjs/cloudflare to avoid loading workerd during builds
- Regenerate package-lock.json with cross-platform dependencies
- Use main branch's package-lock.json as base to ensure cross-platform deps
- Add @opennextjs/cloudflare and wrangler
@DayuanJiang
Copy link
Owner

Tested the deployment and it works! Made a few fixes:

  • Moved docs to docs/ folder and improved the guide with clearer R2 vs non-R2 options
  • Fixed the initOpenNextCloudflareForDev() to use dynamic import so it doesn't break Docker builds
  • Merged latest main and resolved conflicts

@DayuanJiang DayuanJiang merged commit 9ac99a4 into DayuanJiang:main Dec 27, 2025
4 of 5 checks passed
zhoujie0531 pushed a commit to zhoujie0531/next-ai-draw-io that referenced this pull request Dec 29, 2025
…s-provider

* origin/main:
  feat: improve quota toast with ByteDance Doubao sponsorship info and model config button (DayuanJiang#447)
  feat: add doubao provider and ByteDance sponsorship (DayuanJiang#329)
  feat: move History and Download buttons to Settings dialog for cleaner chat interface (DayuanJiang#442)
  fix(deps): update dependency jsdom to v27 (DayuanJiang#438)
  chore(deps): update dependency node to v24 (DayuanJiang#435)
  fix(deps): update dependency open to v11 (DayuanJiang#439)
  chore(deps): update docker/build-push-action action to v6 (DayuanJiang#436)
  [Feature] Add Cloudflare Worker as deployment option (DayuanJiang#170)
  chore: add enhancement issue template (DayuanJiang#434)
  chore(deps): update aws-actions/configure-aws-credentials action to v5
  chore(deps): update actions/setup-node action to v6
  style: auto-format with Biome
  chore(deps): update actions/checkout action to v6
  fix(deps): update minor and patch dependencies
  style: auto-format with Biome
  style: auto-format with Biome
  chore(deps): update radix ui packages
  chore(deps): update core framework packages
  feat: migrate DynamoDB quota to composite key schema (DayuanJiang#426)
  fix: switch app logo based on theme
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.

[Feature] Add Cloudflare Worker as deployment option

2 participants