npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vite-plugin-create

v1.1.2

Published

A Vite plugin and CLI tool for scaffolding React components, stores, and pages using customizable templates. Supports TypeScript and modern Vite projects.

Downloads

62

Readme

vite-plugin-create - Vite plugin to scaffold components, stores, and pages

npm version License: MIT

vite-plugin-create is a Vite plugin and CLI tool for quickly generating components, stores, pages, and other entities. The plugin helps speed up development by utilizing customizable templates.

Why vite-plugin-create?

Tired of repetitive boilerplate? vite-plugin-create is a powerful yet simple Vite plugin and CLI tool designed to save you hours by automating component, page, store, and custom entity generation — fully customizable and scalable for any project size.


✨ Features

  • Highly flexible and extensible — create your own generators and templates tailored to your workflow.
  • Designed for rapid development and zero-copy-paste productivity boost.
  • Generate components, pages, stores, or any custom entity using templates.
  • Create your own generators in vite-create.config.json.
  • Supports file naming styles: PascalCase, camelCase, kebab-case, original.
  • Choose between TypeScript or JavaScript on init.
  • Automatically creates configuration and templates via vite-create init.
  • Generate single file entities (e.g., hooks, utils) by setting a flat "path" in config — no folder creation required.

📦 Installation

npm install vite-plugin-create --save-dev

or

yarn add vite-plugin-create --dev

🔌 Plugin Setup

After installing, import and add the plugin to your Vite config:

// vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import vitePluginCreate from "vite-plugin-create";

export default defineConfig({
  plugins: [react(), vitePluginCreate()],
});

🚀 Usage

1. npx vite-create init

Initializes configuration and templates. You’ll be asked:

  • Do you want to use TypeScript?

Based on your choice, the correct config and template files will be added to your project.

2. npx vite-create <generator> <name>

Creates the entity with the given name using the matching generator in config.

Example:

npx vite-create component Button
npx vite-create page Home
npx vite-create custom myThing

📁 Folder Structure After Init

templates/
  component/
    component.tsx / .jsx
    style.scss
    index.ts / .js
    test.tsx / .jsx
  page/
    page.tsx / .jsx
    index.ts / .js
    style.scss
  store/
    zustand.ts / .js
vite-create.config.json

🛠 Configuration (vite-create.config.json)

Example config:

{
  "defaultPath": "src",
  "templateVars": {
    "useTypeScript": true,
    "fileNameStyle": "pascalCase"
  },
  "generators": {
    "component": {
      "path": "components/{{name}}",
      "files": {
        "{{name}}.tsx": "templates/component/component.tsx",
        "{{name}}.module.scss": "templates/component/style.scss",
        "index.ts": "templates/component/index.ts"
      }
    },
    "page": {
      "path": "pages/{{name}}",
      "files": {
        "{{name}}.tsx": "templates/page/page.tsx",
        "{{name}}.module.scss": "templates/page/style.scss",
        "index.ts": "templates/page/index.ts"
      }
    },
    "store": {
      "path": "stores/{{name}}",
      "fileNameStyle": "camelCase",
      "files": {
        "{{name}}.ts": "templates/store/zustand.ts"
      }
    }
  }
}

Custom basePath per generator

If your project structure differs from the default (e.g., you keep components inside UI/components, pages under UI/pages, and hooks in the root), you can override the default base path per generator like so:

{
  "defaultPath": "src",
  "generators": {
    "component": {
      "basePath": "src/UI",
      "path": "components/{{name}}",
      "files": {
        "{{name}}.tsx": "templates/component/component.tsx",
        "index.ts": "templates/component/index.ts",
        "{{name}}.module.scss": "templates/component/style.scss"
      }
    },
    "page": {
      "basePath": "src/UI",
      "path": "pages/{{name}}",
      "files": {
        "{{name}}.tsx": "templates/page/page.tsx",
        "{{name}}.module.scss": "templates/page/style.scss",
        "index.ts": "templates/page/index.ts"
      }
    },
    "hook": {
      "path": "hooks",
      "fileNameStyle": "camelCase",
      "files": {
        "{{name}}.ts": "templates/hook/useHook.ts"
      }
    }
  }
}

This will result in:

src/UI/components/Button/
src/UI/pages/Home/
src/hooks/useAuth.ts

Each generator can fully control its output location.

  • Add any custom generator by extending the generators field.
  • Template files can use Handlebars placeholders: {{name}}, {{PascalCaseName}}, etc.
// Example of single file hook generator
"hook": {
  "path": "hooks", // generates in src/hooks without folder
  "fileNameStyle": "camelCase",
  "files": {
    "{{name}}.ts": "templates/hook/useHook.ts"
  }
}

Then run:

npx vite-create hook useAuth

This will generate:

src/hooks/useAuth.ts

🧪 Custom Generators

You can define and use any generator by name:

"generators": {
  "custom": {
    "path": "customs/{{name}}",
    "files": {
      "{{name}}.ts": "templates/custom/index.ts"
    }
  }
}

Then run:

npx vite-create custom MyUtility
You can create generators with **any** name you want — not just "custom".  
Simply add your generator config with a unique name in `vite-create.config.json` and create matching templates.  
Then run `npx vite-create your-generator-name <entityName>`.

---

## 🛣 Roadmap

- ✅ Custom generators
- ✅ TypeScript / JavaScript toggle via init prompt
- ✅ Naming styles per generator
- ✅ File extensions mapped automatically (.ts/.tsx/.js/.jsx)
- 📁 Directory-based template support
- 🧰 Future: simple GUI configurator (in CLI or browser)
- 🌐 Future: official website with full documentation and interactive playground

---

## 🔧 Dependencies

- `commander`
- `fs-extra`
- `handlebars`
- `inquirer`
- `typescript`

---

## Contributing & Community

`vite-plugin-create` is 100% open source and thrives thanks to an active community. Your ideas, feedback, and pull requests are always welcome — let’s build the best developer experience together!

## 📜 License

MIT — [opensource.org/licenses/MIT](https://opensource.org/licenses/MIT)

Keywords

Vite plugin, component generator, CLI scaffolding tool, template generator, TypeScript, React, vite-plugin-create