Cloudflare Workers / OpenNext dropped; both apps moved to Vercel serverless

clapointe-carbonleo migrated the frontend and backend off Cloudflare across ten commits in a single afternoon. The process was iterative and included at least one dependency-cull mistake that had to be walked back.

infrastructure

Frontend side: open-next.config.ts is deleted and a five-line vercel.json added. The Cloudflare-specific npm scripts (preview, deploy, upload, cf-typegen) are removed. Then @aws-sdk/client-s3, @aws-sdk/s3-request-presigner, and @opennextjs/cloudflare are all stripped in one commit - and the AWS packages are immediately restored in the next one (0785add, message: "needed for R2 storage"). The fork uses S3-compatible R2 access, so those packages were never Cloudflare-specific; they were caught in a bulk removal by name pattern. The stale package-lock.json is also deleted to clear outdated resolutions.

Backend side is cleaner. 35fd778 adds backend/vercel.json pointing @vercel/node at src/index.ts and wraps app.listen() in a process.env.VERCEL !== "1" guard while exporting app as default - the standard Express-on-Vercel-serverless pattern. The CORS configuration is also improved: a callback-based origin validator replaces the single-string origin, accepting http://localhost:3000, https://mike-legal-three.vercel.app, and process.env.FRONTEND_URL. (The Vercel preview URL changed once during setup: mike-legal-dhz4.vercel.app was corrected to mike-legal-three.vercel.app in a follow-up commit.)

Two things in this batch are worth lifting independently of the deployment target. The Express serverless pattern in backend/src/index.ts (if (process.env.VERCEL !== "1") app.listen(...); export default app;) works for any serverless host, Vercel included. The callback-style CORS origin validator is strictly better than upstream's single-string FRONTEND_URL and handles multiple allowed origins cleanly.

So what Skip if you are not deploying to Vercel - this is a hosting-target swap, not a code improvement. The callback CORS pattern is worth a direct lift regardless of your deployment setup. Treat the AWS-SDK round-trip as a sign that the dependency cull was done by keyword, not by tracing imports.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

10 commits from clapointe-carbonleo/mike-legal, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
cbd47b90 Switch frontend from Cloudflare to Vercel clapointe-carbonleo 2026-05-06 ↗ GitHub
8796dfef Remove Cloudflare dependencies for Vercel deployment clapointe-carbonleo 2026-05-06 ↗ GitHub
1b9a6630 Remove all Cloudflare and AWS SDK dependencies for Vercel clapointe-carbonleo 2026-05-06 ↗ GitHub
e4b92c1d Merge remote main, keep local package.json without AWS SDK clapointe-carbonleo 2026-05-06 ↗ GitHub
c79bdaef Remove package-lock.json to clear stale dependencies clapointe-carbonleo 2026-05-06 ↗ GitHub
0785addf Restore AWS SDK packages needed for R2 storage clapointe-carbonleo 2026-05-06 ↗ GitHub
0756a87d Fix CORS to allow production frontend URL clapointe-carbonleo 2026-05-06 ↗ GitHub
35fd7788 Configure backend as Vercel serverless function clapointe-carbonleo 2026-05-06 ↗ GitHub
333172e1 feat(git): add vercel to gitignore clapointe-carbonleo 2026-05-06 ↗ GitHub
17605a51 Fix CORS: allow mike-legal-three.vercel.app clapointe-carbonleo 2026-05-07 ↗ GitHub

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-11.md from inside the repo you want the changes in.

⬇ Download capture-thread-11.md