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 <starter> <directory>webstir init <directory>
Inputs & Flags
<starter>:full,ssg,spa, orapi. The starter only chooses the starting template; after init, the app's files decide what it is (see Workspace).<directory>: target directory to create or populate.- If you omit
<starter>,initdefaults tofull.
Steps
- Validate or create the target directory.
- Copy the Bun-owned scaffold assets for the selected starter.
- Write
package.jsonwith the matching Webstir dependencies. - Run
bun installinside the new workspace beforewatch,build,test, orpublish.
Outputs
full:src/frontend/**andsrc/backend/**, with client-nav on (pages + server), plus.env.exampleand.gitignorespa:src/frontend/**, with client-nav on (pages)ssg:src/frontend/**(pages)api:src/backend/**(server), plus.env.exampleand.gitignorepackage.jsonwith the matching Webstir dependencies, andAGENTS.md
A fresh full app is package.json, .gitignore, .env.example, AGENTS.md, the shell and styles (app.html, app.css), the home page and its test, the server's index.ts and module.ts, and a one-line tsconfig.json for each side. Webstir supplies the rest: the dev clients, the error reporter, the enabled features and the compiler settings.
Errors & Exit Codes
- Non-zero on invalid directory, name normalization failure, or IO errors.
- Logs describe which file or step failed.