Navigated to /docs/cli/create-and-generate

Create and generate

Scaffold a new application and add files that follow Tavo.js route, component, store, action, and layout conventions.

Create the application once

create app writes a complete project shell into a new directory. Select a package manager when the team has standardized on one; otherwise use the default generated npm workflow.

BASH
bashnode --version
npx @tavojs/cli create app project-dashboard --package-manager npm
cd project-dashboard
npm install
npm run dev

Use Node.js 20.19+ or 22.12+. The development server prints the local URL after dependencies are installed.

Generate one application concept at a time

Generators choose the correct source directory, file naming convention, imports, and starter types. Options add useful structure without forcing it into every file. Page generation uses a functional default export unless --typed-route explicitly requests defineRoutePage.

BASH
bashnpx tavo generate page 'projects/[id]' --loader --seo
npx tavo generate page 'reports/[year]' --typed-route
npx tavo generate component ProjectCard --props
npx tavo generate store session --shape user,ready
npx tavo generate layout dashboard
npx tavo generate action archive-project
npx tavo generate 404
npx tavo generate error

Use a spec for repeatable batches

For code generators and automation, validate a JSON spec before writing. Dry runs expose the complete write plan, while force should remain an explicit decision when a file already exists.

BASH
bashnpx tavo generate --validate-spec tavo.generated.json
npx tavo generate --from-json tavo.generated.json --dry-run
npx tavo generate --from-json tavo.generated.json
  • Commit the spec when it describes repeatable project structure.

  • Inspect generated route and store names before applying the plan.

  • Run typecheck after generation; a successful write is not the same as a valid application.