Workflows
End-to-end flows driven by the Bun CLI. Workflows coordinate the canonical frontend, backend, and testing packages so a workspace can move from source files to a running or publishable server-first HTML app.
Core Commands
webstir initwebstir buildwebstir watchwebstir testwebstir publishwebstir smokewebstir operationswebstir inspectwebstir agentwebstir doctorwebstir add-pagewebstir add-routewebstir add-jobwebstir add-test
Default Path
When in doubt, use this path:
webstir init full <directory>- Add document pages with
webstir add-page - Keep forms, redirects, auth, and request-time HTML in
src/backend/module.ts - Use
webstir add-routefor backend endpoints that need manifest metadata or inspection visibility - Define request-time views in
src/backend/module.tswhen a page needs server-loaded data at request time - Enable
client-navonly after the baseline HTML flow is already correct - Use
webstir inspectto confirm scaffold health plus the frontend/backend contract surfaces before shipping - Use
webstir repairto restore scaffold drift without changing the app shape - Use
webstir publishplus the Bun Docker deployment contract for shipped apps with a server
Flow Shape
- Resolve the workspace and read its layers from its files.
- Choose the active build plan from the layers:
- pages (
src/frontend/) => frontend - server (
src/backend/index.ts) => backend - pages + server => frontend + backend
- pages + server is the main lane for server-first apps with forms, redirects, auth, and optional enhancement.
- pages without a server publish as a static site, with views rendered at publish.
- pages (
- Run the canonical package logic from
packages/tooling/**. - Emit
build/**for development and test work. - Emit
dist/frontend/**for publish-ready frontend assets when a frontend surface exists. - Start or supervise long-running services only when the workflow requires them.
Workflow Contracts
init
- Creates a workspace from the
full,spa,ssg, orapistarter - Writes source roots under
src/**plustypes/**
build
- Runs the frontend and/or backend package pipelines for the app's layers
- Writes
build/frontend/**andbuild/backend/**
watch
- Starts frontend watch for an app with pages, through the same pipeline as
build; without a server it also renders build-time views - Starts the backend build watcher and runtime for an app with a server
- Proxies
/api/*when the app has pages and a server
test
- Rebuilds the required surfaces
- Discovers tests under
src/**/tests - Executes compiled suites through the active testing provider
publish
- Produces optimized frontend assets under
dist/frontend/**, in the static layout when the app has no server - Produces backend bundles under
build/backend/**when the app has a server - Validates the same runtime shape that the proof apps use in publish mode
- For a published app with a server, pair the workspace with the supported Bun Docker deployment helper under
orchestrators/bun/resources/deployment/docker
Runtime Scope
Only webstir test supports --runtime <frontend|backend|all>.
build, watch, and publish follow the app's layers instead of a runtime flag. An app with only a server gets a backend-only loop; an app with only pages gets frontend-only output.
Practical Reference
If you want to see the workflows exercised against real applications, use:
examples/demos/fullas the canonicalwebstir testand server-first workflow referenceexamples/demos/auth-crudas a proof app for richer auth and CRUD flows, not the canonical scaffold shapeexamples/demos/dashboardas a deliberate enhancement proof, not a default architecture target
Together those demos cover the current HTML-first runtime across redirect-after-post, fragment updates, sessions, auth gates, and publish-mode validation.
Recipe Proof Apps
Use the pinned recipe apps when you want to exercise the current agent-facing lane instead of just describing it:
examples/demos/fullis the scaffold-aligned golden-path recipeexamples/demos/auth-crudis the richer auth and CRUD proof recipeexamples/demos/dashboardis the fragment-refresh proof recipebun run testexercises their required integration and browser behavior
The required suites stay close to the real framework operations: doctor, backend-inspect, test, and publish.