From 92ba965e68677573baed4f53c7334c0fa1092a8e Mon Sep 17 00:00:00 2001 From: Rahul Varghese Date: Thu, 5 Nov 2026 03:09:55 +0530 Subject: [PATCH] VR0: the vite-react-boilerplate epic doc set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The vite-react-boilerplate epic: epic.yaml (key VR, three milestones: the spec, the app on Workers, a baseline), the README, the design (the template, why its Vite 5 and React 18 stay — they build and run on the runners' Node 22 — how each Vercel piece maps to Cloudflare: a static build served as Workers Static Assets behind one Worker, every page address answered by the app and a missing file a 404, the name seam the heading and the tab's title read, the repository, and server rendering rejected), the implementation plan, the risks, the as-built status, and the three task contracts. Co-Authored-By: Claude Orun-Task: VR-1 --- specs/epics/README.md | 1 + .../IMPLEMENTATION-STATUS.md | 11 +++ specs/epics/vite-react-boilerplate/README.md | 37 +++++++++ specs/epics/vite-react-boilerplate/design.md | 79 +++++++++++++++++++ specs/epics/vite-react-boilerplate/epic.yaml | 30 +++++++ .../implementation-plan.md | 40 ++++++++++ .../risks-and-open-questions.md | 9 +++ tasks/VR-1.TaskContract.yaml | 15 ++++ tasks/VR-2.TaskContract.yaml | 18 +++++ tasks/VR-3.TaskContract.yaml | 28 +++++++ 10 files changed, 268 insertions(+) create mode 100644 specs/epics/vite-react-boilerplate/IMPLEMENTATION-STATUS.md create mode 100644 specs/epics/vite-react-boilerplate/README.md create mode 100644 specs/epics/vite-react-boilerplate/design.md create mode 100644 specs/epics/vite-react-boilerplate/epic.yaml create mode 100644 specs/epics/vite-react-boilerplate/implementation-plan.md create mode 100644 specs/epics/vite-react-boilerplate/risks-and-open-questions.md create mode 100644 tasks/VR-1.TaskContract.yaml create mode 100644 tasks/VR-2.TaskContract.yaml create mode 100644 tasks/VR-3.TaskContract.yaml diff --git a/specs/epics/README.md b/specs/epics/README.md index 29155e3..11131dd 100644 --- a/specs/epics/README.md +++ b/specs/epics/README.md @@ -7,5 +7,6 @@ folder is the adoption; the merge creates the epic in the workspace. | Epic | Cluster | Status | What it is | |------|---------|--------|------------| +| [`vite-react-boilerplate/`](./vite-react-boilerplate/) | **VR** | In progress (VR0) | Vercel's Vite - React template — create-vite's React and TypeScript welcome page, on its Vite 5 and React 18 — built static and served as Cloudflare Workers Static Assets behind one Worker as a single-page app, and an Orun baseline that instantiates it (VR2) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/vite-react-boilerplate/IMPLEMENTATION-STATUS.md b/specs/epics/vite-react-boilerplate/IMPLEMENTATION-STATUS.md new file mode 100644 index 0000000..203e84a --- /dev/null +++ b/specs/epics/vite-react-boilerplate/IMPLEMENTATION-STATUS.md @@ -0,0 +1,11 @@ +# vite-react-boilerplate — implementation status + +| Milestone | State | Landed | +|---|---|---| +| VR0 — the spec | ✅ | the repository's first commit and VR-1 | +| VR1 — the app on Workers | planned | VR-2 | +| VR2 — a baseline | planned | VR-3 | + +## Departures from the upstream template + +Recorded as they land, from VR1 on. diff --git a/specs/epics/vite-react-boilerplate/README.md b/specs/epics/vite-react-boilerplate/README.md new file mode 100644 index 0000000..1e9ab3d --- /dev/null +++ b/specs/epics/vite-react-boilerplate/README.md @@ -0,0 +1,37 @@ +# vite-react-boilerplate — Vercel's Vite - React template on Cloudflare Workers + +**Vite builds fully static, so the port is where it is served — `dist` as +Cloudflare Workers Static Assets behind one small Worker, every page address +answered by the app and a missing file a 404, deployed by Orun to stage and +prod on every merge — on the template's own Vite 5 and React 18, with the +app's name in one module and a spec of the page the template never had; and +then the baseline that makes a copy of it somebody else's app in one +landing.** + +| | | +|---|---| +| Status | In progress — VR0 on main | +| Upstream | [vercel/examples](https://github.com/vercel/examples) `framework-boilerplates/vite-react` (MIT), at `de86723` (2026-10-16; the folder last changed in `76ab21c`, 2025-01-13): create-vite's React and TypeScript template | +| Reference | [angular-boilerplate](https://github.com/sourceplane/angular-boilerplate) — the same static single-page app behind one Worker, the same 404 rule, its tests and its bootstrap; [astro-boilerplate](https://github.com/sourceplane/astro-boilerplate) — the same `-boilerplate` identity and rename rules | +| Key | `VR` | + +## Read in this order + +1. [design.md](design.md) — the template, why its versions stay, how each + Vercel piece maps to Cloudflare, the single-page-app routing and the + Worker's 404 rule, the name seam, the repository, and the alternative + rejected. +2. [implementation-plan.md](implementation-plan.md) — the milestones and + what each one lands. +3. [risks-and-open-questions.md](risks-and-open-questions.md) — what is not + proven, and what was accepted. +4. [IMPLEMENTATION-STATUS.md](IMPLEMENTATION-STATUS.md) — what shipped, and + every departure from the upstream template. + +## Milestones + +| Milestone | What it lands | Task | +|---|---|---| +| VR0 — the spec | the repository, its intent, CI, tooling and spec index; this doc set | VR-1 | +| VR1 — the app on Workers | the template in `apps/web`, built static, served as assets behind one Worker as a single-page app, with its spec and tests | VR-2 | +| VR2 — a baseline | the console card, the build document, the context pack and the baseline's tests | VR-3 | diff --git a/specs/epics/vite-react-boilerplate/design.md b/specs/epics/vite-react-boilerplate/design.md new file mode 100644 index 0000000..9b402ee --- /dev/null +++ b/specs/epics/vite-react-boilerplate/design.md @@ -0,0 +1,79 @@ +# vite-react-boilerplate — design + +## The template + +Vercel's Vite and React example (`framework-boilerplates/vite-react` in +[vercel/examples](https://github.com/vercel/examples)) is create-vite's React +and TypeScript template: `index.html` loading `src/main.tsx`, which mounts +`App` in StrictMode; `App.tsx` with the Vite and React logos linking to +their docs, the "Vite + React" heading, a counter button ("count is N") and +the HMR hint, styled by `App.css` and `index.css`; Vite 5 with +`@vitejs/plugin-react`, React 18, TypeScript 5 in two project references +(`tsconfig.app.json`, `tsconfig.node.json`) and an ESLint 9 flat config with +the React hooks and refresh plugins. Its build is `tsc -b && vite build`, +writing `dist`. It ships no tests. Vercel builds it with its Vite framework +preset and serves `dist` statically. + +## The template as it is + +The template's own versions build and run on the runners' Node 22 (spike: +Vite 5.4.21, `tsc -b && vite build` in under a second, the page served by +`wrangler dev`). So nothing moves: Vite 5, React 18, TypeScript 5, ESLint 9 +and the template's tsconfigs and lint config stay as they are. The one +addition to the TypeScript projects is a third reference, +`tsconfig.worker.json`, for the Worker in front of the assets, so `tsc -b` +checks it with the rest. + +## How it maps to Cloudflare + +| Vercel | Here | Why | +|---|---|---| +| Static output on Vercel's CDN | `dist` as Workers Static Assets, uploaded with `-web-` | The app is static; the assets are the app | +| — | One Worker, `apps/web/worker/index.ts` | The `cloudflare-workers-assets-turbo` composition deploys a Worker with its assets; it answers what the assets leave | +| A page address other than `/`: the host's (no rewrite in the template) | `not_found_handling: single-page-application`: a browser's navigation that matches no file gets `index.html` | The app renders in the browser; a route a client-side router adds must work on a deep link and a reload | +| A missing file: the host's 404 | The Worker answers 404 when the path's last segment names a file, and hands any other page request back to the assets (which answer `index.html`) | Only requests the assets did not answer reach it: a non-navigation miss. The assets binding applies the same fallback, so forwarding a `/missing.js` would answer HTML with a 200 | +| No tests | A Vitest spec of the page (`src/App.test.tsx`) in jsdom, with the app's own Vite config | The page's behaviour is what a change must keep | + +## Every page is the app's + +A request reaches Workers Static Assets first. A file is served as it is +(the bundle and stylesheet carry content hashes). A browser's navigation +that matches no file (`Sec-Fetch-Mode: navigate`) is answered with +`index.html` and a 200. Everything else that matches no file reaches the +Worker, and the Worker decides by the path: a last segment with an extension +(`/missing.js`, `/assets/logo.png`) is a missing file and gets a plain-text +404; any other path is a page asked for without a browser's headers (a link +preview, curl) and is handed back to the assets, which answer `index.html`. +A browser that navigates to `/missing.js` still gets the app: the assets +answer navigations before the Worker sees them. The rule is one function, +`namesAFile`, angular-boilerplate's, tested in +`tests/web/src/worker.test.ts` and read over HTTP by the e2e tier. + +## The name seam + +The template spells its name twice: the heading ("Vite + React") and the +tab's title ("Vite + React + TS"). Both now read one literal, `SITE_NAME` in +`apps/web/src/site.ts` — the heading through an import, the title through a +small plugin in `vite.config.ts` that writes it, HTML-escaped, into +`index.html`'s `__SITE_NAME__` placeholder in dev and at build. Its default is +the heading's "Vite + React", so the tab's title loses the template's +" + TS" (risk VR-D): a product's name stands alone in its tab. + +## The repository + +angular-boilerplate's shape, the same static single-page app behind one +Worker: `apps/web` (the app, its Vite configs, the Worker, the deploy +contract), `tests/web` (vitest), the shared TypeScript and ESLint +configuration, the wrangler renderer, `ci.yml` byte for byte +angular-boilerplate's (turso-starter's but for one comment). The rename +engine is astro-boilerplate's: the same `-boilerplate` slug, +which no framework module spells, so nothing of Vite's or React's needs +masking; the seam is `SITE_NAME` in `apps/web/src/site.ts`. + +## The alternative rejected + +**Server rendering** (Vite's SSR, or a React framework on a Worker). The +template has no server code; adding a server build would change what the +template is and put a Worker's render in front of a page that renders in the +browser. A static build behind the assets is the template as Vercel serves +it. diff --git a/specs/epics/vite-react-boilerplate/epic.yaml b/specs/epics/vite-react-boilerplate/epic.yaml new file mode 100644 index 0000000..af4c5b1 --- /dev/null +++ b/specs/epics/vite-react-boilerplate/epic.yaml @@ -0,0 +1,30 @@ +# The epic's declaration. metadata.name equals the directory name; metadata.key +# is the task-key prefix this epic reserves (VR → VR-1, VR-2, …). Owner, target +# date and health are the platform's — never written here. +apiVersion: orun.io/v1 +kind: Epic +metadata: + name: vite-react-boilerplate + key: VR +spec: + title: "Vercel's Vite - React template on Cloudflare Workers" + summary: "Vercel's Vite and React example — create-vite's React and TypeScript welcome page: the Vite and React logos linking to their docs, the heading, the counter and the HMR hint — on the template's own Vite 5 and React 18, built fully static and served as Cloudflare Workers Static Assets behind one small Worker as a single-page app, with a Vitest spec of the page the template never had, inside the Cirrus baseline's repository conventions, and becomes an Orun baseline that takes a new Vite and React app from nothing to live on stage and prod in one landing." + state: started + milestones: + - name: "VR0 — the spec" + exitCriteria: + - "the repository is born with its intent, CI, tooling and spec index, and this doc set and the task contracts are on main" + tasks: [VR-1] + - name: "VR1 — the app on Workers" + exitCriteria: + - "apps/web is the upstream template on its Vite 5 and React 18, built static by tsc -b and vite build, with one Worker in front of dist as Workers Static Assets" + - "`pnpm typecheck`, `pnpm lint`, `pnpm test` (the page's Vitest spec, and tests/web) and `pnpm build` are green" + - "`wrangler dev` serves the shell, its bundle, stylesheet and logos, answers every page address with the app and a missing file with a 404" + - "the README says how to run, test, preview and deploy it, and how every Vercel piece maps to Cloudflare" + tasks: [VR-2] + - name: "VR2 — a baseline" + exitCriteria: + - "blueprint.yaml (the console card) and repo-blueprint.yaml (the build) take a new Vite and React app from nothing to live on stage and prod in one landing, then record it" + - "an app built from it carries the app only, renamed throughout to its own name, repository and Worker, with the framework's own names intact" + - "Baseline CI is green: contract tests, generated component docs, the blueprint read by the pinned orun, the leak gate, the offline bootstrap and the end-to-end tier" + tasks: [VR-3] diff --git a/specs/epics/vite-react-boilerplate/implementation-plan.md b/specs/epics/vite-react-boilerplate/implementation-plan.md new file mode 100644 index 0000000..6c0dd4d --- /dev/null +++ b/specs/epics/vite-react-boilerplate/implementation-plan.md @@ -0,0 +1,40 @@ +# vite-react-boilerplate — implementation plan + +Three milestones, each one reviewed pull request (VR0 follows the +repository's first commit), each green before it merges. + +## VR0 — the spec (VR-1) + +The repository is born: `intent.yaml` with the placeholder workspace +`ws_CHANGE_ME`, `ci.yml` (byte for byte angular-boilerplate's, +turso-starter's but for one comment, which plans nothing until the workspace +is set), the shared TypeScript and ESLint configuration, the spec index, this +doc set and the task contracts. + +## VR1 — the app on Workers (VR-2) + +- The template in `apps/web` as it is: `index.html`, `src/main.tsx`, + `src/App.tsx`, its styles and logos, `vite.config.ts`, the tsconfigs and + the ESLint config; `src/site.ts`, the name seam, read by the heading and + written into the title by `vite.config.ts`. +- `worker/index.ts`, `tsconfig.worker.json` and `wrangler.jsonc`: the Worker + in front of `dist`, single-page-app routing, the 404 rule for file paths. +- `component.yaml`: the deploy contract and its smoke over the shell, the + bundle, a deep link and a missing file. +- The page's spec (`src/App.test.tsx`, Vitest in jsdom). Tests + (`tests/web`): the name seam and the title writer, the build config, the + Worker's routing, the template's page, the licence. +- The README's "How it maps to Vercel". + +## VR2 — a baseline (VR-3) + +angular-boilerplate's machinery, renamed: `blueprint.yaml`, +`repo-blueprint.yaml`, `.baseline/` (identity, product README, task +contracts), `tooling/rebrand` (astro-boilerplate's engine and rules, the +seam at `apps/web/src/site.ts`), `tooling/bootstrap`, +`hooks/render-deployment-docs.sh` (probing `/`, a deep link and each +`SITE_URL`), `docs/phases/`, the context pack, `testing/` (the leak and +placement gates on this tree's files, placement also failing on the +template's name left in the app or a framework module renamed; the e2e tier +building the app in the stage lane's staged tree and reading every route it +promises) and `baseline.yml` / `tag.yml`. diff --git a/specs/epics/vite-react-boilerplate/risks-and-open-questions.md b/specs/epics/vite-react-boilerplate/risks-and-open-questions.md new file mode 100644 index 0000000..14c8bbd --- /dev/null +++ b/specs/epics/vite-react-boilerplate/risks-and-open-questions.md @@ -0,0 +1,9 @@ +# vite-react-boilerplate — risks and open questions + +| ID | Risk | State | Notes | +|---|---|---|---| +| VR-A | `baseline-v1` is not yet proven live | OPEN | Proven offline in Baseline CI: the offline bootstrap with the blueprint's own hooks, the stage lane's own steps in a staged job tree, the app served by `wrangler dev` and smoke-tested with the component's own command, every route read. A console bootstrap closes it | +| VR-B | The Worker's 404 rule reads the path | ACCEPTED | A page route whose last segment has a dot (`/v1.2`) asked for without a browser's navigation headers would be a 404; a browser's navigation to it is still the app. `namesAFile` is the one place to change it | +| VR-C | The template's Vite 5 and React 18, not current majors | ACCEPTED | They build and run on Node 22 (spike: `~/orunbase/spikes/vite-react-boilerplate.md`). Moving to Vite 7 or React 19 is the owner's change, and the page's spec and the e2e tier would catch a behaviour it breaks | +| VR-D | The tab's title is the site's name | ACCEPTED | The template's title is "Vite + React + TS"; the seam's default is the heading's "Vite + React", and the title reads it, so a product's tab carries its own name and nothing else | +| VR-E | stack-tectonic 0.19.0, not 0.20.0 | ACCEPTED | 0.20.0's lane-shared install links each job's `node_modules` out of its tree; the siblings pin 0.19.0 for it and the app would save nothing | diff --git a/tasks/VR-1.TaskContract.yaml b/tasks/VR-1.TaskContract.yaml new file mode 100644 index 0000000..49f9e16 --- /dev/null +++ b/tasks/VR-1.TaskContract.yaml @@ -0,0 +1,15 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: VR-1 + title: "The spec" +spec: + goal: The vite-react-boilerplate repository is born with its intent, CI, tooling and spec index, and the vite-react-boilerplate epic — declaration, doc set and task contracts — is on main + affects: + - specs/epics/vite-react-boilerplate + - specs/epics/README.md + - tasks + doneWhen: + - epic.yaml, README, design, implementation plan, risks and status are on main + - the three task contracts exist + gates: [] diff --git a/tasks/VR-2.TaskContract.yaml b/tasks/VR-2.TaskContract.yaml new file mode 100644 index 0000000..4ee73b4 --- /dev/null +++ b/tasks/VR-2.TaskContract.yaml @@ -0,0 +1,18 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: VR-2 + title: "The app on Workers" +spec: + goal: Vercel's Vite - React template runs on its Vite 5 and React 18 on Cloudflare Workers + Static Assets — built static, served as assets behind one Worker as a single-page app — with its spec and tests, and its README saying how it maps to Vercel + affects: + - apps/web + - tests/web + - pnpm-lock.yaml + - pnpm-workspace.yaml + - README.md + - .gitignore + doneWhen: + - pnpm typecheck, lint, test and build are green + - wrangler dev serves the shell, its bundle, stylesheet and logos, every page address as the app, and a missing file as a 404 + gates: [] diff --git a/tasks/VR-3.TaskContract.yaml b/tasks/VR-3.TaskContract.yaml new file mode 100644 index 0000000..7e92021 --- /dev/null +++ b/tasks/VR-3.TaskContract.yaml @@ -0,0 +1,28 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: VR-3 + title: "vite-react-boilerplate becomes an Orun baseline" +spec: + goal: blueprint.yaml and repo-blueprint.yaml take a new Vite and React app from nothing to live on stage and prod in one landing, held by Baseline CI + affects: + - blueprint.yaml + - repo-blueprint.yaml + - BOOTSTRAP.md + - .baseline + - .github/workflows/baseline.yml + - .github/workflows/tag.yml + - ai/context + - docs/phases + - hooks + - testing + - tooling/rebrand + - tooling/bootstrap + - tooling/catalog + - apps/web/docs + - specs/epics/vite-react-boilerplate + - README.md + doneWhen: + - every Baseline CI tier is green + - an app placed from it carries the app only, branded, with the framework's own names intact + gates: []