Course contentsShow
← React
Lesson 38 of 2,3962. Setup and Modern ToolingFree lesson

Creating a Vite + React Project

Use 'npm create vite@latest' to scaffold a new React app with TypeScript or JavaScript in seconds.

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:

  1. Project name – what you want to call your app
  2. Framework – select "React"
  3. 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.json with dependencies (React, Vite, etc.)
  • vite.config.js with sensible defaults
  • index.html as 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.