部署
静态页面、Workers API、DigitalOcean 数据库。
此 repo 已按指定架构整理:Cloudflare 提供静态资产及 edge proxy,DigitalOcean 负责持久化资料。
Cloudflare Pages
Static Astro build served from `dist`. No server rendering, no database binding, no D1.
Cloudflare Worker
Edge API proxy at `/api/*`; validates CORS/JWT, caches safe GET responses, and forwards to DigitalOcean.
DigitalOcean API
Fastify service owns auth, question attempts, job ingestion, and analytics queries.
PostgreSQL on DigitalOcean
Only database backend. Keep it private to the VPS or managed database network.
Cloudflare Pages settings
- Build command
- npm run build
- Output directory
- dist
- API routing
- Bind `/api/*` to the Worker route or set `PUBLIC_API_BASE`.