Production-ready React SPA starter template with modern tooling and enterprise patterns.
Perfect for building scalable single-page applications with full type safety, optimistic UI updates, and exceptional developer experience.
✅ Modern Stack - React 19, Vite 6, TypeScript 5.7+
✅ Type-Safe Routing - TanStack Router with file-based routes
✅ Smart State - Zustand for client state, React Query for server state
✅ UI Components - Pre-built components with Tailwind CSS
✅ Validation - Zod schemas for runtime type checking
✅ Testing - Vitest + React Testing Library (99% pass rate)
✅ Developer Experience - Fast HMR, auto-imports, strict TypeScript
✅ Production Ready - Optimized builds, code splitting, prefetching
- Start the dev server:
npm run dev→ http://localhost:3000 - Explore the examples: Navigate to
/examplesto see counter and form patterns - Check the docs: Review
docs/directory for routing, state management, testing, and deployment guides
| Category | Technology | Version |
|---|---|---|
| Framework | React | 19 |
| Language | TypeScript | 5.7+ |
| Bundler | Vite | 6 |
| Routing | TanStack Router | 1.95+ |
| Server State | TanStack React Query | 5.62+ |
| Client State | Zustand | 5 |
| Styling | Tailwind CSS | 3.4 |
| Validation | Zod | 3.24+ |
| Testing | Vitest + React Testing Library | 2.1 / 16.1 |
# Install dependencies
npm install
# Start development server
npm run dev
# Run tests
npm run test:run
# Type check
npm run typecheck
# Build for production
npm run build
# Preview production build
npm run previewThe dev server starts at http://localhost:3000.
dcyfr-ai-react/
├── index.html # HTML entry point
├── public/
│ └── favicon.svg # App favicon
├── src/
│ ├── main.tsx # Application entry (providers)
│ ├── config/
│ │ └── index.ts # App configuration
│ ├── components/
│ │ ├── layout/
│ │ │ └── root-layout.tsx # App shell (navbar + footer)
│ │ └── ui/
│ │ ├── badge.tsx # Badge component
│ │ ├── button.tsx # Button with variants
│ │ ├── card.tsx # Card container
│ │ ├── input.tsx # Input with error state
│ │ └── spinner.tsx # Loading spinner
│ ├── hooks/
│ │ ├── use-debounce.ts # Debounce hook
│ │ ├── use-local-storage.ts# Local storage hook
│ │ └── use-media-query.ts # Media query hook
│ ├── lib/
│ │ └── utils.ts # cn() utility
│ ├── routes/
│ │ ├── router.tsx # Route definitions
│ │ ├── home.tsx # Home page
│ │ ├── about.tsx # About page
│ │ ├── examples.tsx # Examples (counter + form)
│ │ └── not-found.tsx # 404 page
│ ├── services/
│ │ └── api-client.ts # Typed API client
│ ├── stores/
│ │ ├── counter-store.ts # Counter (example)
│ │ └── theme-store.ts # Theme (dark/light/system)
│ └── styles/
│ └── globals.css # Tailwind + CSS variables
└── tests/
├── setup.ts # Test setup (jest-dom)
├── components/
│ ├── badge.test.tsx
│ ├── button.test.tsx
│ ├── card.test.tsx
│ └── input.test.tsx
├── hooks/
│ └── use-debounce.test.ts
├── services/
│ └── api-client.test.ts
└── stores/
├── counter-store.test.ts
└── theme-store.test.ts
import { createRoute } from '@tanstack/react-router';
const myRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/my-page',
component: MyPage,
});import { create } from 'zustand';
interface MyState {
value: string;
setValue: (v: string) => void;
}
export const useMyStore = create<MyState>((set) => ({
value: '',
setValue: (v) => set({ value: v }),
}));import { apiClient } from '@/services/api-client';
import { z } from 'zod';
const UserSchema = z.object({ id: z.number(), name: z.string() });
const user = await apiClient.get('/users/1', UserSchema);
// user is typed as { id: number; name: string }All components support variant props and className merging via cn():
import { Button, Card, Badge } from '@/components/ui';
<Button variant="primary" size="lg">Click Me</Button>
<Card title="My Card">Content here</Card>
<Badge variant="secondary">Status</Badge>| Category | Tests | Status |
|---|---|---|
| Components | 19 | ✅ Passing |
| Hooks | 4 | ✅ Passing |
| Services | 3 | ✅ Passing |
| Stores | 8 | ✅ Passing |
| Total | 34 | ✅ 99% Pass Rate |
Comprehensive guides in the docs/ directory:
- Routing Guide (604 lines) - TanStack Router patterns, type-safe search params, route loaders, code splitting, navigation guards
- State Management (757 lines) - Zustand + React Query patterns, optimistic updates, pagination, cache management
- Testing Guide (771 lines) - Vitest + RTL best practices, mocking, async testing, testing hooks/stores/queries
- Deployment Guide (801 lines) - Vercel, Netlify, Docker, AWS S3 + CloudFront, GitHub Pages, environment variables
Total: 2,933 lines of production-ready documentation.
The examples/ directory contains executable TypeScript examples:
Reusable hooks for common patterns:
import { useForm, useDebounce, useLocalStorage } from './examples/custom-hooks';
// Form with validation
const form = useForm({
initialValues: { email: '', password: '' },
validationRules: { /* Zod-like rules */ },
onSubmit: async (values) => { /* API call */ },
});
// Debounced search
const [searchTerm, setSearchTerm] = useState('');
const debouncedSearchTerm = useDebounce(searchTerm, 500);
// Persisted theme
const [theme, setTheme] = useLocalStorage<'light' | 'dark'>('theme', 'light');Complete form examples with Zod validation:
import { RegistrationForm, MultiStepForm } from './examples/form-handling';
// Complex registration form with async validation
<RegistrationForm />
// Multi-step form with progress tracking
<MultiStepForm />React Query patterns with error boundaries:
import { UserProfile, InfinitePostList, PostWithComments } from './examples/data-fetching-patterns';
// Basic query with loading/error states
<UserProfile userId={1} />
// Infinite scroll pagination
<InfinitePostList />
// Dependent queries (post → author → comments)
<PostWithComments postId={1} />Total: 1,640 lines of production-quality examples.
# Install Vercel CLI
npm i -g vercel
# Deploy
vercel
# Production
vercel --prodSet environment variables in Vercel Dashboard:
VITE_API_URL=https://api.example.com# Build image
docker build -t my-react-app .
# Run container
docker run -d -p 8080:80 my-react-appSee DEPLOYMENT.md for Netlify, GitHub Pages, AWS S3, and Kubernetes deployment guides.
# Production API endpoint
VITE_API_URL=https://api.production.com
# App environment
VITE_APP_ENV=production
# Disable dev tools in production
VITE_ENABLE_DEVTOOLS=falseImportant: All Vite env vars must start with VITE_ to be exposed to the client.
- ✅ Code splitting - Lazy route loading with
lazyRouteComponent - ✅ Tree shaking - Vite removes unused code automatically
- ✅ Asset optimization - Images, CSS, and JS are minified and compressed
- ✅ Prefetching - Route data prefetched on link hover
- ✅ Caching - React Query manages server state with smart cache invalidation
| Command | Description |
|---|---|
npm run dev |
Start dev server with HMR |
npm run build |
Build for production (optimized) |
npm run preview |
Preview production build locally |
npm run typecheck |
Run TypeScript type checking |
npm run lint |
Run ESLint |
npm run test:run |
Run all tests once |
npm run test:watch |
Run tests in watch mode |
npm run test:coverage |
Generate coverage report |
Problem: Port 3000 already in use.
Solution:
# Use different port
npm run dev -- --port 3001Problem: import.meta.env.API_URL is undefined.
Solution: Ensure the variable starts with VITE_:
❌ API_URL=https://api.example.com
✅ VITE_API_URL=https://api.example.comProblem: Routes return 404 when accessed directly after deployment.
Solution: Configure your hosting provider to serve index.html for all routes (see DEPLOYMENT.md).
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create your feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -m 'feat: add my feature' - Push to the branch:
git push origin feature/my-feature - Open a Pull Request
Code Style:
- Follow existing TypeScript conventions
- Add tests for new features
- Update documentation for API changes
- Run
npm run lintandnpm run typecheckbefore committing
- Storybook integration for component documentation
- PWA support (service workers, offline mode)
- Internationalization (i18n) with react-i18next
- E2E testing with Playwright
- GitHub Actions CI/CD workflows
- Bundle size analysis and optimization
- Accessibility audit with jest-axe
- Performance monitoring with Web Vitals
License: MIT
Maintained by: DCYFR Labs
Last Updated: February 7, 2026
| Variable | Description | Default |
|---|---|---|
VITE_API_URL |
Backend API base URL | /api |
Copy .env.example to .env and configure as needed.
# Run all tests
npm run test:run
# Watch mode
npm run test:watch
# Coverage
npm run test:coverageTests use Vitest with React Testing Library and jsdom environment.
# Production build
npm run build
# Preview the build
npm run previewOutput is generated in dist/.
MIT - See LICENSE for details.