The site is a statically prerendered snapshot of the Choo/Jalla SSR app, served from Cloudflare Pages with a few dynamic endpoints as Pages Functions.
npm run build # jalla bundles the client → dist/public (content-hashed)
node bin/prerender.js # boots `node server.js` (serve mode), crawls every route,
# writes static HTML + assets + _redirects + _headers → out/
bin/prerender.jsenumerates routes from the Choo router (wayfarer) and expands dynamic routes vialib/resolve-route.js(queries Prismic for posts, events, products, courses, pages).- The crawl snapshots server-rendered HTML, which already contains
window.initialState+ hashed bundle URLs, so the SPA hydrates client-side. - Content is re-fetched client-side by
stores/prismic.js, so the static HTML is the first-paint/SEO layer and the live app self-heals.
Local preview of the built site incl. Functions: npm run preview
(npx wrangler pages dev out).
Create a Pages project named digjourney connected to this Git repo:
- Build command:
npm run pages:build - Build output directory:
out - Node version: 18 (set
NODE_VERSION=18env var if needed) - Environment variables (Production):
HOST=digjourney.comHUBSPOT_API_KEY=…(secret)HUBSPOT_SUBSCRIPTION_ID=…
- Functions runtime config lives in
wrangler.toml(compatibility_flags = ["nodejs_compat"]).
Create a Deploy Hook in the Pages project and point the Prismic webhook at that URL. Publishing in Prismic then triggers a fresh prerender + deploy (≈1–3 min, vs. the old instant cache purge — this is the main behavior change).
The old /api/prismic-hook purge endpoint and lib/purge.js were removed.
functions/media/[[path]].js— image proxy backed by Cloudflare Image Transformations (cf.image). Keeps the legacy/media/:type/:transform/:uriURL shape but resizes the remote Prismic source on Cloudflare's edge (no more Cloudinary). Requires Image Transformations to be enabled on the zone (dashboard → Images → Transformations → enable fordigjourney.com).functions/api/subscribe.js— HubSpot newsletter signup.functions/api/prismic-preview.js— sets the preview cookie + redirects.
Image Transformations have a monthly free allowance of unique transformations and are billed per unique transformation beyond it — smaller than Cloudinary's free tier, so confirm current pricing. The output is cached on the edge, so only unique (URL + options) transforms are billed.
- Rotate the Cloudflare API key that was previously hardcoded in
lib/purge.js(it's in git history — treat as compromised). - Enable Image Transformations on the
digjourney.comzone (dashboard → Images → Transformations). - Create the Pages project + env vars; deploy and smoke-test on the
*.pages.devURL. - Configure the Prismic webhook → Pages Deploy Hook.
- Point the apex/
wwwDNS records at the Pages project (custom domain). - Decommission the fly.io app (
digjourney);fly.tomlis no longer used.
Pages whose Prismic parent link is broken (e.g. /ett-case) resolve to a
bare /uid that the old server redirected in a loop; they are not prerendered
and will 404. Fix the parent link in Prismic, or the page will need a manual
_redirects entry.