Skip to content

[codex] add Cloudflare SSR for playground - #1303

Merged
jderochervlk merged 10 commits into
masterfrom
vlk/enable-cloudflare-ssr
Sep 18, 2026
Merged

jderochervlk merged 10 commits into
masterfrom
vlk/enable-cloudflare-ssr

Conversation

@jderochervlk

@jderochervlk jderochervlk commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Context

The playground discovers available compiler versions from /playground-bundles/versions.json. When /try is prerendered, that loader data is captured during the docs build, so publishing a new compiler bundle does not make it available in the playground until the site is rebuilt.

This change keeps the documentation site statically prerendered while serving the playground through Cloudflare Pages Functions. The /try loader can therefore fetch the current version list at request time, allowing newly published compiler versions to appear without triggering a docs build.

Summary

  • Enables React Router SSR for @rescript-lang/docs while preserving prerendering for the existing static routes.
  • Excludes /try from prerender output and routes /try and /try.data through Cloudflare Pages Functions.
  • Adds the server rendering entry point, including streamed responses, HEAD handling, and React Router 8 request-context support.
  • Configures Wrangler for the Pages project with nodejs_compat and ensures the SSR bundle is built before local and CI Wrangler validation.
  • Clears stale output before copying the prerendered client build so old /try artifacts cannot mask the runtime route.
  • Keeps the runtime-only playground route in the generated sitemap.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 20, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
guide c2ffa45 Commit Preview URL

Branch Preview URL
Sep 18 2026, 12:20 PM

@jderochervlk

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-18T13:09:33.777347Z c2ffa45 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2621ca1941

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/docs/server/react-router-handler.js
Comment thread apps/docs/react-router.config.mjs
Comment thread apps/docs/react-router.config.mjs
Comment thread apps/docs/app/entry.server.js
# Conflicts:
#	AGENTS.md
#	apps/docs/wrangler.toml
Create a RouterContextProvider for Cloudflare Pages SSR requests so dynamic playground routes remain compatible with React Router 8.
@github-actions

Copy link
Copy Markdown
Contributor

Guide Cloudflare deployment

⛅️ wrangler 4.130.0
────────────────────
🌀 Building list of assets...
✨ Read 17 files from the assets directory /home/runner/work/rescript-lang.org/rescript-lang.org/apps/guide/build/client
🌀 Starting asset upload...
No updated asset files to upload. Proceeding with deployment...
Total Upload: 0.31 KiB / gzip: 0.22 KiB
Worker Startup Time: 0 ms
Uploaded guide (1.47 sec)
Worker Version ID: c196e518-e70b-4e21-9a94-e21e3bfa9267
Version Preview URL: https://c196e518-guide.rescript.workers.dev
Version Preview Alias URL: https://vlk-enable-cloudflare-ssr-guide.rescript.workers.dev

To deploy this version to production traffic use the command wrangler versions deploy

Changes to non-versioned settings (config properties 'logpush' or 'tail_consumers') take effect after your next deployment using the command wrangler versions deploy

Changes to triggers (routes, custom domains, cron schedules, etc) must be applied with the command wrangler triggers deploy

@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare deployment

Deployement ID: 860ea542-396d-46fd-9223-1a702e8bebe6
Deployment Environment: preview

⛅️ wrangler 4.130.0
────────────────────
Uploading... (8875/8877)
Uploading... (8876/8877)
Uploading... (8877/8877)
✨ Success! Uploaded 2 files (8875 already uploaded) (1.51 sec)

✨ Uploading _redirects
✨ Uploading Functions bundle
🌎 Deploying...
✨ Deployment complete! Take a peek over at https://860ea542.rescript-lang.pages.dev
✨ Deployment alias URL: https://vlk-enable-cloudflare-ssr.rescript-lang.pages.dev

@jderochervlk
jderochervlk marked this pull request as ready for review September 18, 2026 13:04

@fhammerschmidt fhammerschmidt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super nice!

@jderochervlk
jderochervlk merged commit 075dbe0 into master Sep 18, 2026
10 checks passed
@jderochervlk
jderochervlk deleted the vlk/enable-cloudflare-ssr branch September 18, 2026 14:09

This branch was successfully deployed

1 active deployment
preview c2ffa457 Deployed Sep 18, 2026 by github-actions[bot]
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