diff --git a/specs/epics/README.md b/specs/epics/README.md index 29155e3..3ce4fb5 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 | |------|---------|--------|------------| +| [`strapi-launchpad/`](./strapi-launchpad/) | **SL** | In progress (SL0) | LaunchPad's Next.js front end (Vercel's LaunchPad: Next.js × Strapi Starter) on Cloudflare Workers, its Strapi reads cached in R2 + Durable Objects, the template's seed as sample content until a Strapi project is connected | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/strapi-launchpad/IMPLEMENTATION-STATUS.md b/specs/epics/strapi-launchpad/IMPLEMENTATION-STATUS.md new file mode 100644 index 0000000..160f343 --- /dev/null +++ b/specs/epics/strapi-launchpad/IMPLEMENTATION-STATUS.md @@ -0,0 +1,11 @@ +# strapi-launchpad — implementation status + +| Milestone | State | Landed | +|---|---|---| +| SL0 — the spec | ✅ | SL-1 | +| SL1 — the site on Workers | planned | SL-2 | +| SL2 — a baseline | planned | SL-3 | + +## Departures from the upstream template + +Recorded as they land, from SL1 on. diff --git a/specs/epics/strapi-launchpad/README.md b/specs/epics/strapi-launchpad/README.md new file mode 100644 index 0000000..f8ee36b --- /dev/null +++ b/specs/epics/strapi-launchpad/README.md @@ -0,0 +1,35 @@ +# strapi-launchpad — LaunchPad's Strapi-powered marketing site on Cloudflare Workers + +**LaunchPad is a Next.js front end and a Strapi server. The Strapi server +needs a container, so the port carries the front end alone, reading the +owner's Strapi Cloud project over HTTP — and, until there is one, the +template's own seed as sample content. Every `"use cache"` read is kept, its +cache moved onto Cloudflare: one Worker, its data cache in R2, its tag cache +in Durable Objects.** + +| | | +|---|---| +| Status | In progress — SL0 on main | +| Upstream | [strapi/LaunchPad](https://github.com/strapi/LaunchPad) `next/` (MIT, declared), at `c54b5c2` (2026-10-16); the seed is its `strapi/data` export | +| Reference | [cms-sanity](https://github.com/sourceplane/cms-sanity) for a CMS-backed site that goes live before the CMS is connected; [commerce](https://github.com/sourceplane/commerce) for the OpenNext, R2 and Durable Object cache shape | +| Key | `SL` | + +## Read in this order + +1. [design.md](design.md) — what is carried and what is not, how each Vercel + piece maps to Cloudflare, the cache, the sample, the tests, and the + alternatives 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 upstream. + +## Milestones + +| Milestone | What it lands | Task | +|---|---|---| +| SL0 — the spec | this doc set and the three task contracts | SL-1 | +| SL1 — the site on Workers | `apps/web`, the R2 root, `tests/web` | SL-2 | +| SL2 — a baseline | the card, the build document, the rename, the tiers | SL-3 | diff --git a/specs/epics/strapi-launchpad/design.md b/specs/epics/strapi-launchpad/design.md new file mode 100644 index 0000000..4409570 --- /dev/null +++ b/specs/epics/strapi-launchpad/design.md @@ -0,0 +1,103 @@ +# strapi-launchpad — design + +## 1. What is carried, and what is not + +[strapi/LaunchPad](https://github.com/strapi/LaunchPad) is a yarn monorepo: a +Strapi 5 server (`strapi/`: the content types, their populate middlewares, a +seed export) and four front ends (`next/`, `astro/`, `nuxt/`, `tanstack/`). +Vercel's template is the Next.js one. The port carries `next/` alone, as +`apps/web`. + +The Strapi server is not carried. Strapi is a long-lived Node process with a +database and an upload directory — a container, which no Orun composition +provides (the brief's stop list). The brief's answer, kept here: the site +reads the owner's Strapi over HTTP — a Strapi Cloud project running +LaunchPad's `strapi/` app is the documented path — and ships the template's +own content as a sample until one is connected. + +## 2. The site on Workers + +`@opennextjs/cloudflare` builds the app into one Worker plus Static Assets, +the commerce baseline's shape. Every route is a Next.js App Router route; the +locale redirect is Next 16's `proxy.ts` (Node runtime under OpenNext); draft +mode is Next's. `next build --webpack`: the reference starters' choice, and +the build the size was measured on (2.13 MiB gzipped — Workers Free). + +## 3. The cache + +Every Strapi read in `lib/strapi/client.ts` is a `"use cache"` function with +`cacheLife('minutes')` and a `cacheTag` per type or document. On Workers those +entries need a writable incremental cache — OpenNext's static-assets cache +refuses them ("Composable cache is not supported") and every visit then read +Strapi again. So the commerce baseline's shape: the R2 incremental cache +(`infra/terraform/cloudflare-r2`, wired by `WIRING_CLOUDFLARE_R2`), a sharded +Durable Object tag cache and a Durable Object revalidation queue. Measured +under `wrangler dev`: four visits to the home page made two Strapi reads, both +on the first. + +## 4. Cache Components + +Upstream turns on `cacheComponents`. On workerd under the adapter's newest +release a Cache Components page answers 500 and then hangs +(opennextjs-cloudflare#1450; the row-10 and row-16 spikes). So +`experimental.useCache` keeps every `"use cache"` read, its profile and its +tags, and pages render per request — which every page already did upstream: +the locale layout reads `draftMode()`. + +## 5. The sample, and the switch to Strapi + +The sample is the seed, recorded honestly: a local Strapi (in the factory's +scratch space, never shipped) imported `strapi/data/export_20250116105447.tar.gz` +and every single type (`global`, `blog-page`, `product-page`) and collection +(`pages`, `products`, `articles`) was read through the template's populate +middlewares in both locales — exactly the documents the template's own Strapi +answers. `formats` (the size variants no component reads) is left out; the +40 original images the documents name ship under `public/uploads`, where the +documents' `/uploads/…` URLs resolve on the Worker. The seed's two +redirections are `lib/strapi/sample-redirections.ts`. + +`isStrapiConnected()` is the one seam: the build-time `NEXT_PUBLIC_API_URL` +(from the Orun secret `STRAPI_URL`) is set. Unconnected, each of the client's +three reads answers from `lib/strapi/sample.ts` before anything else — no +fetch, no draft-mode check — emulating exactly the queries the pages make: a +single type by locale, a collection by locale and optional slug, a document +by id; anything else is empty, never a throw. The template's demo bar +(`NEXT_IS_DEMO`) is reused for "Sample content · connect your Strapi project". + +## 6. Identity + +One seam, `SITE_NAME` in `lib/site.ts`, read by the logo, the sign-up heading +and the default metadata — the four places upstream spelled "LaunchPad" in +code. The sample content keeps the template's name (it is the seed; a +connected project replaces it), and upstream's `strapi/LaunchPad` links are +credits. `SOURCE_URL` names the product's own repository for the bar's link. +Each environment's build sets `NEXT_PUBLIC_SITE_URL`, the root layout's +`metadataBase`, so the sample's relative Open Graph images resolve against +the site, not localhost. + +## 7. Tests + +`tests/web`: the sample's semantics and completeness (every image it names +ships), the client's switch (nothing fetched unconnected), the locale proxy, +`/api/health`, the preview route's refusal, the seam and the build's settings. +The e2e builds the product in the lane's staged tree, serves it as born (every +page from the sample, the bar, the seed's redirects, a noindex not-found +page, health `sample`, +preview refused), then rebuilds it with `STRAPI_URL` pointing at a stand-in +Strapi (`testing/lib/fake-strapi.py`: the same seed's documents, the site's +REST reads, drafts marked) and proves the cache (a second visit reads Strapi +not at all; a change stays cached while fresh) and draft mode (entered only +with the preview secret, it reads the draft on every request). + +## 8. Alternatives rejected + +- **Running Strapi too** — a container; on the stop list. +- **Invented sample content** — the seed is the template's own and shows + every block the site renders. +- **No cache (static-assets incremental cache)** — every visit would read + Strapi (and Strapi Cloud's request quota), and OpenNext logs an error per + read. +- **A D1 tag cache** — the commerce baseline's Durable Object one needs no + database to provision. +- **Pointing an unconnected site at a public LaunchPad demo API** — a third + party's server, not ours to depend on. diff --git a/specs/epics/strapi-launchpad/epic.yaml b/specs/epics/strapi-launchpad/epic.yaml new file mode 100644 index 0000000..bd567b8 --- /dev/null +++ b/specs/epics/strapi-launchpad/epic.yaml @@ -0,0 +1,29 @@ +# The epic's declaration. metadata.name equals the directory name; metadata.key +# is the task-key prefix this epic reserves (SL → SL-1, SL-2, …). Owner, target +# date and health are the platform's — never written here. +apiVersion: orun.io/v1 +kind: Epic +metadata: + name: strapi-launchpad + key: SL +spec: + title: "LaunchPad's Strapi-powered marketing site on Cloudflare Workers" + summary: "LaunchPad's Next.js front end (Vercel's LaunchPad: Next.js × Strapi Starter) — a home page from Strapi's dynamic zones, pricing, FAQ, contact, a blog and products, in English and French, every Strapi read a \"use cache\" entry, with draft mode — runs as one Cloudflare Worker with Static Assets, its data cache in R2 and its tag cache and revalidation queue in Durable Objects, live on the template's own seed before a Strapi project is connected, and becomes an Orun baseline that takes a new site from nothing to live on stage and prod in one landing." + state: started + milestones: + - name: "SL0 — 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: [SL-1] + - name: "SL1 — the site on Workers" + exitCriteria: + - "apps/web is upstream's next/ built by OpenNext into one Worker with Static Assets, the R2 incremental cache, the Durable Object tag cache and queue, Cache Components off and every \"use cache\" read kept" + - "with no Strapi project the site renders the template's seed as sample content, never a 500; connected, wrangler dev serves Strapi's content from cached reads and draft mode reads drafts past the cache" + - "typecheck, lint, test and build are green with no Strapi" + tasks: [SL-2] + - name: "SL2 — a baseline" + exitCriteria: + - "blueprint.yaml (the console card) and repo-blueprint.yaml (the build) take a new site from nothing to live on stage and prod in one landing, then record it" + - "a site built from it carries the product only, renamed throughout to its own name, repository, Worker and buckets" + - "Baseline CI is green: contract tests, the wiring path, generated component docs, the blueprint read by the pinned orun, the leak gate, the offline bootstrap and the end-to-end tier — the stage lane's steps in a staged tree, served as born, then connected to a stand-in Strapi and browsed" + tasks: [SL-3] diff --git a/specs/epics/strapi-launchpad/implementation-plan.md b/specs/epics/strapi-launchpad/implementation-plan.md new file mode 100644 index 0000000..c41da36 --- /dev/null +++ b/specs/epics/strapi-launchpad/implementation-plan.md @@ -0,0 +1,14 @@ +# strapi-launchpad — implementation plan + +| Milestone | Lands | Done when | +|---|---|---| +| SL0 — the spec | the repository born (intent, CI, tooling, spec index), this doc set, SL-1…SL-3 | on main | +| SL1 — the site on Workers | `apps/web` (upstream `next/` at `c54b5c2` plus the departures in IMPLEMENTATION-STATUS, the seed recorded as `sample/strapi` and its images), `infra/terraform/cloudflare-r2`, `tests/web` | typecheck, lint, test, build green with no Strapi; served on the sample and connected under `wrangler dev` | +| SL2 — a baseline | `blueprint.yaml`, `repo-blueprint.yaml`, `.baseline/`, the rename engine and bootstrap helpers, the record renderer, the context pack, `testing/` with the stand-in Strapi, `baseline.yml`, `tag.yml` | Baseline CI green; `baseline-v1` tagged | + +Order inside SL1: the seed recorded (a local Strapi importing the template's +export, every single type and collection read through its populate +middlewares, both locales); the sample switch; the build on OpenNext (Cache +Components off, `useCache`, the R2 + DO caches, a cached read reused under +`wrangler dev`); the two upstream bugs a curl and a missing page found; the +tests. diff --git a/specs/epics/strapi-launchpad/risks-and-open-questions.md b/specs/epics/strapi-launchpad/risks-and-open-questions.md new file mode 100644 index 0000000..816ac42 --- /dev/null +++ b/specs/epics/strapi-launchpad/risks-and-open-questions.md @@ -0,0 +1,15 @@ +# strapi-launchpad — risks and open questions + +| ID | Risk | State | Notes | +|---|---|---|---| +| SL-A | Not proven live: the repository and link, the minted tokens, a real `terraform apply` and `wrangler deploy`, the probes | OPEN | Baseline CI proves everything else offline; one bootstrap closes it | +| SL-B | No real Strapi project connected: Strapi Cloud running LaunchPad's `strapi/` app, its CORS and Public-role permissions, its preview button | OPEN | The stand-in answers the same reads from the same seed; one Strapi Cloud project closes it | +| SL-C | Cache Components off | ACCEPTED | opennextjs-cloudflare#1450 / #1318; every page reads draft mode, so none was prerendered upstream either; turning them back on needs no change to the `"use cache"` reads | +| SL-D | Next pinned to 16.3.8 | ACCEPTED | @opennextjs/cloudflare 1.20.11's floor; upstream locked 16.3.1 | +| SL-E | Images unoptimized, `sharp` dropped | ACCEPTED | Workers has no Next.js image optimizer; Strapi's media are served as uploaded | +| SL-F | The sample is the seed as published: its English hero reads "(Draft) Launch your content into orbit", as upstream's export has it | ACCEPTED | It is the template's own content, replaced by a connected project | +| SL-G | The e2e's Strapi is a stand-in: the seed's documents, the site's reads (single types, collections by slug and locale, drafts) — not Strapi's query engine | ACCEPTED | A real project is SL-B | +| SL-H | The site's name: the rename rewrites one line and the sweep does not look for it | ACCEPTED, gated | The leak gate fails any other spelling in `apps/web` code; the placement and e2e tiers check the branded product | +| SL-I | Licence: LaunchPad declares MIT (`next/README.md`, `strapi/package.json`) but ships no LICENSE file | OPEN | `apps/web/LICENSE.md` is the standard MIT text with LaunchPad's authors as holders and says so; the registry owner's call before a public row | +| SL-J | The sample's images (40 files, 3.6 MB) ship in the repository | ACCEPTED | The originals the pages name; the seed's size variants (about 20 MB) are left out | +| SL-K | `cacheLife('minutes')` re-reads an entry in the background once it is a minute old | ACCEPTED | Upstream's profile; the e2e checks each page's cache within seconds of its first read | diff --git a/tasks/SL-1.TaskContract.yaml b/tasks/SL-1.TaskContract.yaml new file mode 100644 index 0000000..8077228 --- /dev/null +++ b/tasks/SL-1.TaskContract.yaml @@ -0,0 +1,13 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: SL-1 + title: "The strapi-launchpad epic doc set" +spec: + goal: The epic's README, design, plan, risks and status, and the three task contracts, are on main + affects: + - specs/epics/strapi-launchpad + - tasks + doneWhen: + - the doc set and SL-1, SL-2 and SL-3 are merged + gates: [] diff --git a/tasks/SL-2.TaskContract.yaml b/tasks/SL-2.TaskContract.yaml new file mode 100644 index 0000000..1a10886 --- /dev/null +++ b/tasks/SL-2.TaskContract.yaml @@ -0,0 +1,18 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: SL-2 + title: "The site on Workers" +spec: + goal: LaunchPad's Next.js front end runs as one Cloudflare Worker with Static Assets, its Strapi reads cached in R2 and the Durable Object tag cache, live on the template's own seed before a Strapi project is connected + affects: + - apps/web + - infra/terraform/cloudflare-r2 + - tests/web + - pnpm-lock.yaml + - pnpm-workspace.yaml + - README.md + doneWhen: + - pnpm typecheck, lint, test and build are green with no Strapi project + - wrangler dev serves the sample site without a 500, and a connected one from cached reads with draft mode past them + gates: [] diff --git a/tasks/SL-3.TaskContract.yaml b/tasks/SL-3.TaskContract.yaml new file mode 100644 index 0000000..5a72845 --- /dev/null +++ b/tasks/SL-3.TaskContract.yaml @@ -0,0 +1,23 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: SL-3 + title: "strapi-launchpad becomes an Orun baseline" +spec: + goal: A new site goes from nothing to live on stage and prod in one landing, its own name throughout, with Baseline CI proving it offline + affects: + - blueprint.yaml + - repo-blueprint.yaml + - .baseline + - testing + - tooling + - hooks + - docs/phases + - ai/context + - .github/workflows + - BOOTSTRAP.md + - README.md + doneWhen: + - Baseline CI is green on main + - baseline-v1 is tagged + gates: []