Quickstart
Get up and running with Vite in just a few minutes.Prerequisites
Scaffolding Your First Project
Use your preferred package manager to create a new Vite project:Follow the prompts
You’ll be prompted to:
- Choose a project name
- Select a framework (React, Vue, Svelte, etc.)
- Pick a variant (JavaScript or TypeScript)
Using Command Line Options
You can also directly specify the project name and template via command line options. For example, to scaffold a Vite + React project:Available Templates
Vite supports a wide range of official templates:| JavaScript | TypeScript |
|---|---|
vanilla | vanilla-ts |
vue | vue-ts |
react | react-ts |
react-swc | react-swc-ts |
preact | preact-ts |
lit | lit-ts |
svelte | svelte-ts |
solid | solid-ts |
qwik | qwik-ts |
React templates come in two variants: standard (using Babel) and SWC (faster compilation). The
react-swc and react-swc-ts templates use SWC for faster builds.Manual Installation
If you prefer to set up Vite manually in an existing project:Understanding the Project Structure
index.html and Project Root
One thing you may have noticed is that in a Vite project,index.html is front-and-central instead of being tucked away inside public. This is intentional:
- During development Vite is a server, and
index.htmlis the entry point to your application - Vite treats
index.htmlas source code and part of the module graph <script type="module" src="...">references your JavaScript source code- Inline
<script type="module">and CSS via<link href>also enjoy Vite-specific features - URLs inside
index.htmlare automatically rebased - no need for special%PUBLIC_URL%placeholders
NPM Scripts
In a scaffolded Vite project, yourpackage.json will include these default scripts:
package.json
--port or --open:
package.json
npx vite --help in your project.
Community Templates
The officialcreate-vite templates are basic starting points. Check out Awesome Vite for community-maintained templates that include:
- Additional tools and configurations
- Different frameworks and libraries
- Full-stack setups
- Monorepo configurations
Try Vite Online
Want to try Vite without installing anything? Use StackBlitz:Vanilla JavaScript
Pure JavaScript starter
React
React with Fast Refresh
Vue
Vue 3 with SFC support
Svelte
Svelte with HMR
Next Steps
Now that you have a Vite project running, explore what you can do:Features
Discover Vite’s rich features
Configuration
Configure Vite for your needs
Plugins
Extend Vite with plugins