A modern, feature-rich starter template for React applications built with Vite, TypeScript, and TailwindCSS. This template provides a solid foundation for building scalable web applications with best practices and a well-organized project structure.
- React 19 with TypeScript support
- Vite for lightning-fast builds and development
- TailwindCSS for utility-first styling
- Shadcn UI components with customizable themes
- Dark/Light mode support out of the box
- Application shell with responsive layout
- Font Awesome icons integration
- PWA ready with offline capabilities
- Express.js backend setup with basic routing
- File structure optimized for scalability
- Context API setup for state management
- Custom hooks for common functionality
- Responsive design with mobile breakpoint detection
- SEO-friendly setup with meta tags
# Check if installed
npm -v
# or
yarn -vgit clone https://github.com/mrmendoza-dev/vite-react-template
cd vite-react-templatenpm install
# or
yarnVITE_PORT=3030
VITE_API_URL=http://localhost:3030npm start
# or
yarn startThis will run:
- Frontend: http://localhost:5173 (Vite's default port)
- Backend: http://localhost:3030
npm run dev
# or
yarn devnpm run server
# or
yarn servernpm run build
# or
yarn buildnpm run preview
# or
yarn previewreact-vite-template/
├── public/ # Static assets and PWA files
│ ├── favicon/ # Favicon files
│ ├── images/ # Public images
│ ├── _redirects # Netlify redirects
│ └── robots.txt # SEO robots file
├── server/ # Backend server code
│ ├── routes/ # Express routes
│ └── utils/ # Server utilities
├── src/ # Frontend source code
│ ├── assets/ # Frontend assets
│ ├── components/ # React components
│ │ ├── common/ # Shared components
│ │ ├── layout/ # Layout components
│ │ └── ui/ # UI components (Shadcn)
│ ├── contexts/ # React contexts
│ ├── data/ # Static data
│ ├── hooks/ # Custom hooks
│ ├── lib/ # Utility libraries
│ ├── pages/ # Page components
│ ├── services/ # API services
│ ├── styles/ # CSS/SCSS files
│ ├── types/ # TypeScript type declarations
│ └── utils/ # Helper functions
└── docs/ # Documentation
| Variable | Description | Required |
|---|---|---|
| VITE_PORT | Backend server port | Yes |
| VITE_API_URL | API base URL | Yes |
- React 19
- TypeScript
- Vite (build tool)
- TailwindCSS
- Shadcn UI
- React Router DOM
- Font Awesome icons
- Lucide React icons (optional)
- Express.js
- Node.js
- ESLint
- TypeScript
- PWA plugin for Vite
- Concurrently (for running multiple scripts)
- Vitest (testing framework)
- React Testing Library
- jsdom (test environment)
- Responsive Navbar
- Sidebar with collapsible groups
- Main content area
- Theme toggle
- Buttons, Inputs, Labels
- Collapsible panels
- Tooltips, Toasts
- Separation components
- Sheets (dialogs)
useIsMobile- Detect mobile screen sizeuseLocalStorage- Persist data in localStorageuseModal- Simple modal state managementuseFocus- Auto-focus elementsuseInterval- Safe interval hook
This template includes a comprehensive testing setup with Vitest and React Testing Library.
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # With coverage- ✅ Component rendering and structure
- ✅ User interactions and routing
- ✅ Context and state management
- ✅ Accessibility attributes
- ✅ Dialog and modal interactions
tests/
├── components/ # Component tests
├── utils/ # Utility tests
└── setupTests.js # Configuration
The application can be deployed using:
- Connect your GitHub repository
- Set build command to
npm run build - Set publish directory to
dist - Add environment variables in Netlify dashboard
- Similar process to Netlify
- Set the output directory to
dist
This template includes PWA capabilities through Vite PWA plugin:
- Offline support
- App manifest for installation
- Service worker auto-updates
- Icons for various devices
The template uses Shadcn UI for component styling. To customize:
- Modify the theme variables in
src/styles/index.css - Use the
cn()utility function to compose classes - Override individual component styles
- Check if all dependencies are installed
- Verify import paths are correct (case-sensitive)
- Make sure TailwindCSS is properly configured
- Check for CSS specificity issues
- Ensure the site is served over HTTPS
- Verify service worker registration
MIT
- Vite
- React
- TailwindCSS
- Shadcn UI
- Express.js
- Vitest
- React Testing Library