Skip to content

Commit 14c42fc

Browse files
ChanMeng666claude
andcommitted
feat: migrate from Vercel to Cloudflare Workers
- Add @opennextjs/cloudflare adapter and wrangler - Create wrangler.jsonc and open-next.config.ts - Add build:worker, preview:worker, deploy scripts - Set images.unoptimized for Cloudflare compatibility - Update Stripe webhook to use async WebCrypto API - Add GitHub Actions workflow for CI/CD deployment - Update .gitignore for Cloudflare build artifacts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0dcb61f commit 14c42fc

9 files changed

Lines changed: 20132 additions & 6511 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy to Cloudflare Workers
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
workflow_dispatch:
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '22'
19+
cache: 'npm'
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Build and Deploy
25+
env:
26+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
27+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
28+
run: npm run deploy
29+
30+
- name: Output deployment URL
31+
run: |
32+
echo "## Deployment Complete! 🚀" >> $GITHUB_STEP_SUMMARY
33+
echo "" >> $GITHUB_STEP_SUMMARY
34+
echo "Your app is now live at: https://libraryos.chanmeng-dev.workers.dev" >> $GITHUB_STEP_SUMMARY
35+
echo "" >> $GITHUB_STEP_SUMMARY
36+
echo "### Post-deployment checklist:" >> $GITHUB_STEP_SUMMARY
37+
echo "- [ ] Update Stripe webhook URL" >> $GITHUB_STEP_SUMMARY
38+
echo "- [ ] Update Supabase redirect URLs" >> $GITHUB_STEP_SUMMARY
39+
echo "- [ ] Update NEXT_PUBLIC_APP_URL secret in Cloudflare" >> $GITHUB_STEP_SUMMARY

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ next-env.d.ts
4242
/.vscode
4343
.env*.local
4444

45+
# Cloudflare
46+
.open-next/
47+
.wrangler/
48+
.dev.vars
49+
4550
# Claude Code local settings
4651
.claude/settings.local.json
4752

next.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ const nextConfig = {
33
typescript: {
44
ignoreBuildErrors: true,
55
},
6+
images: {
7+
unoptimized: true,
8+
},
69
}
710

811
module.exports = nextConfig

open-next.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { defineCloudflareConfig } from "@opennextjs/cloudflare";
2+
3+
export default defineCloudflareConfig();

0 commit comments

Comments
 (0)