Deployment
Static Pages, Workers API, DigitalOcean database.
The repo is wired for the requested architecture: Cloudflare hosts static assets and the edge proxy; DigitalOcean owns all persistent data.
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` to the Worker origin.
Required environment
Worker variable
DO_API_ORIGIN=https://your-digitalocean-api
Worker secret
JWT_SECRET
DigitalOcean API variable
DATABASE_URL=postgres://...