Skip to content

Creating a Project ​

vp create interactively scaffolds new Vite+ projects, monorepos, and apps inside existing workspaces.

Overview ​

The create command is the fastest way to start with Vite+. It can be used in a few different ways:

  • Start a new Vite+ monorepo
  • Create a new standalone application or library
  • Add a new app or library inside an existing project

This command supports built-in templates, community templates, and remote templates from GitHub and GitLab.

Usage ​

bash
vp create
vp create <template>
vp create <template> -- <template-options>

Without the Global CLI ​

If you haven't installed the global vp yet. Vite+ provides create-vite-plus package running vp create through your package manager.

bash
pnpm create vite-plus
bash
npm create vite-plus@latest
bash
yarn create vite-plus
bash
bun create vite-plus

The new project uses the package manager that ran the command, unless you pass --package-manager or create it inside an existing workspace. Arguments are forwarded to vp create unchanged, so the first argument is the template, not the target directory:

bash
pnpm create vite-plus vite:application --directory my-app

If you are using npm, there is a -- needed before options meant for vp create, for example npm create vite-plus@latest -- vite:application --directory my-app.

After creating the project, run vp through your package manager, for example pnpm exec vp run.

Built-in Templates ​

Vite+ ships with these built-in templates:

  • vite:monorepo creates a new monorepo
  • vite:application creates a new application
  • vite:library creates a new library
  • vite:generator creates a new code generator (monorepo only, see Code Generators)

Template Sources ​

vp create is not limited to the built-in templates.

  • Use shorthand templates like vite, @tanstack/start, svelte, next-app, nuxt, react-router, and vue
  • Use full package names like create-vite or create-next-app
  • Use local monorepo templates declared in create.templates (for example an internal component or service generator)
  • Use remote templates from GitHub (github:user/repo) or GitLab (gitlab:group/repo)

GitLab templates must come from public repositories on gitlab.com.

Run vp create --list to see the built-in templates and the common shorthand templates Vite+ recognizes.

After a third-party template runs, vp create migrates the generated project to Vite+. When a standalone project already depends on vite-plus, vp create skips this migration and keeps the template's tooling choices.

When no template fits

If no suitable template is available through vp create, use your framework or tool's own initializer to create the project. Then follow the vp migrate guide to move the generated project onto Vite+.

Options ​

  • --directory <dir> writes the generated project into a specific target directory. Only built-in templates and bundled @org templates support this option. With --transition, it names the existing package to update, relative to the current directory.
  • --agent <name> creates agent instructions files during scaffolding
  • --no-agent skips agent instruction setup
  • --editor <name> writes editor config files
  • --no-editor skips editor config setup
  • --git initializes a git repository
  • --no-git skips git repository initialization
  • --package-manager <name> uses a specified package manager (pnpm, npm, yarn, or bun)
  • --approve-builds approves and runs gated dependency build scripts without prompting
  • --no-interactive runs without prompts
  • --verbose shows detailed scaffolding output
  • --list prints the available built-in and popular templates
  • --hooks enables pre-commit hook setup (dispatcher + .vite-hooks + staged config)
  • --no-hooks skips hook setup
  • --transition re-applies a local Bingo generator to an existing project. See Re-apply a generator.
  • --allow-dirty lets --transition run with uncommitted changes

INFO

--git and --no-git are not available when adding a package to an existing monorepo.

After create, manage the dispatcher with vp hooks status, vp hooks disable, and vp hooks enable. See the Commit Hooks.

Dependency build scripts ​

For security, pnpm, bun, yarn (Berry), and npm (v12+) do not run a dependency's build scripts (install / postinstall, e.g. native builds like better-sqlite3) until you approve them. When a template adds such a dependency directly, vp create surfaces it after installing instead of leaving the project in a half-built state:

  • Interactive: you are asked which of those dependencies to approve and build (nothing is selected by default).
  • Non-interactive: a note lists them and points at vp pm approve-builds.
  • --approve-builds: approves and builds them automatically, so non-interactive runs (CI) can produce a ready-to-use project.

Approval is recorded the way each package manager expects: pnpm's allowBuilds, bun's trustedDependencies, npm's allowScripts, or yarn's dependenciesMeta.<pkg>.built (in the workspace root manifest). Transitive build scripts you did not choose (e.g. esbuild pulled in by Vite) are left at the package manager's defaults and are not surfaced. npm 11 and older run build scripts during install, so there is nothing to approve there.

Template Options ​

Put vp create options before -- and the selected template's options after it. For example, --template belongs to create-vite, not vp create. Omitting the separator produces an unexpected argument '--template' error.

bash
vp create vite -- --template react-ts

When using npm create, the first -- passes arguments to vp create; the second passes --template react-ts to create-vite:

bash
npm create vite-plus@latest -- vite -- --template react-ts

Examples ​

bash
# Interactive mode
vp create

# Create a Vite+ monorepo, application, library, or generator
vp create vite:monorepo
vp create vite:application
vp create vite:library
vp create vite:generator

# Use shorthand community templates
vp create vite
vp create @tanstack/start
vp create svelte

# Use full package names
vp create create-vite
vp create create-next-app

# Use remote templates
vp create github:user/repo
vp create https://github.com/user/template-repo
vp create gitlab:group/repo
vp create https://gitlab.com/group/subgroup/repo

Code Generators ​

Monorepos often need to scaffold their own building blocks: a UI component, a service, or an internal package that follows house conventions. Vite+ supports this through generator packages powered by Bingo templates.

Scaffold a generator ​

Inside a Vite+ monorepo, run:

bash
vp create vite:generator

This requires a monorepo workspace. If you don't have one yet, create it first with vp create vite:monorepo.

The scaffolded generator package contains:

  • src/template.ts defines the template using createTemplate from bingo: an options schema built with Zod, and functions that return the files to generate
  • bin/index.ts is the CLI entry. It runs Bingo's runTemplateCLI for interactive runs and Bingo's runTemplate API for vp create --no-interactive and --transition

If the monorepo has a parent directory matching generators or tools, the new package is placed there by default.

Registration ​

Local generators are declared in create.templates in the monorepo's vite.config.ts. This is the source of truth: only registered templates appear in the vp create picker.

vp create vite:generator registers the generator for you, adding an entry to create.templates in the root vite.config.ts.

For example, a generator named my-generator created in generators/my-generator is registered as follows:

ts
import { defineConfig } from 'vite-plus';

export default defineConfig({
  create: {
    templates: [
      {
        name: 'my-generator',
        description: 'A starter for creating a Vite+ code generator.',
        template: './generators/my-generator',
      },
    ],
  },
});

Re-running is idempotent (no duplicate entries), and an existing create.defaultTemplate is preserved. You can also add entries by hand, for example to register a template you didn't scaffold this way. The template value is the generator's workspace package name, or a relative ./path to it.

Run a generator ​

Inside the monorepo, run vp create and pick the generator from the template list, or pass its entry name directly:

bash
# Interactive mode lists registered local templates alongside the built-ins
vp create

# Run a registered template by its name
vp create component

# Pass options to the generator after --
vp create component -- --name @your-org/button

When the generator depends on bingo, vp create appends --skip-requests so it skips Bingo's outbound network requests (such as GitHub API calls). Interactive runs also get --mode setup, because Bingo's CLI otherwise selects transition mode in a directory that contains .git.

After the generator runs, the created package goes through the regular monorepo integration: workspace registration, dependency installation, and formatting.

Customize a generator ​

Edit src/template.ts to define the options and the files to produce:

ts
import { createTemplate } from 'bingo';
import { z } from 'zod';

const packageJsonSchema = z.looseObject({ name: z.string().optional() });

export default createTemplate({
  options: {
    name: z.string().describe('Package name'),
    packageJson: packageJsonSchema.optional().describe('Existing package.json'),
  },
  prepare({ files }) {
    const contents = files?.['package.json'];
    const packageJson =
      typeof contents === 'string' ? packageJsonSchema.parse(JSON.parse(contents)) : undefined;
    return { name: packageJson?.name, packageJson };
  },
  async produce({ options }) {
    return {
      files: {
        'package.json': JSON.stringify(
          { name: options.name, version: '0.0.0', ...options.packageJson, type: 'module' },
          null,
          2,
        ),
        'tsconfig.json': JSON.stringify({ compilerOptions: { strict: true } }, null, 2),
      },
    };
  },
  async setup({ options }) {
    return {
      files: {
        src: {
          'index.ts': `export const name = '${options.name}';\n`,
        },
      },
    };
  },
});
  • options defines the generator's prompts and flags using Zod schemas. Bingo does not prompt for an optional option without a default, such as packageJson.
  • produce() returns the files that the template owns, plus optional scripts to run after generation and suggestions to print for the user. Every run writes these files.
  • setup() returns the starting files of a new project, such as source files. Only new projects get these files.
  • prepare() infers option values from an existing project for --transition. Here it reads package.json, so produce() keeps the project's own fields and sets only type. Use the same pattern for any file that both the template and the project change.

See the Bingo documentation for the full template API.

Re-apply a generator ​

After you change a generator, re-apply it to the projects that use it with --transition. The generator runs in Bingo's transition mode against the existing files:

bash
# Re-apply a registered generator to the package in the current directory
vp create component --transition

# Re-apply it to another package
vp create component --transition --directory packages/button

# Run a generator by its path instead of its create.templates name
vp create ./tools/component --transition

vp create selects the package to update:

  • --directory names an existing package directory, relative to the current directory.
  • Without --directory, it uses the package that contains the current directory.
  • At the root of a monorepo, interactive mode asks for the package. Non-interactive mode requires --directory. Pass --directory . to update the root package.

The repository must have no uncommitted changes. vp create then:

  1. Runs the generator in the package directory with --mode transition.
  2. Formats the changed files.
  3. Lists the changed files. In interactive mode, it asks whether to keep them, show the diff, or restore the previous files. Cancel the prompt to restore the previous files.
  4. Installs dependencies when a package.json changed.

The generator overwrites each file that produce() returns and leaves the files that only setup() returns. Review the result with git status and git diff, and undo it with git stash --include-untracked. When the generator changes nothing, vp create reports that the package has no changes.

Without a template name, interactive mode shows a picker over the local Bingo generators in create.templates. Pass options that prepare() cannot infer after --. Pass --allow-dirty to run with uncommitted changes. vp create records them before the run, so the restore option puts them back.

Update an older generator ​

Generators scaffolded before --transition existed fail with Unknown option '--mode'. To update one, scaffold a new generator with vp create vite:generator, then copy its bin/index.ts into the old generator. Move the files that a project changes after creation, such as source files, from produce() to setup(), and add a prepare() that infers the options from the existing files.

A generator runs with node, which strips TypeScript types only outside node_modules. Keep generators in the workspace, or compile the bin entry of a published generator to JavaScript.

Organization Templates ​

An organization can publish a curated set of templates under a single npm scope by shipping an @org/create package whose package.json carries a createConfig.templates manifest. Once published, vp create @org opens an interactive picker over those templates.

Pick from an org ​

bash
# Open an interactive picker over @your-org/create's manifest
vp create @your-org

# Run a specific manifest entry directly
vp create @your-org:web

# Pin to an exact version or a dist-tag
vp create @your-org@1.2.3
vp create @your-org:web@next

# Set the org as the default for a repo (see create.defaultTemplate config)
vp create

Behind the scenes, vp create @org maps to @org/create (the existing npm create-* convention). If that package has no createConfig.templates field, Vite+ falls back to running the package normally — so adopting the manifest is zero-risk for orgs that already publish @org/create.

Private registries work automatically: Vite+ reads .npmrc files from the project root and ~/, honoring @your-org:registry=... scope mappings and //host/:_authToken=... credentials.

Authoring @org/create ​

There are two common layouts. Pick the one that matches the org's template count and release cadence.

Bundled (recommended for most orgs). All templates live as subdirectories of @org/create itself. Manifest entries use relative ./path values. One repo, one publish, one versioning story — the same pattern used by create-vite and create-next-app.

@your-org/create/
├── package.json              # "createConfig": { "templates": [{ "template": "./templates/web" }, ...] }
├── templates/
│   ├── web/
│   │   ├── package.json
│   │   └── src/...
│   └── library/...
└── README.md

Manifest-only. When the org already publishes independent @org/template-* packages (or hosts its templates on GitHub or GitLab), @org/create stays a thin index.

@your-org/create/
├── package.json              # "createConfig": { "templates": [{ "template": "@your-org/template-web" }, ...] }
└── README.md

The two layouts can be mixed — a manifest can point most entries at external packages and keep a few as bundled subdirectories.

Optionally, provide a bin script so npm create @org (the legacy path) keeps working for non-Vite+ users. vp create @org reads the manifest directly and never runs the bin.

Manifest schema ​

The manifest lives at createConfig.templates in @org/create's package.json:

json
{
  "name": "@your-org/create",
  "version": "1.0.0",
  "createConfig": {
    "templates": [
      {
        "name": "monorepo",
        "description": "Monorepo",
        "template": "@your-org/template-monorepo",
        "monorepo": true
      },
      {
        "name": "web",
        "description": "Web app template (Vite + React)",
        "template": "@your-org/template-web"
      },
      {
        "name": "demo",
        "description": "Bundled demo template",
        "template": "./templates/demo"
      }
    ]
  }
}

Each entry supports:

FieldRequiredNotes
nameyesKebab-case identifier. Used by vp create @org:<name> for direct selection. Must be unique within the array.
descriptionyesOne-line description shown in the picker.
templateyesAn npm specifier (@org/template-foo, optionally @version), a GitHub or GitLab repository, a vite:* builtin, a local workspace package name, or a relative path (./templates/foo) that resolves against the @org/create root.
monoreponoIf true, marks this entry as a monorepo-creating template. Hidden from the picker when vp create runs inside an existing monorepo, mirroring the built-in vite:monorepo filter.

An invalid manifest is a hard error, not a silent fall-through — a maintainer who shipped a manifest should hear about the offending field, e.g. @your-org/create: createConfig.templates[2].template must be a non-empty string.

Bundled subdirectory templates ​

Relative ./... paths resolve against the enclosing @org/create package root — not the user's cwd. The referenced directory is copied into the target project as-is (no template-engine processing); the only exception is that a small set of underscore-prefixed scaffold files (_gitignore, _npmrc, _yarnrc.yml) are renamed to their dotfile equivalents. Paths that escape the package root are rejected.

Make the org the default in a repo ​

Commit this in vite.config.ts at the project root:

ts
import { defineConfig } from 'vite-plus';

export default defineConfig({
  create: { defaultTemplate: '@your-org' },
});

Now vp create (with no argument) drops straight into the @your-org picker. See create.defaultTemplate for details.

The picker always appends a trailing Vite+ built-in templates entry so vite:monorepo / vite:application / vite:library / vite:generator stay reachable from the picker — selecting it routes to the standard built-in flow. For scripts and CI, explicit specifiers (vp create vite:library) bypass the configured default.

Non-interactive inspection ​

vp create @org --no-interactive prints the manifest as a table and exits 1:

A template name is required when running `vp create @your-org` in non-interactive mode.

Available templates in @your-org/create:

  NAME     DESCRIPTION                          TEMPLATE
  web      Web app template (Vite + React)      @your-org/template-web
  library  TypeScript library template          @your-org/template-library
  demo     Bundled demo template                ./templates/demo

Examples:
  # Scaffold a specific template from the org
  vp create @your-org:web --no-interactive

  # Or use a Vite+ built-in template
  vp create vite:application --no-interactive

Publishing checklist ​

  1. Create @org/create (scoped npm package) if you don't already have one.
  2. Add a createConfig.templates array to package.json. (Bundle the templates under ./templates/... or point at external packages.)
  3. (Optional) Provide a bin launcher for npm create @org compatibility.
  4. Publish.
  5. Verify: vp create @org --no-interactive prints the manifest table; vp create @org opens the picker.
  6. (Optional) Commit create: { defaultTemplate: '@org' } in your internal template repos.