React Project Setup with Vite
Harry
· 22 Sep 2026
· 1 views
Log in to track your progress and mark lessons complete.
Sponsored
Prerequisites
Node.js 18+ with npm. Vite is the recommended tool (Create React App is deprecated).
Create a Project
npm create vite@latest my-app -- --template react
cd my-app
npm install
npm run devProject Structure
src/ holds components, hooks and services; public/ holds static assets; index.html is the entry page.
Build and Env
npm run build # outputs dist/
VITE_API_URL=https://api.example.com # .env filesOnly VITE_ prefixed variables are exposed to the browser.
Key Points
- Vite gives instant dev server with HMR.
- dist/ is deployed to any static host.
- Never put secrets in client env vars.