โœฆ StealThis .dev

React + TypeScript + Vite Starter

Production-ready React starter with Vite, TypeScript, ESM dev server, and Rollup production builds. Includes path aliases and optimal defaults.

Open in Lab
react vite typescript
Targets: HTML

Code

React + TypeScript + Vite Starter

The fastest way to scaffold a modern React project with full TypeScript support. One command gives you a production-ready setup with Viteโ€™s blazing-fast ESM dev server and optimized Rollup builds.

Quick Start

npm create vite@latest my-app -- --template react-ts
cd my-app
npm install
npm run dev

This scaffolds a complete React 18+ project with TypeScript, JSX transform, HMR, and a pre-configured build pipeline.

What You Get

  • Vite dev server โ€” Native ESM, sub-50ms HMR, no bundling during development
  • TypeScript โ€” Strict mode enabled, path aliases ready via tsconfig.json
  • React 18+ โ€” Concurrent features, automatic JSX runtime
  • Rollup production builds โ€” Tree-shaking, code splitting, optimized chunks
  • ESLint โ€” Pre-configured with React and TypeScript rules
  • CSS Modules โ€” Supported out of the box, no extra config needed

Generated Project Structure

my-app/
โ”œโ”€โ”€ public/
โ”‚   โ””โ”€โ”€ vite.svg
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ assets/
โ”‚   โ”‚   โ””โ”€โ”€ react.svg
โ”‚   โ”œโ”€โ”€ App.css
โ”‚   โ”œโ”€โ”€ App.tsx
โ”‚   โ”œโ”€โ”€ index.css
โ”‚   โ”œโ”€โ”€ main.tsx
โ”‚   โ””โ”€โ”€ vite-env.d.ts
โ”œโ”€โ”€ index.html
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ tsconfig.json
โ”œโ”€โ”€ tsconfig.app.json
โ”œโ”€โ”€ tsconfig.node.json
โ””โ”€โ”€ vite.config.ts

Key Files

  • vite.config.ts โ€” Plugins, aliases, build options. Add @vitejs/plugin-react-swc for faster refresh.
  • tsconfig.json โ€” Project references setup. tsconfig.app.json handles app code, tsconfig.node.json handles config files.
  • main.tsx โ€” App entry point. Renders into #root using createRoot.
  • index.html โ€” Vite uses this as the entry; the <script type="module"> tag points to main.tsx.

Extend With

ToolPurpose
React RouterClient-side routing with loaders and actions
TanStack QueryServer state management, caching, and synchronization
VitestVite-native unit testing with Jest-compatible API
Tailwind CSSUtility-first CSS framework
ZustandLightweight state management

References