Build Canada public website. Next.js on Cloudflare Workers via OpenNext.
Two Cloudflare Workers running from the same repo:
| Worker | Entry Point | Purpose |
|---|---|---|
website |
custom-worker.ts |
Next.js app (HTTP only) |
website-worker |
worker/index.ts |
Queue consumer + cron triggers |
npm install
npm run devOptionally start the queue worker (for testing queue behavior):
npm run worker:devRequires .dev.vars with DATABASE_URL.
CI (Cloudflare Workers Builds) deploys the Next.js app automatically on push:
- Build command:
npm ci && npm run build:prod - Deploy command:
npm run deploy:app
Queue worker is deployed separately:
npm run deploy:workerBoth at once (local only):
npm run deploy:allRequired on both workers:
npx wrangler secret put DATABASE_URL
npx wrangler secret put DATABASE_URL --config worker/wrangler.jsonc| Schedule | Job |
|---|---|
0 * * * * |
Hourly job |