HKPublicCareer.com 香港公職考試及職位準備

部署

靜態頁面、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` 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://...