Skip to content

Host the examples on Cloudflare: embed mode, /html, CI route checks - #3

Merged
pietechsolution merged 5 commits into
mainfrom
feat/hosted-demo
Sep 26, 2026
Merged

pietechsolution merged 5 commits into
mainfrom
feat/hosted-demo

Conversation

@pietechsolution

Copy link
Copy Markdown
Contributor

Prepares the example to run as a hosted demo on Cloudflare Workers and to be embedded in documentation pages.

Changes

  • Cloudflare Workers with OpenNext. Adds wrangler.jsonc (worker seatlayer-examples, nodejs_compat, no account ids or routes), open-next.config.ts (static assets incremental cache, no bucket needed), public/_headers, and preview, deploy and cf-typegen scripts. npm run build is still a plain next build, so Vercel and npm start are unchanged. Next.js moves from 15.1.6 to 15.5.26 because @opennextjs/cloudflare 1.20 supports the 15.5 line.
  • ?embed=1. Set once in app/layout.tsx: a small inline script marks <html> before the first paint, and CSS hides the navigation and the route heading. Works on every route.
  • /html. app/html/index.html is the seat picker as a plain HTML page with the CDN script tag and <YOUR_EVENT_KEY> / <YOUR_PUBLIC_KEY> placeholders. app/html/route.ts fills them from NEXT_PUBLIC_SEATLAYER_EVENT_KEY / NEXT_PUBLIC_SEATLAYER_PUBLIC_KEY per request, and shows a setup message when they are missing. onCheckout posts the hold id to /api/hold, like the single event route. Linked from the navigation as "Plain HTML".
  • /api/events lists only the configured events. The account-wide listing is gone. Without a secret key the route serves the configured keys with placeholder names; with SEATLAYER_SECRET_KEY it reads each configured event's real name with the server SDK. An empty NEXT_PUBLIC_SEATLAYER_EVENT_KEY_2 / _3 now falls back to the main key instead of producing an empty key. Wording updated in .env.example, the README, the events page and the checkout handoff page.
  • CI route checks. CI still builds every push. When the DEMO_EVENT_KEY and DEMO_PUBLIC_KEY repository secrets exist (optional DEMO_SEASON_KEY), it starts the app and runs scripts/check-routes.mjs, which loads every route with and without ?embed=1 in Chromium and fails on an HTTP error, an uncaught exception, a console error, or a visible navigation in embed mode. Forks without the secrets only build.
  • README. A new "Hosting on Cloudflare" section at the end. No other README sections changed except one sentence about the events route.

Verification

  • npm ci && npm run build from a clean checkout.
  • npx opennextjs-cloudflare build succeeds; opennextjs-cloudflare preview (local workerd) returns 200 for every route, /api/events, and /html with the placeholders filled.
  • next dev without keys: scripts/check-routes.mjs passes on all 16 route and embed combinations (setup notices, no console errors, no hydration warnings, navigation hidden with ?embed=1).
  • With dummy keys against the local worker the chart routes fail the check with a 404 from the API, as expected, which confirms the check catches a broken event.

Nothing was deployed.

Held: merge when the hosted demo is ready.

Adds wrangler.jsonc, open-next.config.ts and preview, deploy and cf-typegen
scripts. npm run build is still a plain next build. Next.js moves to 15.5.26,
the release line the adapter supports.
With a secret key the route now reads the real names of the configured event
keys instead of listing events from the account. An empty optional event key
now falls back to the main one.
@pietechsolution
pietechsolution merged commit 1839283 into main Sep 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants