Skip to main content

Build and Deployment

Cloudflare Pages project settings

Setting Value
Source GitHub pmgasset/fortadamswebsite, production branch main
Framework preset None / Next.js (Static HTML Export)
Build command npm run build
Build output directory out
Node version 20+ (set NODE_VERSION if the default is older)
Functions Auto-detected from the root functions/ directory
  • Production deploys: every push to main, including every Decap publish.
  • Preview deploys: every other branch and PR gets a unique *.pages.dev URL. Preview uses the Preview environment's variables. Set the GHL_* secrets there too, ideally pointing at a test pipeline.

Environment variables

Configure them under Workers & Pages → project → Settings → Variables and Secrets. NEXT_PUBLIC_* values are compiled into the JavaScript bundle, so changing one requires a redeploy. The GHL_* secrets are read by the Function at request time. Full list: Reference → Environment Variables.

Deploying

  • Normal: merge or push to main, then watch Deployments.
  • Rebuild without code changes (for example, to drop past events or pick up a changed env var): Deployments → latest production deployment → ⋯ → Retry deployment.
  • Roll back: Deployments → a previous successful deployment → ⋯ → Rollback to this deployment. This is instant. Remember that the next push to main deploys the current main again, so also revert the bad commit.

Scheduled rebuilds (recommended)

Because "upcoming" events are computed at build time, schedule a daily rebuild:

  1. Pages → Settings → Builds → Deploy hooks: create a hook for main and copy its URL. Treat it as a secret.
  2. Call it daily just after midnight Eastern, from a Cloudflare Worker Cron Trigger (curl -X POST <hook>) or a GitHub Actions schedule workflow.

This hasn't been set up yet; it's tracked in Known Issues and Open Items.

Redirects and headers

  • public/_redirects is copied to out/_redirects and applied by Pages. It currently has one rule (/preservation/restoration-projects/ → /history/#restoration-projects, 301) plus commented, guessed examples. Populate it from a crawl of the old WordPress site before DNS cutover.
  • There's no _headers file. Security headers (CSP, HSTS, etc.) aren't configured at the Pages level. If you add a CSP, allow fareharbor.com, cdn.r2.fortadams.org, crm.fortadams.org, the HighLevel webhook hosts, www.google.com (map iframe), and unpkg.com (for /admin only).

Domains

The production canonical URL is siteConfig.url (https://www.fortadams.org), used for metadataBase, the sitemap, and robots. Attach both apex and www under Pages → Custom domains and redirect one to the other. Confirm the final domain before launch; it's still marked [PLACEHOLDER].