Repository navigation
docs: add the Vercel deployment guide - #700
Merged
Merged
Conversation
Adds /docs/deployment/vercel, the guide the `vercel` build target never had: enabling `build.targets: ["vercel"]`, the emitted Build Output API tree and what each file is, the `vercel.json` reconciliation rules as implemented (and that #681's opt-out has not landed), `DATABASE_URL` wiring through the Neon Marketplace integration, `maxDuration` and streaming, composing with a frontend against the open #679/#687 limits, a prebuilt CI flow with a minimal GitHub Actions workflow, `/healthz` behaviour on this target, and local execution of the bundle through a wsproxy with the `B4_PG_WS_PROXY` host:port format from #690. Registers the page everywhere the docs site requires it (nav, SEO registry, lastmod manifest, page wrapper), adds a Vercel row and card to Deployment Options, a `vercel` bullet to the CLI reference, and bumps the pinned page counts in the nav, sitemap, SEO, audit, and check-docs fixtures. Every command and option was checked against packages/cli/src/lib/build/targets/vercel*.ts and web-runtime.ts. Closes #684 Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
blove
temporarily deployed
to
vercel-preview
September 17, 2026 05:41 — with
GitHub Actions
Inactive
`b4` ships a generated markdown copy of the docs site at `packages/cli/docs/` (built by scripts/generate-docs.mjs, gitignored). Adding the Vercel page to the nav makes the bundle emit one more topic file, so the hard-coded topic count in docs-bundle.test.ts needs the same bump the nav, sitemap, SEO, and audit pins already got. The generated `deployment/vercel.md` itself needs no commit; it is produced at build time from the new MDX page. Co-Authored-By: Claude Opus 5 <[email protected]>
#698 landed while this branch was open and closed #690: the vercel target's generated stores now select a driver per request, so the built bundle reaches a plain local Postgres over pooled `pg` with no WebSocket proxy at all. The guide documented the proxy as a hard requirement, so that section was rewritten: - the local recipe is now DATABASE_URL plus a bare `node --input-type=module` import, no Docker network and no wsproxy containers; - `B4_PG_WS_PROXY` is described with the forms it actually accepts (host:port, ws://, wss://), as a way to rehearse the Neon path rather than as a precondition, alongside `B4_PG_DRIVER` and the proxy-with-pg configuration error; - the driver detail links to the edge page's new "Database drivers" section instead of restating it; - the fit check no longer claims WebSocket Postgres is required, and the Neon section notes non-Neon hosts get a pooled `pg` connection. Conflicts resolved toward main: configuration.mdx takes main's `BuildTargetName` union wording from #693, which already names both edge targets, and lastmod.generated.json is regenerated. Co-Authored-By: Claude Opus 5 <[email protected]>
blove
temporarily deployed
to
vercel-preview
September 17, 2026 16:30 — with
GitHub Actions
Inactive
…cing Two more vercel-target changes landed while this branch was open, and both contradicted the guide: - #697 closed #681 by adding `build.vercel.reconcileVercelJson`. The guide said flatly that there is no opt-out. It now documents the flag, what `b4 build` stops doing when it is off, the four `B4_E1003` near misses that are rejected rather than read as configured, and that Fluid must then be enabled in the project settings because nothing checks it from source. - #699 added `B4_PG_SCHEMA` and `B4_PG_TABLE_PREFIX`. The guide said a generated app requires an app-dedicated database. It now carries the `B4_PG_SCHEMA=$VERCEL_ENV` recipe, which is the Vercel-shaped reason the feature exists, and links to the edge page's table for the rest. cli.mdx conflicted and takes main's `vercel` bullet, which already covers the opt-out, with a link to this page appended. Co-Authored-By: Claude Opus 5 <[email protected]>
blove
temporarily deployed
to
vercel-preview
September 17, 2026 17:22 — with
GitHub Actions
Inactive
#694 landed and inverted what this guide said about /healthz. Route matching now happens before store construction, so: - /healthz is pure liveness: no stores, 200 whenever the function serves HTTP, including with DATABASE_URL unset. The guide had said the opposite, that /healthz opens a pool and a bad connection string surfaces there as a 500; - /readyz is the new dependency probe, and is what the guide now tells readers to hit after a deploy — with the two caveats that it reports real causes (hostnames, ports, driver codes) and that neither probe is gated by middleware or thread access. /readyz is also added to the frontend routing lists and the deploy checklist, and the local-bundle snippet now probes it, since /healthz no longer proves anything about the database. Co-Authored-By: Claude Opus 5 <[email protected]>
blove
temporarily deployed
to
vercel-preview
September 17, 2026 18:04 — with
GitHub Actions
Inactive
#695 landed two things this guide needed: - `build.vercel.outDir` / `b4 build --out-dir <dir>`, with the flag winning over the config value, app-root-relative resolution, the rejection of a directory containing the app root, and the error when vercel is not a configured target; - a relaxed output validator. `config.json` now needs version 3 and a route reaching `/index` rather than the exact catch-all, and extra routes and top-level keys are accepted. Together those turn the frontend-composition section from a list of workarounds into a supported flow: stage the runtime tree elsewhere, assemble into `.vercel/output`, and a composed config still validates. The section now says so, and says plainly that the validator runs on what the target stages rather than on what an assembler produces, and that renaming the function off `dest: "/index"` makes the final config the author's responsibility. Also records that the generated stores import `@b4run/postgres-storage/node`, which reaches `pg` through that package's own dependency so an app never declares `pg` itself — the one real gap raised by the session that owns #698. cli.mdx conflicted and takes main's bullet, which covers outDir and the relaxed validator, with a link to this page appended. Co-Authored-By: Claude Opus 5 <[email protected]>
blove
temporarily deployed
to
vercel-preview
September 17, 2026 20:13 — with
GitHub Actions
Inactive
Neither change affects this page. #705 batches route-discovery errors, and #708 is the edge page's own local-run recipe switching from /healthz to /readyz for the same reason this guide already did. #691 was closed unmerged, so the emitted function directory is still index.func and this page's shadowing argument stands unchanged. Only the lastmod manifest conflicted; regenerated. Co-Authored-By: Claude Opus 5 <[email protected]>
blove
temporarily deployed
to
vercel-preview
September 17, 2026 20:55 — with
GitHub Actions
Inactive
blove
temporarily deployed
to
vercel-preview
September 17, 2026 21:42 — with
GitHub Actions
Inactive
None of the three touches this page: verify registry error codes, body-less middleware reject status, and a k8s smoke watchdog. Only the generated SEO manifest conflicted, resolved by regenerating per the procedure #712 added to AGENTS.md. Co-Authored-By: Claude Opus 5 <[email protected]>
blove
temporarily deployed
to
vercel-preview
September 17, 2026 22:03 — with
GitHub Actions
Inactive
blove
added a commit
that referenced
this pull request
Sep 17, 2026
#700 added the guide against the pre-change behaviour: its compose section said the target emits no static dir, no extra functions and no routes, and cited #679/#687 as open proposals. Rewrite it around build.vercel, keep the assemble-it-yourself path as a scoped subsection since outDir still serves that case, and qualify the artifacts table as the bare-build shape. Co-Authored-By: Claude Opus 5 <[email protected]>
blove
added a commit
that referenced
this pull request
Sep 17, 2026
…el build output (#696) * docs: design for composed Vercel build output (#679) Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(cli): resolve build.vercel config and relax the Vercel output validator Pure resolver for build.vercel (functionName, static, functions, routes), route composition in Build Output order, and a validator that accepts a composed tree while keeping the runtime function config exact. Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(cli): compose static assets, extra functions, and routes into the Vercel build output build.vercel describes the Build Output tree beyond the runtime function. The target checks every configured path before touching .vercel/, copies the static dir, bundles each extra function, orders routes as user routes -> filesystem -> runtime -> SPA fallback, and validates the composed tree before the existing atomic publish. The runtime function is b4.func when static assets are configured so it does not shadow static/index.html. Refs #679, #687 Co-Authored-By: Claude Fable 5.1 <[email protected]> * style: format Vercel target sources with the repo config and refresh SEO lastmod Co-Authored-By: Claude Fable 5.1 <[email protected]> * chore(web): refresh SEO lastmod after merging main Co-Authored-By: Claude Opus 5 <[email protected]> * chore(web): refresh SEO lastmod after merging main Co-Authored-By: Claude Opus 5 <[email protected]> * fix(cli): route /readyz to the runtime under a Vercel SPA fallback #694 added /readyz beside /healthz. The scoped runtime route a SPA fallback installs did not list it, so on a composed Vercel deployment /readyz matched the fallback and served the SPA document with a 200 rather than reaching the runtime — a readiness probe that looks healthy while reporting nothing. Add readyz, and cover the composed route with one case per rooted runtime surface so a future surface cannot be added without updating it. Co-Authored-By: Claude Opus 5 <[email protected]> * test(cli): assert the composed runtime route from its exported constant The integration test duplicated the route string, so adding /readyz to the implementation left a stale literal asserting the old value. Reference the constant instead. Co-Authored-By: Claude Opus 5 <[email protected]> * chore(web): refresh SEO lastmod after merging main Co-Authored-By: Claude Opus 5 <[email protected]> * fix(cli): declare response streaming on the Vercel runtime function The runtime function's .vc-config.json carried only handler, launcherType and runtime, so Vercel's Node launcher buffered its responses. The runtime answers /agui/:routeId and /threads/:id/runs/stream with text/event-stream, which meant a deployed frontend received nothing until a run finished instead of tokens as they were produced. Extra functions configured through build.vercel.functions could already opt into streaming; the one function that always streams could not. supportsResponseStreaming is fixed rather than configurable: it follows from what the runtime serves, not from how the app is deployed. validateVercelOutput keeps asserting the runtime config exactly, deriving both the written bytes and the expectation from the same constant. Co-Authored-By: Claude Opus 5 <[email protected]> * fix(cli): give every build.vercel rejection the B4_E1003 code and docs link resolveVercelComposition threw bare CliErrors, so a malformed build.vercel.static.dir printed an uncoded line while an unknown build.vercel key printed the coded, linked form check-error-codes.test.ts asserts. Move the shared invalidBuildConfig helper into vercel-compose.ts, which vercel-config.ts already depends on, and route every throw through it. Also qualify the local-run snippet in the edge docs: the runtime function is index.func only until build.vercel.static renames it. Co-Authored-By: Claude Opus 5 <[email protected]> * chore(web): refresh SEO lastmod after merging main Co-Authored-By: Claude Opus 5 <[email protected]> * docs(vercel): describe the composed tree in the Vercel guide #700 added the guide against the pre-change behaviour: its compose section said the target emits no static dir, no extra functions and no routes, and cited #679/#687 as open proposals. Rewrite it around build.vercel, keep the assemble-it-yourself path as a scoped subsection since outDir still serves that case, and qualify the artifacts table as the bare-build shape. Co-Authored-By: Claude Opus 5 <[email protected]> --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
blove
added a commit
that referenced
this pull request
Sep 17, 2026
…716) The runtime function's supportsResponseStreaming: true is what stops Vercel's Node launcher buffering the whole body; the page now names that mechanism and its symptom, and notes that a function declared under build.vercel.functions must ask for the flag itself. The local-run snippet's functions/index.func/index.mjs is the bare build's path; a build configuring build.vercel.static emits b4.func, so the snippet now says so. Follow-up to #700, audited against #696's source and tests. Co-Authored-By: Claude Opus 5 <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #684.
What
Adds
/docs/deployment/vercel(apps/web/content/docs/deployment/vercel.mdx), the guide thevercelbuild target never had.@b4run/clialso ships a generated markdown copy of the docs, so this is where thedeployment/vercel.mdthe issue asked for comes from.It covers:
build.targets: ["vercel"]and the four runtime packages the bundle imports;config.json,index.func/.vc-config.json,index.func/index.mjs), the bundle validation, and the atomic publish behaviour;vercel.jsonreconciliation as implemented, plus thebuild.vercel.reconcileVercelJson: falseopt-out and the fourB4_E1003near misses it rejects;DATABASE_URLthrough the Neon Marketplace integration, pooledpgfor non-Neon hosts, andB4_PG_SCHEMA=$VERCEL_ENVto keep preview and production apart in one database;maxDuration(not settable fromb4 build, because the output validator pins.vc-config.jsonto three keys, so the project default applies) and streaming;b4 build→vercel deploy --prebuilt --yes) with a minimal GitHub Actions workflow;/healthzon this target, where the per-request store factory runs before dispatch, so the probe exercisesDATABASE_URL;Kept current with three target changes that landed mid-review
This branch was opened against an older main and rebased three times, each time correcting a claim that had become false:
B4_PG_WS_PROXYand two Docker containers. Rewritten: pooledpgreaches a local Postgres directly, and the proxy is now described as a way to rehearse the Neon path, with the three value forms it accepts.build.vercel.reconcileVercelJson: false, what the build stops doing, and that Fluid must be enabled in project settings because nothing then checks it from source.B4_PG_SCHEMA=$VERCEL_ENVrecipe and links to the edge page's table.Conflicts resolved toward main throughout:
configuration.mdxtakes main'sBuildTargetNameunion wording from #693, andcli.mdxtakes main'svercelbullet with a link to this page appended.Only #679 and #687 remain open, and the frontend section documents the manual tree post-processing they force.
Registration
lastmod.generated.json.nav.test.ts,sitemap.test.ts,seo.test.ts,audit-built-seo.mjs,check-docs.mjs, andpackages/cli/test/docs-bundle.test.ts; the README contract test now also requires the Vercel link.Verification
pnpm test: 6412 passed, 0 failed.node scripts/check-docs.mjspasses against a fullpnpm build.pnpm lint28/28;seo:lastmod:checkclean.Not a release.
🤖 Generated with Claude Code