Advanced reusable React TypeScript configuration with modern tooling and best practices.
- β‘ Vite - Lightning fast HMR and builds
- π· TypeScript - Full type safety
- β React 18 - Latest React with concurrent features
- π£οΈ React Router v6 - Client-side routing
- π¨ BiomeJS - Fast linting and formatting
- π§ͺ Vitest - Unit testing with coverage
- π Playwright - Cross-browser E2E testing
- π± PWA - Progressive Web App with service worker
- π― Stylelint - CSS linting with BEM naming
- πΊοΈ Sitemap - Auto-generated sitemap.xml
- π€ robots.txt - Auto-generated robots.txt
- π Bun - Fast JavaScript runtime & package manager
- Node.js 18+ (recommended: 20+) OR Bun 1.0+
- npm, yarn, pnpm, or bun
# Clone or copy this project
cd react-typescript-starter
# Install dependencies (using bun - recommended)
bun install
# Or using npm
npm install# Start development server (using bun)
bun run dev
# Or using npm
npm run dev
# The app will be available at http://localhost:3000| Script | Description |
|---|---|
bun run dev |
Start development server |
bun run dev:bun |
Start dev server with Bun runtime |
bun run build |
Build for production |
bun run build:bun |
Build with Bun runtime |
bun run preview |
Preview production build |
bun run test |
Run unit tests (Vitest) |
bun run test:bun |
Run tests with Bun test runner |
bun run test:coverage |
Run tests with coverage |
bun run test:e2e |
Run E2E tests (Playwright) |
bun run lint |
Lint with BiomeJS |
bun run lint:fix |
Lint and fix issues |
bun run format |
Format code |
bun run lint:css |
Lint CSS |
bun run typecheck |
Run TypeScript check |
bun run validate |
Run typecheck, lint, and CSS lint |
bun run validate:full |
Full validation including unit tests (use Node) |
bun run test:run |
Run unit tests once (requires Node β see below) |
bun run deps:check |
Check for unused or missing dependencies |
βββ src/
β βββ components/ # Reusable UI components
β βββ pages/ # Page components
β βββ styles/ # Global styles
β βββ test/ # Test setup
β βββ App.tsx # Main app component
β βββ main.tsx # Entry point
βββ e2e/ # Playwright E2E tests
βββ scripts/ # Build scripts
βββ public/ # Static assets
βββ bunfig.toml # Bun configuration
βββ vite.config.ts # Vite configuration
βββ vitest.config.ts # Vitest configuration
βββ playwright.config.ts # Playwright configuration
βββ tsconfig.json # TypeScript configuration
βββ biome.json # BiomeJS linting/formatting
βββ stylelint.config.js # CSS linting rules
| File | Purpose |
|---|---|
bunfig.toml |
Bun runtime configuration |
vite.config.ts |
Vite configuration with PWA |
vitest.config.ts |
Vitest test configuration |
playwright.config.ts |
Playwright E2E configuration |
tsconfig.json |
TypeScript configuration |
biome.json |
BiomeJS linting/formatting |
stylelint.config.js |
CSS linting rules |
Vitest runs under Node.js (via npm exec) because Bun's runtime is not compatible with Vitest worker pools.
# Run all tests once
npm run test:run
# Run tests in watch mode
npm run test
# Run tests with coverage
npm run test:coverage# Install Playwright browsers
npx playwright install
# Run E2E tests
npm run test:e2e
# Run with UI mode
npm run test:e2e:ui
# Debug tests
npm run test:e2e:debugThis project is fully compatible with Bun as an alternative to Node.js.
- 25x faster package installs compared to npm
- Native TypeScript support without compilation
- Built-in test runner compatible with Jest
- Faster script execution with native performance
# Install dependencies
bun install
# Add a package
bun add <package>
# Remove a package
bun remove <package>
# Run any script
bun run <script>
# Execute TypeScript directly
bun run src/main.tsxConfiguration file for Bun behavior:
[install]
linker = "hoisted"
[test]
timeout = 10000
coverage = false
[serve]
port = 3000The app is configured as a Progressive Web App with:
- Service worker for offline support
- Web app manifest for installation
- Automatic updates
Uses CSS with BEM naming convention:
/* Block */
.card { }
/* Element */
.card__title { }
.card__content { }
/* Modifier */
.card--featured { }- BiomeJS for linting and formatting
- Stylelint for CSS linting
- TypeScript for type safety
- Vitest for unit testing
- Playwright for E2E testing
npm run buildThe build output will be in the dist/ directory.
Copy .env.example to .env and adjust values for your project:
cp .env.example .envVITE_APP_TITLE=My App
SITE_URL=https://your-domain.comVITE_APP_TITLEβ exposed to the client viasrc/utils/env.tsSITE_URLβ used at build time for sitemap and robots.txt generation
MIT