Tech Stack
Our recommended stack for building modern React applications.
Core (Required)
These form the foundation of every project.
| Library | Version | Purpose | Install |
|---|---|---|---|
| React (opens in a new tab) | 18.x | UI library | npm create vite@latest |
| TypeScript (opens in a new tab) | 5.x | Type safety | Included with Vite template |
| Vite (opens in a new tab) | 5.x | Build tool, fast HMR | npm create vite@latest |
| Tailwind CSS (opens in a new tab) | 3.x | Utility-first styling | npm install -D tailwindcss |
Why These?
React 18 - Industry standard with concurrent features, automatic batching, and Suspense.
TypeScript - Catches errors at compile time, provides excellent IDE support, and makes code self-documenting. Non-negotiable for professional projects.
Vite - Blazing fast development with native ESM, instant HMR, and optimized production builds. Replaces Create React App.
Tailwind CSS - Utility-first CSS that scales. No context switching between files, consistent design tokens, tiny production bundles.
Recommended
Libraries you'll need in most projects.
UI Components
| Library | Purpose | When to Use |
|---|---|---|
| shadcn/ui (opens in a new tab) | Accessible component primitives | Always - copy-paste components you own |
| lucide-react (opens in a new tab) | Icon library | Need icons (most projects) |
npx shadcn-ui@latest init
npm install lucide-reactshadcn/ui - Not a component library you install, but components you copy into your project. Built on Radix UI primitives, fully accessible, completely customizable. You own the code.
lucide-react - Beautiful, consistent icons. Tree-shakeable (only imports what you use). Fork of Feather Icons with more icons and active maintenance.
import { Search, Menu, X, ChevronDown } from 'lucide-react';
<Button>
<Search className="h-4 w-4 mr-2" />
Search
</Button>State Management
| Library | Purpose | When to Use |
|---|---|---|
| TanStack Query (opens in a new tab) | Server state, caching | Fetching data from APIs |
| Zustand (opens in a new tab) | Client state | Global UI state, user preferences |
npm install @tanstack/react-query zustandTanStack Query - Handles everything about server state: caching, background refetching, stale-while-revalidate, optimistic updates, infinite queries. Eliminates most Redux use cases.
Zustand - Minimal, fast client state. No boilerplate, no providers, just simple stores. Perfect for UI state like sidebar open/closed, theme, modals.
Forms & Validation
| Library | Purpose | When to Use |
|---|---|---|
| React Hook Form (opens in a new tab) | Form handling | Any form beyond a single input |
| Zod (opens in a new tab) | Schema validation | Validating form data, API responses |
| @hookform/resolvers (opens in a new tab) | Connect Zod to RHF | Using React Hook Form + Zod together |
npm install react-hook-form zod @hookform/resolversReact Hook Form - Performant forms with minimal re-renders. Uncontrolled inputs by default, but works with controlled too. Excellent DevTools.
Zod - TypeScript-first schema validation. Define once, get type inference and runtime validation. Works everywhere: forms, API responses, environment variables.
const schema = z.object({
email: z.string().email(),
password: z.string().min(8),
});
type FormData = z.infer<typeof schema>; // Types derived automaticallyUtilities
| Library | Purpose | When to Use |
|---|---|---|
| clsx (opens in a new tab) | Conditional class names | Conditionally applying classes |
| tailwind-merge (opens in a new tab) | Merge Tailwind classes | Overriding Tailwind classes in components |
| date-fns (opens in a new tab) | Date formatting | Working with dates |
npm install clsx tailwind-merge date-fnsclsx + tailwind-merge - Use together as a cn utility for conditional classes that properly merge Tailwind:
// lib/cn.ts
import { clsx, type ClassValue } from 'clsx';
import { twMerge } from 'tailwind-merge';
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
// Usage
<div className={cn(
'px-4 py-2 rounded',
isActive && 'bg-blue-500',
className // Props can override
)} />date-fns - Modular date utility library. Import only what you need. Immutable, tree-shakeable, comprehensive.
import { format, formatDistanceToNow } from 'date-fns';
format(new Date(), 'MMM d, yyyy'); // "Jan 15, 2026"
formatDistanceToNow(date, { addSuffix: true }); // "3 hours ago"Notifications
| Library | Purpose | When to Use |
|---|---|---|
| Sonner (opens in a new tab) | Toast notifications | User feedback, success/error messages |
npm install sonnerSonner - Beautiful toast notifications. Simple API, accessible, customizable, from the Vercel ecosystem.
// Add Toaster to your app root
import { Toaster } from 'sonner';
function App() {
return (
<>
<Routes />
<Toaster position="top-right" richColors />
</>
);
}
// Use anywhere
import { toast } from 'sonner';
toast.success('Changes saved');
toast.error('Something went wrong');
toast.promise(saveData(), {
loading: 'Saving...',
success: 'Saved!',
error: 'Failed to save',
});Routing
| Library | Purpose | When to Use |
|---|---|---|
| React Router (opens in a new tab) | Client-side routing | Multi-page SPAs |
npm install react-router-domReact Router - De facto standard for React routing. Supports nested routes, loaders, actions, and lazy loading.
Optional
Add these based on project requirements.
Data Tables
| Library | Purpose | When to Use |
|---|---|---|
| TanStack Table (opens in a new tab) | Headless table logic | Complex tables with sorting, filtering, pagination |
npm install @tanstack/react-tableTanStack Table - Headless (no UI), handles all table logic. Bring your own components and styling. Powerful but has a learning curve. See Data Table Template.
HTTP Client
| Library | Purpose | When to Use |
|---|---|---|
| Axios (opens in a new tab) | HTTP requests | Need interceptors, upload progress, cancellation |
| Native fetch | HTTP requests | Simple requests, modern browsers |
npm install axios # Only if neededfetch is sufficient for most projects, especially with TanStack Query. Use Axios if you need request/response interceptors, upload progress, or automatic transforms.Animation
| Library | Purpose | When to Use |
|---|---|---|
| Framer Motion (opens in a new tab) | Animations | Complex animations, gestures, layout animations |
npm install framer-motionFramer Motion - Powerful but adds ~30KB. For simple animations, prefer CSS transitions or Tailwind's built-in transitions.
Mobile
| Library | Purpose | When to Use |
|---|---|---|
| Capacitor (opens in a new tab) | Native mobile wrapper | Deploying to iOS/Android app stores |
npm install @capacitor/core @capacitor/cliSee Mobile section for full setup.
Development Tools
| Tool | Purpose | Install |
|---|---|---|
| pnpm (opens in a new tab) | Fast package manager | npm install -g pnpm |
| ESLint (opens in a new tab) | Code linting | Included with Vite |
| Prettier (opens in a new tab) | Code formatting | npm install -D prettier |
| Husky (opens in a new tab) | Git hooks | npm install -D husky |
| lint-staged (opens in a new tab) | Pre-commit linting | npm install -D lint-staged |
Testing
| Tool | Purpose | When to Use |
|---|---|---|
| Vitest (opens in a new tab) | Unit testing | Testing utilities, hooks, logic |
| Testing Library (opens in a new tab) | Component testing | Testing React components |
| Playwright (opens in a new tab) | E2E testing | Testing full user flows |
| MSW (opens in a new tab) | API mocking | Mocking API calls in tests |
npm install -D vitest @testing-library/react @testing-library/jest-dom
npm install -D @playwright/test
npm install -D mswQuick Install
Copy-paste to install all recommended libraries:
# Core (included with Vite template)
npm create vite@latest my-app -- --template react-ts
# Recommended
npm install @tanstack/react-query zustand react-router-dom
npm install react-hook-form zod @hookform/resolvers
npm install clsx tailwind-merge date-fns lucide-react sonner
# UI Components
npx shadcn-ui@latest init
# Dev tools
npm install -D vitest @testing-library/react @testing-library/jest-dom
npm install -D prettier eslint-config-prettier