Creating a Vite + React Project
What you'll learn: How to create a new React project in seconds using Vite's scaffolding command.
Now that you understand why Vite replaced Create React App (faster builds, modern tooling), let's actually create a project. Vite provides a single command that sets up everything you need: project structure, configuration files, and starter code.
The Magic Command
Open your terminal and run:
npm create vite@latest
This interactive command will prompt you for:
- Project name – what you want to call your app
- Framework – select "React"
- Language variant – choose TypeScript or JavaScript
Alternatively, skip the prompts with flags:
npm create vite@latest my-app -- --template react
For TypeScript:
npm create vite@latest my-app -- --template react-ts
What Just Happened?
Think of npm create vite@latest as a blueprint generator. Instead of manually creating folders, installing packages, and configuring build tools, Vite scaffolds everything in seconds:
- A
src/folder with a sample React component package.jsonwith dependencies (React, Vite, etc.)vite.config.jswith sensible defaultsindex.htmlas your entry point
Next Steps After Creation
cd my-app
npm install
npm run dev
Your React app now runs at http://localhost:5173 with hot module replacement active.
Key Takeaway: npm create vite@latest scaffolds a complete React project with modern tooling in seconds—choose JavaScript or TypeScript, and you're immediately ready to start building components.