Skip to content

Install app templates with one click - #234

Merged
tnkuehne merged 7 commits into
feat/app-builderfrom
feat/template-installs
Nov 20, 2026
Merged

tnkuehne merged 7 commits into
feat/app-builderfrom
feat/template-installs

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Installations with an app builder can install a template in one step from its catalog page, the API or the CLI. Widefleet builds the template's sources at the current commit and deploys them as an app in the organization; the template page then continues with its remaining setup steps.

  • UI: the template page shows Install next to the template's name, across the full width on narrow screens. It installs into an app named like the template, shows the build in progress and opens the app's deployment history, where the deployment continues as with any upload. An install never replaces a deployed app: when an app of that name has a deployment, the page asks for another name before any build work. An app that was never deployed, such as one left by an install that failed to publish, takes the install. Without a builder the page is unchanged.
  • API: POST /api/v1/catalog/templates/{templateId}/install with an optional name returns the app, the deployment and build warnings; a taken name is a 409. Templates report installable.
  • CLI: widefleet catalog templates install <template> [--name <app>] prints the same result as JSON and allows ten minutes for the build.

The control plane loads the template directory at one commit (using GITHUB_TOKEN when set) without its tests, checks the creator permission and the name before building, calls the builder's /bundle and /document phases from #232, creates the app only after a successful build so a failed build leaves the name free (a retry after a failed publish continues into the empty app), and publishes through the same upload path as widefleet deploy. Builder project errors become 400 responses with the builder's message; an unreachable builder is a 503.

Hosted installations bind the two phases as APP_BUILDER and APP_DOCUMENTER; self-hosted installations set PLATFORM_APP_BUILDER_URL to a builder on a private network that only the control plane joins. Deploying the builder for each installation type follows in separate changes, so this change leaves existing installations as they are.

Stacked on #232.

Screenshots

Template page, 1280 px light, before and after:

390 px light before and after, 1280 px dark before and after:

Installing (1280 and 390 px), the deployment history after the redirect, and 390 px dark:

A taken name: the page asks for another (1280 px light and dark, 390 px light and dark, 390 px with a new name):

Checked with the built Node server, synthetic template repository and a synthetic builder at 390 and 1280 px in light and dark: the default and installing states, a taken name followed by an install under a new name, the redirect to the deployment history, and the page without a builder, which matches main. Not checked visually: the form without JavaScript, and builder failures in the browser (covered by API tests).

Validation

pnpm check, the full pnpm exec vitest run (1121 tests) and cargo fmt --check pass. template-installs.integration.test.ts covers the install through the API against PostgreSQL with a synthetic builder: sources without tests, the published artifact's modules, bindings, source map name and documentation, a taken name ending the install before the build, an install under another name, an install into an app that was never deployed, failed builds leaving no app, reserved names, builder errors, unavailable builders, missing templates, and installations without a builder. RUN_CLI_TESTS=1 covers the CLI command, its request and invalid template IDs.

RetriggerView in GreptileConfidence Score: 5/5

This PR appears safe to merge.

Summary

Adds one-click template installs through the catalog page, API and CLI, using the app builder and the existing deployment path.

  • The control plane builds templates into apps and publishes them.
  • The template page can install a template and open its deployment history.
  • The CLI can build and install a catalog template as an app.

No new actionable issues found. The previous deployment-overwrite finding is fixed.

Reviews (11) · Last reviewed commit: "Recheck under the app lock that a templa..." · Reviewed by Greptile

@tnkuehne
tnkuehne added this pull request to stack #233 November 19, 2026 18:52
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 19, 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 Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs 8fe937b Nov 19 2026, 11:52 PM

@tnkuehne
tnkuehne force-pushed the feat/template-installs branch from 98f8c2e to a1a0583 Compare November 19, 2026 23:37
@tnkuehne
tnkuehne force-pushed the feat/template-installs branch 2 times, most recently from 593ffb9 to 4c76ff9 Compare November 19, 2026 23:45
When an app builder is configured, the template page, the API
(POST /api/v1/catalog/templates/{templateId}/install) and the CLI
(`widefleet catalog templates install`) build a template's sources at the
current commit and deploy them as an app in the organization. The control
plane resolves the app first, so app permissions apply before any build, and
publishes through the same upload path as `widefleet deploy`.

Hosted installations bind the builder's two phases as APP_BUILDER and
APP_DOCUMENTER; self-hosted installations set PLATFORM_APP_BUILDER_URL to a
builder on a private network. Without a builder, templates keep the agent
setup prompt only.
Template sources exclude *.test.* and *.spec.* files beside the code as well
as test directories. Each builder phase gets a five-minute deadline, also
through service bindings, which cannot take the control plane's abort signal.
The page installs into an app named like the template; the API and CLI keep
the optional name.
An install now always creates a new app. A taken name ends the install
before any build work, and the template page then shows a name field. The
app is created only after a successful build, so a failed build leaves the
name free for the next attempt.
Storage can fail after an install created its app and before a deployment was queued. A retry under the same name now continues into that empty app instead of reporting the name as taken; apps with any deployment still end the install.
An empty app could be deployed by someone else while the template built. Publishing now checks, under the app's row lock and until the deployment is queued, that the app has no deployment, and the install ends with a name conflict otherwise.
@tnkuehne
tnkuehne force-pushed the feat/template-installs branch from 134d035 to 8fe937b Compare November 19, 2026 23:51
@tnkuehne
tnkuehne merged commit 3ead69a into main Nov 20, 2026
17 checks passed
@tnkuehne
tnkuehne deleted the feat/template-installs branch November 20, 2026 00:32
tnkuehne added a commit that referenced this pull request Nov 20, 2026
Hosted installations now deploy the app builder from #232 and bind it to
the control plane, which turns on one-click template installs from #234.

`deploy-hosted.ts` deploys the same builder Worker twice, as
`<name>-app-builder` for `/bundle` and `<name>-app-documenter` for
`/document`, so each build phase runs in its own isolate. Both deploy
before the control plane, which binds them as `APP_BUILDER` and
`APP_DOCUMENTER`. They have no workers.dev or preview URLs and no
routes, so only the control plane reaches them. The builder's base
configuration is `packages/app-builder/wrangler.jsonc`: the prebuilt
`dist/builder.js` with its two WebAssembly modules attached as compiled
Wasm, and a CPU limit of 120 seconds for large dependency graphs.

The deployment stops with build instructions when the builder or its
modules are missing. Hosted deployments therefore build the service
documentation module (`cargo build --profile wasm -p
platform-service-docs-wasm --target wasm32-wasip1`) and the builder
(`pnpm --filter @platform/app-builder build`) before deploying.

Stacked on #234. Self-hosted installations follow in a separate change.

Validation: `pnpm check`; `hosted-installation.test.ts` (16 tests,
including `RUN_CLOUDFLARE_TESTS=1` after `build:cloudflare`) covers both
builder configurations and the control plane's bindings. A Wrangler dry
run uploads `builder.js` with both modules (25.6 MB, 6.6 MB gzip); CI
repeats it in the Rust suite after building the builder.
















<!-- greptile_comment -->

<!-- greptile_summary -->

<h2><a
href="https://app.greptile.com/api/retrigger?id=113290441&amp;sig=22c4f58bc9a1a179c1e9eee835d1c1f751c3ced826570c1f985601357e275cdb"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img
alt="Retrigger"
src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"
align="right"></picture></a><a
href="https://app.greptile.com/-/switch-tenant?tenant=mendra&amp;next=%2Fwidefleet%2Fwidefleet%2Fpull%2F235&amp;utm_source=greptile_review&amp;utm_medium=github&amp;utm_campaign=view_in_greptile"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img
alt="View in Greptile"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"
align="right"></picture></a>Confidence Score: 5/5</h2>

<!-- greptile-impact-verdict --> The PR appears safe to merge; no
blocking issues were found.

<details open><summary><h3>Summary</h3></summary>

Hosted installations now deploy separate Workers for app bundling and
service documentation, enabling one-click template installs.

- Hosted installs now run app bundling and documentation in separate
Workers.

No actionable issues found. Tests were not run during this review.
</details>

<details open><summary><h3>Diagram</h3></summary>

```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  D[Hosted deployment] --> B[Deploy bundler Worker]
  B --> S[Deploy documentation Worker]
  S --> C[Deploy control plane]
  C -->|APP_BUILDER: /bundle| B
  C -->|APP_DOCUMENTER: /document| S
```
</details>

<!-- greptile_confidence_score:5 -->

<sub>Reviews (8) · Last reviewed commit: ["Deploy the app builder with
hosted
insta..."](aa9a6e8)
· [Reviewed by
Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub>

<!-- /greptile_comment -->
tnkuehne added a commit that referenced this pull request Nov 20, 2026
Self-hosted installations get the app builder from #232 as a Compose
service, so one-click template installs (#234) work there as on hosted
installations (#235).

- The runtime image builds the service documentation module and the app
builder and ships them in `/opt/widefleet-builder`, with the tsrs
license. No new image or registry repository: the builder uses the
runtime image's celld.
- `packages/app-builder/build.ts` also writes `dist/wrangler.json`, a
celld project with the Worker's name and compatibility date. celld
rejects the hosted-only keys of `wrangler.jsonc` (`base_dir`, `limits`,
`observability` …); Wrangler does not upload the file.
- Compose runs the `builder` service with `celld dev --no-watch`: one
stateless node with local storage on a tmpfs, so the builder holds no
storage credentials. It runs read-only without capabilities, publishes
no port and shares the `builder` network only with the control plane. It
reaches the npm registry for dependencies. The control plane gets
`PLATFORM_APP_BUILDER_URL=http://builder:8080`.
- The local demo starts the builder too.

Tests:
- `compose.test.ts` checks that only the builder and the control plane
are on the builder network, that the builder has no ports, volumes or
credentials, and that the control plane finds it.
- `builder-container.test.ts` (packaged-runtime suite) starts the
Compose service from the runtime image and bundles, documents and
rejects a project.
- Locally, the container also built and documented the gmail, github and
onedrive templates with their npm dependencies.
















<!-- greptile_comment -->

<!-- greptile_summary -->

<h2><a
href="https://app.greptile.com/api/retrigger?id=113431912&amp;sig=9586ddbfc2a47758bc5d806944ebc5c4494de6abec908fc1a818e90f0202796d"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img
alt="Retrigger"
src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"
align="right"></picture></a><a
href="https://app.greptile.com/-/switch-tenant?tenant=mendra&amp;next=%2Fwidefleet%2Fwidefleet%2Fpull%2F236&amp;utm_source=greptile_review&amp;utm_medium=github&amp;utm_campaign=view_in_greptile"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img
alt="View in Greptile"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"
align="right"></picture></a>Confidence Score: 5/5</h2>

<!-- greptile-impact-verdict --> The PR appears safe to merge.

<details open><summary><h3>Summary</h3></summary>

Self-hosted installations and the local demo now run the app builder
from the runtime image.

- Self-hosted installs can build templates through a private app
builder.

The previously reported startup issue is fixed: starting the control
plane now starts the builder and waits for it to be healthy. No new
actionable issues were found. Container tests were inspected, not run.
</details>

<details open><summary><h3>Diagram</h3></summary>

```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  C[Control plane] -->|Private Compose network| B[Builder service]
  B --> N[npm registry]
  I[Runtime image] --> B
  I --> R[App runtime]
  B --> W[Bundled app and documentation]
```
</details>

<!-- greptile_confidence_score:5 -->

<sub>Reviews (8) · Last reviewed commit: ["Start the app builder with
the control
p..."](dc9785e)
· [Reviewed by
Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub>

<!-- /greptile_comment -->
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