Init
Create a new project from embedded templates. Produces a ready-to-run layout with frontend, backend, shared code, and types.
Purpose
- Scaffold a clean server-first workspace with sensible defaults.
- Zero-config start:
watchruns immediately after init.
When To Use
- Starting a new HTML-first app or demo.
- Recreating a minimal workspace for tests or examples.
CLI
webstir init <mode> <directory>webstir init <directory>
Inputs & Flags
<mode>:full,ssg,spa, orapi.<directory>: target directory to create or populate.- If you omit
<mode>,initdefaults tofull.
Steps
- Validate or create the target directory.
- Copy the Bun-owned scaffold assets for the selected workspace mode.
- Write
package.jsonwith the matching Webstir dependencies. - Write
base.tsconfig.jsonand the expectedsrc/**layout. - Run
bun installinside the new workspace beforewatch,build,test, orpublish.
Outputs
full:src/frontend/**,src/backend/**,src/shared/**, andtypes/**spa:src/frontend/**,src/shared/**, andtypes/**ssg:src/frontend/**andtypes/**api:src/backend/**,src/shared/**, andtypes/**package.jsonwithwebstir.modebase.tsconfig.json
Errors & Exit Codes
- Non-zero on invalid directory, name normalization failure, or IO errors.
- Logs describe which file or step failed.