Moved portfolio site infrastructure from Vercel to Cloudflare Pages, built an admin dashboard, and set up an AI news auto-generation pipeline. 20+ commits over 3 days.
Vercel → Cloudflare migration
Vercel's cron requires the Pro plan. Needed twice-daily AI news generation but couldn't use cron on the free tier. Moved to Cloudflare Pages and separated cron into GitHub Actions.
Migration checklist
- Change adapter to
@astrojs/cloudflareinastro.config.mjs - Add
wrangler.toml - Register environment variables in Cloudflare dashboard
- Disable Preview builds (deploy main branch only)
- Set up 3 GitHub Actions cron jobs
# .github/workflows/cron-ai-news.yml
on:
schedule:
- cron: '0 0,12 * * *' # UTC 0, 12 = KST 9AM, 9PM
Cloudflare Pages has fast builds and a generous free tier. However, SDKs using
node:built-in modules won't work.
AI news auto-generation
Generates AI news automatically twice daily (KST 9AM, 9PM).
Source collection
Crawls 5 sources for AI-related news:
- Google Custom Search — "AI" keyword search
-
Hacker News —
/topstoriesAPI -
Reddit — hot posts from
/r/artificial,/r/MachineLearning - X (Twitter) — AI trending topics
- GitHub Trending — today's trending repos
Post generation with Claude
Collected news goes to Claude Haiku, which generates individual deep-dive posts per topic. Initially used model-grouped (Claude, GPT, Gemini) list posts, then switched to topic-based individual posts.
Switched model from Sonnet 4 to Haiku 4.5 — generating 20+ posts daily made cost an issue. Quality difference was negligible.
Admin dashboard
Built /admin page for at-a-glance site operations monitoring.
Tabs
- Overview: visitor heatmap, stat cards, build logs by project, Top Engagement
- Quick Actions: AI news generation, site rebuild, Dev.to sync
- Content: full content list with type filters
- Comments: comment management with delete
Visitor heatmap
GitHub Contributions-style calendar heatmap. Fetches 90 days from Upstash Redis. Includes month labels, day labels, and hover tooltips.
Dev.to cross-posting
GitHub Actions workflow auto-publishes content to Dev.to.
How it works
- Detects changes in
src/content/subdirectories - Queries Dev.to API for existing articles (dedup via canonical_url)
- Publishes only new posts via
POST /api/articles
Posts tagged with devto-migration source are excluded (they originated from Dev.to). Rate limit handled with 3-second intervals.
Gotcha: SDKs on Cloudflare Workers
Importing @anthropic-ai/sdk on Cloudflare Workers triggers node:events module errors. Workers run on V8 isolates, not Node.js.
Solution: use fetch directly instead of the SDK.
Summary
- Cloudflare Pages + GitHub Actions cron enables scheduling without Vercel Pro.
- AI news automation: 5-source crawl → Claude Haiku post generation → twice daily.
- Admin dashboard: SSR API + client-side rendering for quick setup.
-
Use
fetchover SDKs on Cloudflare Workers. Libraries with Node.js dependencies won't work.
📌 Originally published at Jidong Lab
More AI news and dev logs → jidonglab.com
Top comments (0)