Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions specs/epics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ folder is the adoption; the merge creates the epic in the workspace.

| Epic | Cluster | Status | What it is |
|------|---------|--------|------------|
| [`basehub-marketing/`](./basehub-marketing/) | **BH** | In progress (BH0) | BaseHub's marketing website template on Cloudflare Workers + Static Assets through OpenNext, deployable before a BaseHub repository exists, and an Orun baseline that instantiates it in one landing (BH2) |

As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`.
11 changes: 11 additions & 0 deletions specs/epics/basehub-marketing/IMPLEMENTATION-STATUS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# basehub-marketing — implementation status

| Milestone | State | Landed |
|---|---|---|
| BH0 — the spec | ✅ | the repository's first commit, BH-1 |
| BH1 — the marketing site on Workers | planned | BH-2 |
| BH2 — a baseline | planned | BH-3 |

## Departures from the upstream template

Recorded as they land, from BH1 on.
34 changes: 34 additions & 0 deletions specs/epics/basehub-marketing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# basehub-marketing — BaseHub's marketing website template on Cloudflare Workers

**The template's marketing site — pages composed in BaseHub from section
blocks, a blog and a changelog — pre-rendered by the build and served by one
Cloudflare Worker with its static assets, deployed by Orun to stage and prod
on every merge, live before its owner has a BaseHub repository at all, and
the baseline that makes a copy of it somebody else's site in one landing.**

| | |
|---|---|
| Status | In progress — BH0 on main |
| Upstream | [basehub-ai/marketing-website-template](https://github.com/basehub-ai/marketing-website-template), at `7cfc403` (2025-12-11). **No licence**: no LICENSE file, no `license` in `package.json`, none recorded by GitHub (risk BH-C) |
| Reference | [cms-sanity](https://github.com/sourceplane/cms-sanity) and [cms-contentful](https://github.com/sourceplane/cms-contentful) — the same scaffolding, tests and bootstrap, and the unconnected sample mode |
| Key | `BH` |

## Read in this order

1. [design.md](design.md) — the template, how each Vercel piece maps to
Cloudflare, the unconnected site, the repository and the build, 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 |
|---|---|---|
| BH0 — the spec | the repository, its intent, CI, tooling and spec index; this doc set | BH-1 |
| BH1 — the marketing site on Workers | the template in `apps/web`, built by OpenNext into one Worker, with its unconnected sample mode; `tests/web` | BH-2 |
| BH2 — a baseline | the console card, the build document, the context pack and the baseline's tests, with a stand-in BaseHub for the connected build | BH-3 |
104 changes: 104 additions & 0 deletions specs/epics/basehub-marketing/design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# basehub-marketing — design

## 1. The template

BaseHub's [marketing website template](https://github.com/basehub-ai/marketing-website-template)
(Next.js App Router, Tailwind CSS 4, Geist, Radix) is a site whose every word
is in a BaseHub repository. A page (`app/[[...slug]]`) is a list of section
blocks — hero, companies, feature cards, side-by-side and big-image
features, a features grid, testimonials (slider and grid), pricing and a
comparison table, FAQs, callouts, forms, freeform text — chosen by
`__typename` in one switch. The blog (`/blog`, `/blog/[slug]`) has authors,
categories, rich-text bodies with code blocks (shiki), BaseHub's search and
an RSS feed; the changelog likewise. The header, footer, theme colours, logo
and metadata are BaseHub settings; the newsletter and contact forms send
BaseHub events. Every read goes through the `basehub` SDK: its `basehub()`
client and `<Pump>` turn a selection object into GraphQL, and its build step
(`basehub && next build`) regenerates `basehub-types.d.ts` from the
repository's schema — which needs `BASEHUB_TOKEN`. The pages are
`force-static` with `generateStaticParams`: everything is rendered at build.

## 2. How it maps to Cloudflare

| Vercel | Here | Why |
|---|---|---|
| Next.js hosting | One Worker built by `@opennextjs/cloudflare` (`output: 'standalone'`), `public/` and the client chunks in its Static Assets, the static-assets incremental cache | Every page is pre-rendered; nothing in the Worker is revalidated |
| `basehub && next build` | `next build` alone; `basehub:types` regenerates the types by hand | The CLI fails without a token, and the template already commits `basehub-types.d.ts`; the SDK's runtime client builds its GraphQL from the selection with no codegen |
| `BASEHUB_TOKEN` from the BaseHub Vercel integration | An optional Orun secret per environment, read at build and inlined into the SERVER bundle (`next.config.ts` `env`) | The build decides connected or not; request-time routes (the health check, an unknown path, the feeds) see the same answer |
| A redeploy on publish (the integration's hook) | A redeploy by hand or the `# orun: redeploy` stamp | Pages are pre-rendered; a commit in BaseHub needs a build (risk BH-D) |
| `VERCEL_PROJECT_PRODUCTION_URL`, a static `robots.txt` and sitemaps naming BaseHub's demo domain | `NEXT_PUBLIC_SITE_URL` per environment (its `SITE_URL`, else its workers.dev URL); `app/robots.ts`, `app/sitemap.ts` | Absolute links for the environment that serves them |
| `next/font/google` | `next/font/local` over the `geist` package's variable fonts, shipped with the OFL | Google Fonts is unreachable from the build on GitHub's runners |
| `basehub/next-image`'s loader | Unchanged for BaseHub assets; local sample images unoptimized | BaseHub's CDN sizes its images; the Worker has no optimiser |

## 3. The unconnected site

The platform brokers Cloudflare, not BaseHub, so a bootstrap deploys a site
whose owner has no repository yet. Upstream's build would stop at "Token not
found". Here a build without `BASEHUB_TOKEN` is **unconnected**: four local
wrappers stand between the template and the SDK —
`src/lib/basehub/{client,pump,events,image}` — and every import of
`basehub()`, `<Pump>`, `sendEvent` and `<BaseHubImage>` goes through them.
Connected, each delegates to the SDK unchanged. Unconnected, the client and
`<Pump>` answer every query from `src/lib/basehub/sample`: a content tree in
the repository's shape (the types in `basehub-types.d.ts`), projected onto
the very selection the SDK would have sent — the fields asked for, union
members by `on_<Type>`, a collection's `filter` / `orderBy` / `first` /
`skip` — so the template's pages, unchanged, render five pages, three posts
and three releases, with images in `public/sample`. The layout shows a
"connect BaseHub" bar (`data-basehub="not-connected"`); the forms' events
are accepted and dropped; the blog hides its search box and the layout the
BaseHub toolbar, which each need a repository; `/api/health` answers
`"content":"sample"`. Every word and image of the sample is written for the
baseline: the template's own demo content lives in BaseHub and is not
copied (risk BH-C).

## 4. The repository

cms-sanity's shape (turso v8): `apps/web` (type
`cloudflare-workers-assets-turbo`, lane `isolated`) and `tests/web` (type
`turbo-package`, a vitest suite run on the `dev` rung). No infrastructure:
BaseHub is a hosted service. The site's name is one seam, `SITE_NAME` in
`src/lib/site.ts`, read by the sample content's settings (site name and title
template); once connected, the name is the BaseHub repository's setting.
`SOURCE_URL` beside it is the site's own repository, linked from the sample
footer, and renamed with it.

## 5. The build

`next build` (Turbopack), `opennextjs-cloudflare build --skipBuild`, then
`populateCache local`. `repo-blueprint.yaml` is cms-sanity's: one landing
(`01-product`) places, brands and lands the whole tree, one convergence
builds and deploys stage and prod side by side, and `02-docs` records what
went live. The smoke checks the home page links the blog and `/api/health`
answers. The Worker is 16 MiB raw, 3.1 MiB gzipped — the code-block
renderer's shiki carries every grammar — so the account needs Workers Paid
(risk BH-F).

The end-to-end tier proves the connected build without the real service: a
stand-in (`testing/lib/fake-basehub.mjs`) serves the SDK's GraphQL endpoint
and ref resolver on localhost, where `BASEHUB_DEBUG_FORCED_URL` points it
(the SDK's own override, passed through `turbo.json`). It answers from the
sample tree made different (another site name, hero, first post and image
host) with its own executor over the parsed queries — written apart from the
unconnected projection, so the two cannot share a mistake.

## 6. Out of scope

- Connected forms, search and draft mode against BaseHub itself: each needs a
real repository, and the stand-in answers queries only (risk BH-B).
- Rebuilding on publish (a BaseHub webhook to the deploy workflow): an
owner's choice, and a credential the bootstrap does not hold.
- Trimming shiki's grammars to get under Workers Free: a code block's
language is the editor's free choice.

## 7. The alternative rejected

**Rendering on request, as cms-contentful does.** `force-dynamic` pages
would keep the build independent of BaseHub and show a commit on the next
visit, but each page is a dozen `<Pump>` queries (header, footer, theme,
sections, events), the SDK tags its fetches for a cache the static-assets
one cannot write, and the template is built around `force-static` and
`generateStaticParams`. Pre-rendering keeps the template as it is, serves
every page from the Worker's assets with no request to BaseHub, and costs a
redeploy per publish — which the sample mode makes safe: a build with no
token is the unconnected site, never a failed one.
31 changes: 31 additions & 0 deletions specs/epics/basehub-marketing/epic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# The epic's declaration. metadata.name equals the directory name; metadata.key
# is the task-key prefix this epic reserves (BH → BH-1, BH-2, …). Owner, target
# date and health are the platform's — never written here.
apiVersion: orun.io/v1
kind: Epic
metadata:
name: basehub-marketing
key: BH
spec:
title: "BaseHub's marketing website template on Cloudflare Workers"
summary: "BaseHub's marketing website template — pages composed in BaseHub from section blocks, a blog, a changelog, feeds, a sitemap, a theme and navigation, read over BaseHub's GraphQL API through the basehub SDK — runs on Cloudflare Workers + Static Assets through @opennextjs/cloudflare, inside the Cirrus baseline's repository conventions, and becomes an Orun baseline that takes a new site from nothing to live on stage and prod in one landing, serving bundled sample content until its owner connects a BaseHub repository."
state: started
milestones:
- name: "BH0 — 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: [BH-1]
- name: "BH1 — the marketing site on Workers"
exitCriteria:
- "apps/web is the upstream template, built by next build without the basehub CLI, then by OpenNext into one Worker with Static Assets, every page pre-rendered as upstream"
- "with no BASEHUB_TOKEN at build the site serves bundled sample content under a bar that says how to connect — never a 500 — and with one it reads the repository"
- "`pnpm typecheck`, `pnpm lint`, `pnpm test` and `pnpm build` are green"
- "`wrangler dev` serves every page, post and release, the feeds, sitemap, robots and health check, and a 404 for an unknown path"
- "the README says how to run, test, preview, connect and deploy it, and how every Vercel piece maps to Cloudflare"
tasks: [BH-2]
- name: "BH2 — 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 site only, renamed throughout to its own name, repository and Worker, with BaseHub's own links 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, unconnected and against a stand-in BaseHub"
tasks: [BH-3]
45 changes: 45 additions & 0 deletions specs/epics/basehub-marketing/implementation-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# basehub-marketing — implementation plan

Three milestones, each one reviewed pull request (BH0 is the repository's
first commit), each green before it merges.

## BH0 — the spec (BH-1)

The repository is born: `intent.yaml` with the placeholder workspace
`ws_CHANGE_ME`, `ci.yml` (turso-starter's, with cms-sanity's changes, which
plans nothing until the workspace is set), the shared TypeScript and ESLint
configuration, the spec index, this doc set and the task contracts.

## BH1 — the marketing site on Workers (BH-2)

- The template's `src/`, `public/` and configuration in `apps/web`; Next
pinned to 16.3.8, every other dependency at the version upstream's lockfile
resolved; `@opennextjs/cloudflare`, `wrangler`, `server-only`.
- `next.config.ts`: the template's image hosts, `BASEHUB_TOKEN` inlined into
the server bundle, `output: 'standalone'`, the workspace root for the
trace. `open-next.config.ts` with the static-assets incremental cache;
`wrangler.jsonc`. `build` is `next build` and the OpenNext build, no
`basehub` CLI.
- The unconnected sample mode: the four wrappers in `src/lib/basehub`, the
sample tree and its projection, `public/sample`, the bar; the toolbar and
search shown only when connected.
- Geist self-hosted; `siteUrl` from `NEXT_PUBLIC_SITE_URL`; `app/robots.ts`;
`/api/health`.
- `SITE_NAME` and `SOURCE_URL` in `src/lib/site.ts`.
- `component.yaml`: the deploy contract, the token's optional secret ref,
the origin per environment and the smoke. `tests/web`: the identity, the
projection, the sample's links, images, section types and fragments, the
connected/unconnected switch and the health route.
- The README's "How it maps to Vercel".

## BH2 — a baseline (BH-3)

cms-contentful's machinery, renamed: `blueprint.yaml`, `repo-blueprint.yaml`,
`.baseline/` (identity, the product's README with "Connecting BaseHub",
task contracts), `tooling/rebrand`, `tooling/bootstrap`,
`hooks/render-deployment-docs.sh` (probing `/`, `/blog` and `/api/health`,
recording whether each site reads a repository yet, and the custom domain
when `SITE_URL` is set), `docs/phases/`, the context pack, `testing/` (the
leak and placement gates on this tree's files; the e2e tier reading every
route the site promises, then building and serving it connected to a
stand-in BaseHub) and `baseline.yml` / `tag.yml`.
13 changes: 13 additions & 0 deletions specs/epics/basehub-marketing/risks-and-open-questions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# basehub-marketing — risks and open questions

| ID | Risk | State | Notes |
|---|---|---|---|
| BH-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 site served by `wrangler dev` and smoke-tested with the component's own command, unconnected and then built against a stand-in BaseHub. A console bootstrap, then a repository connected to it, closes it |
| BH-B | The connected site has not met BaseHub itself | OPEN | The connected build is proven against a stand-in that answers the SDK's own GraphQL and ref resolution from a fixture; BaseHub's real schema, a real token, the forms' events, the blog's search and the toolbar's draft mode on Workers are still to see. The first connected product closes it |
| BH-C | **Upstream carries no licence** | OPEN | basehub-ai/marketing-website-template has no LICENSE file, its `package.json` declares no `license`, and GitHub records none — so no licence grants reuse of its code, though it is published as a template for anyone to clone and deploy (Vercel's gallery, BaseHub's "Use template"). The baseline copies its code, credits it, invents no licence and copies none of its demo content (the sample is written for the baseline). The registry row is unlisted until BaseHub states terms |
| BH-D | A commit in BaseHub shows only after a redeploy | ACCEPTED | Every page is pre-rendered, as upstream; the owner redeploys by hand or with the `# orun: redeploy` stamp (README, "Connecting BaseHub"). Setting the token likewise builds nothing. The feeds and sitemap of a connected site render on request and are current |
| BH-E | The read token is inlined into the Worker's server bundle | ACCEPTED | It reads the repository's content, which the site publishes anyway; only server code names it, and the e2e tier checks no static asset carries it |
| BH-F | The Worker is 3.1 MiB gzipped: Workers Paid | ACCEPTED | basehub's code-block renderer bundles shiki with every grammar (6.5 MB raw) and theme; a code block's language is the editor's choice, so trimming them would break content. Free's limit is 3 MiB |
| BH-G | Next 16.3.8, not upstream's 16.0.9 | ACCEPTED | OpenNext 1.20.11 supports 16.3; 16.3 is the line every other baseline here builds on |
| BH-H | The sample projection implements only what the template asks | ACCEPTED | `filter` with `eq`, `notEq` and `in`, `orderBy`, `first`, `skip`. A new query using another argument is answered unfiltered by the sample, not wrongly by BaseHub; the tests parse every section type the page switch handles |
| BH-I | 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, which Turbopack refuses |
15 changes: 15 additions & 0 deletions tasks/BH-1.TaskContract.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: orun.io/v1
kind: TaskContract
metadata:
name: BH-1
title: "The spec"
spec:
goal: The basehub-marketing repository is born with its intent, CI, tooling and spec index, and the basehub-marketing epic — declaration, doc set and task contracts — is on main
affects:
- specs/epics/basehub-marketing
- specs/epics/README.md
- tasks
doneWhen:
- epic.yaml, README, design, implementation plan, risks and status are on main
- the three task contracts exist
gates: []
18 changes: 18 additions & 0 deletions tasks/BH-2.TaskContract.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: orun.io/v1
kind: TaskContract
metadata:
name: BH-2
title: "The marketing site on Workers"
spec:
goal: BaseHub's marketing website template runs on Cloudflare Workers + Static Assets through OpenNext, deployable before a BaseHub repository exists, with its tests and a README that says 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 every sample page, post and release, the feeds, sitemap, robots and health check, and a 404 for an unknown path, with no BaseHub repository behind it
gates: []
24 changes: 24 additions & 0 deletions tasks/BH-3.TaskContract.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: orun.io/v1
kind: TaskContract
metadata:
name: BH-3
title: "A baseline"
spec:
goal: The repository becomes an Orun baseline — the console card, the build document, the identity and rename engine, the context pack, the deployment record and the baseline's tests — that takes a new site from nothing to live on stage and prod in one landing
affects:
- blueprint.yaml
- repo-blueprint.yaml
- .baseline
- tooling/rebrand
- tooling/bootstrap
- hooks
- docs/phases
- ai/context
- testing
- .github/workflows/baseline.yml
- .github/workflows/tag.yml
- BOOTSTRAP.md
doneWhen:
- Baseline CI is green on main
- the card passes card-check, fetched from main at the merge commit
gates: []
Loading