chore(infra): migrate desktop web to Cloudflare#4869
Conversation
Replaces separate Vercel deployments (follow SPA + follow-external-ssr) with unified Cloudflare Workers + Assets deployment. Implements meta tag injection, OG image generation, and environment variable management in Hono-based Worker. Adds GitHub Actions CI/CD for automatic deployment on push to dev/main branches. - Replace Fastify with Hono for Cloudflare Workers compatibility - Create Worker entry point with SSR routes and SPA fallback - Add AsyncLocalStorage-based request context shim - Implement WASM-based OG image rendering with R2 font storage - Split SPA and SSR routing: /share/* and auth routes use SSR, others fallback to SPA - Add Cloudflare wrangler configuration with dev/prod environments - Create GitHub Actions workflow for automated deployments - Add build scripts for font data and WASM patching Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SafeDep Report Summary⚠ 1 packages are identified as suspicious, human review is recommended. Package Details
This report is generated by SafeDep Github App |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95eb0378b6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
apps/ssr/tsdown.worker.config.ts
Outdated
| "./src/lib/og/fonts": "./src/lib/og/fonts.worker", | ||
| "../../lib/og/render-to-image": "../../lib/og/render-to-image.worker", | ||
| "./src/lib/load-env": "./src/lib/load-env.worker", | ||
| "@fastify/request-context": path.resolve(__dirname, "src/lib/worker-request-context.ts"), |
There was a problem hiding this comment.
Import
path before resolving worker alias
The worker tsdown config references path.resolve(...) without importing path, so loading this config throws ReferenceError: path is not defined and build:worker terminates before producing the Worker bundle. This blocks the Cloudflare deploy path that depends on tsdown --config tsdown.worker.config.ts succeeding.
Useful? React with 👍 / 👎.
| const weight = weights.find((w) => file.includes(w.weight.toString())) | ||
| if (!weight) continue | ||
| const data = fs.readFileSync(path.join(snFontsDirPath, file)) | ||
| fontsData[`sn-pro-${weight.weight}`] = data.toString("base64") |
There was a problem hiding this comment.
Keep each SN Pro subset when generating font data
This assignment keys every SN Pro file only by weight, so the 40 subset files from @fontsource/sn-pro overwrite each other and only one file per weight survives in fonts-data.ts. Because subset filenames encode different glyph ranges (latin, cyrillic, etc.) and readdirSync ordering is not guaranteed across environments, OG rendering can lose characters for scripts not present in the last-seen subset.
Useful? React with 👍 / 👎.
Worker-specific files (*.worker.ts) use Cloudflare Workers types and generated modules that aren't available during the main tsc typecheck. Exclude them from tsconfig since they're only used via tsdown aliases. Also fix broken path.resolve reference in tsdown.worker.config.ts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>



Summary
Replaces separate Vercel deployments (follow SPA + follow-external-ssr) with unified Cloudflare Workers + Assets deployment. Implements meta tag injection, OG image generation, and environment variable management in Hono-based Worker for Workers compatibility.
Changes
Status: Dev environment (dev.folo.is) deployed via folo-ssr-dev Worker. Prod (app.folo.is) ready pending DNS setup.
🤖 Generated with Claude Code