Setting Up with Vite: A Professional React Development Environment
Learn how to initialize a professional React project using Vite. We’ll cover the project directory structure and how to launch your fast development environment.
Previously in this course, we explored the introduction-to-component-based-architecture-in-react and why the understanding-the-virtual-dom-and-react-performance is critical for modern web apps. Now that you understand the "why" behind React, it’s time to move to the "how" by building our professional development environment.
We will use Vite (pronounced "veet"), the industry standard for modern React development. Unlike older tools that bundle your entire application before starting the server, Vite uses native ES modules to serve code instantly, making your "save-refresh-see" loop near-instant.
Initializing Your Project
To begin our movie-browser app, ensure you have Node.js (LTS version) installed on your machine. Open your terminal and run the following command:
Bashnpm create vite@latest movie-browser -- --template react
When prompted, follow these steps:
- Select
Reactas the framework. - Select
JavaScript(we'll stick to standard JS for now to focus on React fundamentals).
Once the scaffolding finishes, navigate into your directory and install the dependencies:
Bashcd movie-browser npm install npm run dev
The terminal will provide a local URL (usually http://localhost:5173). Open that in your browser, and you’ll see the default Vite starter page. You have successfully initialized your project setup!
Understanding the Project Directory Structure

A professional development environment relies on a clear, predictable structure. Here is what your new project folder looks like:
node_modules/: This folder contains all the external libraries your project needs. Never edit this directly; it's managed bynpm.public/: Assets here are served as-is. Use this for static files likefavicon.icoor global images that don't need processing.src/: This is where you will spend 99% of your time. All your React components, CSS, and logic reside here.index.html: The entry point of your app. Notice the<div id="root"></div>—this is the "hook" where React mounts your entire component tree.vite.config.js: The configuration file for Vite. You’ll rarely need to touch this as a beginner, but it's where you configure plugins or proxy settings later.package.json: The manifest of your project. It lists your dependencies and the scripts (likenpm run dev) that drive your workflow.
Running the Development Server
When you run npm run dev, Vite starts a local development server with Hot Module Replacement (HMR). HMR is a game-changer: when you change a line of code in a component, Vite updates only that specific part of the page without reloading the entire browser window.
Hands-on Exercise
- Open your project in VS Code (or your preferred editor).
- Navigate to
src/App.jsx. - Change the text inside the
<h1>tag to "My Movie Browser". - Save the file.
- Watch your browser window—it should update instantly without a full page refresh.
Common Pitfalls
- Forgetting to install: If you clone a project from GitHub, you must run
npm installbefore runningnpm run dev. Without thenode_modulesfolder, the dev server will crash because it can't find React. - Running in the wrong directory: Always ensure your terminal is pointed at the root of your project (where
package.jsonlives). - Ignoring the
publicvssrcfolder: A common mistake is putting images inpublicwhen they should be imported insrc. If a file needs to be optimized or processed (like a component icon), put it insrc. If it’s a global asset, put it inpublic.
Recap
You now have a functional Vite environment ready for development. We’ve initialized the project, toured the directory structure, and confirmed that the development environment is responsive via HMR. You are now ready to start writing your own components to bring our movie-browser to life.
Up next: Mastering JSX Syntax.
Work with me

Next.js Full-Stack Web App Development
A fast, SEO-ready full-stack web app built with Next.js 16 — from idea to deployed product, by an engineer who ships to production.

Headless WordPress + Next.js Frontend Development
Keep WordPress for content, get a lightning-fast Next.js frontend. The best of both worlds — familiar editing, modern speed.