Skip to content

refactor: decouple publish target into renderMode × host axes - #35

Merged
vianmora merged 1 commit into
mainfrom
refactor/decouple-render-host
Sep 8, 2026
Merged

vianmora merged 1 commit into
mainfrom
refactor/decouple-render-host

Conversation

@vianmora

@vianmora vianmora commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Why

POST /publish conflated what to build and where it's served in one buildMode enum (ssg / ssr / cloudflare). The planned remote hosts (SSH → self-host#7, Coolify SSR/SSG → self-host#23/#24) would each multiply that enum. This is the common groundwork of self-host#22.

What

Split the publish target into two orthogonal axes, resolved at the request boundary:

renderMode host pipeline status
ssg local publishBuild
ssr local publishBuildSsr
ssg cloudflare publishBuildCloudflare ✅ (if CLOUDFLARE_*)
ssg ssh 501 (self-host#7)
ssr coolify 501 (self-host#23)
ssg coolify 501 (self-host#24)
  • POST /publish accepts { renderMode, host }; mapping lives in RENDER_HOSTS / normalizeTarget.
  • Legacy buildMode still worksssgssg/local, ssrssr/local, cloudflaressg/cloudflare. The upstream webstudio npm CLI and older builder images are unaffected.
  • Planned-but-unimplemented pairs answer 501 (not 400) so the builder can show "coming soon".
  • GET /capabilities gains coolify, ssh, and a targets: ["ssg:local", …] array of the pairs this publisher can currently run — the builder will use it to disable the rest.

Not in this PR

Test

node --check passes; resolver logic smoke-tested. No test infra in this repo — end-to-end validation on the Coolify bench: publish a site SSG → SSR → Cloudflare → SSG on the same domain and confirm each legacy buildMode path is unchanged.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HrBZ6qo4r4D2fGPEZqBccz

The publish API conflated "what to build" and "where it's served" in one
`buildMode` enum (ssg/ssr/cloudflare), which doesn't scale to the planned
remote hosts (SSH, Coolify) — each would multiply the enum.

Split the target into two orthogonal axes at the request boundary:
  renderMode — "ssg" | "ssr"
  host       — "local" | "cloudflare" | "coolify" | "ssh"

`POST /publish` now accepts `{ renderMode, host }` and resolves it via
`RENDER_HOSTS` / `normalizeTarget`. The legacy `buildMode` field still
works (ssg→ssg/local, ssr→ssr/local, cloudflare→ssg/cloudflare) so the
upstream `webstudio` npm CLI and older builder images are unaffected.

Planned-but-unimplemented pairs (ssg:ssh, ssr:coolify, ssg:coolify)
answer 501 so the builder can show "coming soon" instead of an error.

`GET /capabilities` gains `coolify`, `ssh` and a `targets` array listing
the `${renderMode}:${host}` pairs this publisher can currently run — the
builder will use it to disable the rest.

No change to the pipeline bodies or the internal `state.json.mode` field.

Groundwork for webstudio-self-host#22 (#7, #23, #24).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HrBZ6qo4r4D2fGPEZqBccz
@vianmora
vianmora merged commit dc3af0c into main Sep 8, 2026
1 check 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.

1 participant