To create a React app using Vite, follow these steps:

  • Install Node.js (version 16 or higher recommended) if not already installed.

  • Open your terminal and run the following command to scaffold a new React project with Vite:

    npm create vite@latest my-react-app --template react

    Replace my-react-app with your desired project name.

  • Navigate into the project directory:

    cd my-react-app
  • Install the project dependencies:

    npm install
  • Start the development server:

    npm run dev
  • Open your browser and go to http://localhost:5173 to view your new React app.

Key Features of Vite:

  • Instant Server Start: Uses native ES modules for near-instant startup.

  • Fast Hot Module Replacement (HMR): Changes appear in the browser almost immediately.

  • Optimized Production Builds: Uses Rollup for efficient bundling.

For a TypeScript version, use the react-ts template instead:

npm create vite@latest my-react-app --template react-ts

I was able to do this using a single file build plugin called viteSingleFile. Just add it to the plugins in vite.config.js|ts file:

export default defineConfig({
  plugins: [react(), viteSingleFile()]
})
Answer from Asen Tolsuzov on Stack Overflow
🌐
Haruna Zakaria
harunzywrites.hashnode.dev › how-to-create-a-react-app-using-vite-for-the-first-time
How to Create a React App Using Vite for the First Time
May 1, 2025 - In this guide, we’ll walk through how to create a React app using Vite for the first time. Before you start, make sure you have the following installed on your computer: Node.js and npm: You can download them from nodejs.org ... This second option is just a straight from the first one and it allows you to run everything at a go. After the setup, move into your new project folder using: ... Replace my-react-app with whatever name you gave your project.
🌐
JavaScript in Plain English
javascript.plainenglish.io › how-to-create-a-react-application-using-vite-cc3e9910a3f3
How to Create a React Application Using Vite | by Mahbub Zaman | JavaScript in Plain English
April 20, 2024 - For example, if someone is already using CRA, then they need to do a migration, which can be easy or difficult based on the project size. On the other hand, if someone is just starting a new project, then they can consider using Vite. From this post, you can learn multiple ways to create a React app using Vite.
Discussions

reactjs - How to build React application with Vite to be able to run the app without web server? Just double click on index.html file and that's it? - Stack Overflow
It is doable with Create React App but with Vite ... I try to add relative paths but still get error for CORS policy. I add "homepage": "." in package.json file but still not wo... More on stackoverflow.com
🌐 stackoverflow.com
Deploy react app using vite
Hi, I’m having issues deploying my full stack react app using vite. I was able to deploy my front end and backend separately. however, I’m not sure how to get them to work together. Or if I should just change my server.js to serve up my app? Any direction or guidance is much appreciated! More on community.render.com
🌐 community.render.com
0
1
September 4, 2023
Migrate to Vite from CRA
With CRA not being in favor anymore , teams may want to migrate* to a different solution. I had the pleasure to migrate 3 larger freelance projects last year from CRA to Vite, because it was the perfect drop in replacement (compared to Next). I collected notes along the way, but never put them online. Now I thought this may be a good time. Hope this helps anyone with the process. *Disclaimer: Not saying that this migration is necessary for every project, because CRA works as it is at the moment! Also not saying that Vite is the perfect solution here, it's just the most straightforward. If you want to be more compatible with upcoming React features (e.g. RSC), choose Next instead. More on reddit.com
🌐 r/reactjs
47
156
March 29, 2023
Super easy migration from Create React App to Vite
just wanted to say, i just joined a team that has an app built in CRA, and it's complex enough that moving to remix/next.js might not be possible in the foreseeable future - and just playing around with it I've been able to run the app and the build with vite! (tests and hotreload need some work but it seems like common problems) will be bookmarking this for future reference when we can actually do the migration, but I see you're still actively maintaining it, so definitely appreciate it! More on reddit.com
🌐 r/react
8
8
April 29, 2023
🌐
GitHub
github.com › vitejs › vite › discussions › 14401
create vite@latest React without the example content · vitejs/vite · Discussion #14401
<div> <a href="https://vitejs.dev" target="_blank"> <img src={viteLogo} className="logo" alt="Vite logo" /> </a> <a href="https://react.dev" target="_blank"> <img src={reactLogo} className="logo react" alt="React logo" /> </a> </div> <h1>Vite + React</h1> <div className="card"> <button onClick={() => setCount((count) => count + 1)}> count is {count} </button> <p> Edit <code>src/App.tsx</code> and save to test HMR </p> </div> <p className="read-the-docs"> Click on the Vite and React logos to learn more </p> </> So starting a new vite project is always a chore at the beginning that requires me to immediately: ... Is there a way for me to initialize a new React project with all of that done already? It would be so nice to be able to just do npm create vite@latest and go straight into building my app.
Author   vitejs
🌐
W3Schools
w3schools.com › react › react_getstarted.asp
React Getting Started
> npx > create-vite my-react-app --template react | o Scaffolding project in C:\Users\stale\my-react-app...
🌐
NamasteDev
namastedev.com › home › react › creating a react app with vite
Creating a React App with Vite - NamasteDev Blogs
June 19, 2025 - In this guide, we’ve covered how to create a new Vite React app, explored the project structure, created components, customized the configuration, deployed the app, and tackled state management and styling. With Vite, you can significantly improve your development experience, allowing you to focus more on building features rather than dealing with slow recompilations and page reloads.
Find elsewhere
🌐
OpenReplay
blog.openreplay.com › how-to-build-your-react-app-using-vite
How to Build your React.js App using Vite
December 19, 2022 - Go ahead and change to the newly ... on Vite. To access the dev server, open http://localhost:3000/ on a browser, and you will be served with your first React-Vite application....
🌐
Vite
vite.dev › guide › build
Building for Production | Vite
When it is time to deploy your app for production, simply run the vite build command. By default, it uses <root>/index.html as the build entry point, and produces an application bundle that is suitable to be served over a static hosting service.
🌐
Relia Software
reliasoftware.com › blog › how-to-create-react-app-using-vite
How to Setup and Create Vite React App? Code Sample Included | Relia Software
April 3, 2025 - Start the development server with the command: ... Vite will start a development server, and you'll see a message in your terminal indicating the local URL where your app is running (usually http://localhost:5173).
Call   +84972016100
Address   629 Nguyen Kiem Street, Duc Nhuan Ward, 700000, Ho Chi Minh City
🌐
Vite
vite.dev › guide
Getting Started | Vite
See create-vite for more details on each supported template: 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. You can use . for the project name to scaffold in the current directory. To create a project without interactive prompts, you can use the --no-interactive flag.
🌐
Robin Wieruch
robinwieruch.de › vite-create-react-app
Migrate to Vite from Create React App (CRA) - Robin Wieruch
March 29, 2023 - A quick migration guide to Vite from Create React App, because (apart from Next.js) Vite is the natural successor of CRA for creating a modern React application as SPA. First, install Vite and all React related libraries (here: Vite’s React Plugin) as development dependencies: ... Fourth, rename all extensions of files which are using JSX from “.js” to “.jsx”, because Vite is explicit with file extensions.
🌐
React Router
reactrouter.com › start › declarative › installation
Installation | React Router
You can start with a React template from Vite and choose "React", otherwise bootstrap your application however you prefer. npx create-vite@latest · Next install React Router from npm: npm i react-router ·
🌐
Codú
codu.co › niall › how-to-create-a-new-react-app-with-vite-iyzulru4
How To Create a New React App With Vite | by Niall Maher | Codú
April 28, 2023 - This article will show you how to get started with Vite and create a React.js app to start building with.
🌐
LogRocket
blog.logrocket.com › home › how to build a react + typescript app with vite
How to build a React + TypeScript app with Vite - LogRocket Blog
May 28, 2025 - Delivered once a week, it's your curated guide to the most important conversations around frontend dev, emerging AI tools, and the state of modern software. npm create vite@latest my-react-app -- --template react-ts
🌐
React
react.dev › learn › build-a-react-app-from-scratch
Build a React app from Scratch – React
For a list of recommended frameworks, check out Creating a React App. The first step is to install a build tool like vite, parcel, or rsbuild. These build tools provide features to package and run source code, provide a development server for ...
🌐
Render
community.render.com › t › deploy-react-app-using-vite › 15032
Deploy react app using vite - Render
September 4, 2023 - Hi, I’m having issues deploying my full stack react app using vite. I was able to deploy my front end and backend separately. however, I’m not sure how to get them to work together. Or if I should just change my server.j…
🌐
Dead Simple Chat
deadsimplechat.com › blog › how-to-build-a-react-app-with-vite
How to build a React app with Vite
November 29, 2023 - Vite is an great build tool using which you can create different types of apps · I hope you liked the article. Thank you for reading ... // src/components/Form.js import React, { useState } from 'react'; function Form({ onAddTask }) { const [inputValue, setInputValue] = useState(''); const handleSubmit = (e) => { e.preventDefault(); if (inputValue.trim()) { onAddTask(inputValue.trim()); setInputValue(''); } }; return ( <form onSubmit={handleSubmit}> <input type="text" value={inputValue} onChange={(e) => setInputValue(e.target.value)} placeholder="Type a new task here" /> <button type="submit">Create a New Task</button> </form> ); } export default Form;
🌐
The New Stack
thenewstack.io › home › how to build a server-side react app using vite and express
How to Build a Server-Side React App Using Vite and Express - The New Stack
November 6, 2023 - Vite’s dev server uses native ES Modules, so you’ll need to add “type” : “module” to your package.json. If you don’t do this you’ll likely see errors relating to: Cannot use import statement outside a module. At the root of your project created a file called index.html. This acts as the “template” for the application. There are two things to note in this file. The div id of ”app” is the target DOM node used by React when hydrateRoot is called.
🌐
React Flow
reactflow.dev › learn
Quick Start - React Flow
1 week ago - This page will take you from zero to a working React Flow app in a few minutes. If you just want to have a look around and get an impression of React Flow, check out our interactive no-code Playground . First, spin up a new React project however you like — we recommend using Vite