A professional, production-ready template for building modern React applications with Vite and Tailwind CSS. Features a pre-configured folder structure, reusable components, custom hooks, and API integration setup.
This is a React Vite template with:
- β‘ Vite - Lightning-fast build tool and dev server
- βοΈ React 19 - Latest React features
- π¨ Tailwind CSS v4 - Utility-first CSS framework
- ποΈ Professional Folder Structure - Organized and scalable
- π Path Aliases - Clean imports with
@/prefix - π― Pre-built Components - Navigation, Hero, Cards, Buttons
- π οΈ Utility Functions - Formatting, validation, API calls
- βοΈ Custom Hooks - Authentication and state management ready
react-tailwind-template/
βββ src/
β βββ components/ # Reusable UI components
β β βββ Navigation.jsx
β β βββ HeroSection.jsx
β β βββ FeaturesSection.jsx
β β βββ Footer.jsx
β β βββ Button.jsx
β β βββ Card.jsx
β βββ pages/ # Page components (ready to add)
β βββ layouts/ # Layout components (ready to add)
β βββ hooks/ # Custom React hooks
β β βββ useAuth.js
β βββ services/ # API & external services
β β βββ api.js
β βββ utils/ # Utility functions
β β βββ formatting.js
β β βββ validation.js
β βββ context/ # React Context (ready to add)
β βββ styles/ # Global styles
β β βββ index.css
β β βββ App.css
β βββ assets/ # Images, fonts, etc.
β βββ routes.jsx # Router configuration
β βββ App.jsx
β βββ main.jsx
βββ public/ # Static files
βββ vite.config.js # Vite configuration
βββ tailwind.config.js # Tailwind configuration
βββ package.json
βββ ROUTES_GUIDE.md # Routing documentation
βββ README.md
npm installnpm run devThe app will open at: http://localhost:5173
npm run buildnpm run preview# Clone the repository
git clone <your-repo-url> my-new-project
cd my-new-project
# Remove the git history
rm -rf .git
git init
# Install dependencies
npm install
# Start developing
npm run dev- Click "Use this template" button on GitHub
- GitHub creates a new repository from this template
- Clone your new repository and start developing
If you want to create from scratch:
# Create Vite project
npm create vite@latest my-app -- --template react
cd my-app
# Install Tailwind CSS
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
# Install additional dependencies
npm install react-router-dom
# Copy folder structure
mkdir -p src/{components,pages,hooks,services,utils,context,styles,assets}
# Start development
npm run dev| Technology | Version | Purpose |
|---|---|---|
| React | 19.x | UI Framework |
| Vite | 5.x | Build Tool & Dev Server |
| Tailwind CSS | 4.x | Styling |
| Node.js | 18+ | Runtime |
- Navigation.jsx - Responsive header with logo
- HeroSection.jsx - Landing hero section
- FeaturesSection.jsx - Feature showcase cards
- Footer.jsx - Footer with links
- Button.jsx - Reusable button component
- Card.jsx - Reusable card component
- routes.jsx - React Router v6 configuration
- ROUTES_GUIDE.md - Complete routing documentation
- Ready for page components and nested routes
- validation.js - Email, password, username validation
- formatting.js - Date, time, text formatting
- api.js - Axios instance with auto token injection
- useAuth.js - Authentication state management
// Import with clean paths
import Button from '@/components/Button'
import { formatDate } from '@/utils/formatting'
import api from '@/services/api'
import router from '@/routes'# Development
npm run dev # Start dev server (http://localhost:5173)
# Building
npm run build # Build for production
npm run preview # Preview production build locally
# Code Quality
npm run lint # Run ESLint (if configured)This template includes React Router v6 pre-configured!
// In App.jsx
import { RouterProvider } from 'react-router-dom'
import router from '@/routes'
export default function App() {
return <RouterProvider router={router} />
}Edit src/routes.jsx to add your routes:
const routes = [
{
path: '/',
element: <Layout />,
children: [
{
index: true,
element: <Home />
}
]
}
]See ROUTES_GUIDE.md for complete routing documentation! π
import Button from '@/components/Button'
export default function App() {
return <Button variant="primary">Click me</Button>
}import api from '@/services/api'
const data = await api.get('/endpoint')
const result = await api.post('/endpoint', { data })import { isValidEmail } from '@/utils/validation'
if (isValidEmail(email)) {
// Valid email
}npm install react-router-domAdd page components in src/pages/:
- Home.jsx
- About.jsx
- Contact.jsx
Create contexts in src/context/:
- AuthContext.jsx
- ThemeContext.jsx
Add more hooks in src/hooks/:
- useLocalStorage.js
- useFetch.js
Update src/services/api.js with your API base URL
Edit tailwind.config.js:
export default {
theme: {
colors: {
primary: '#your-color'
}
}
}Create .env.local:
VITE_API_URL=http://localhost:3001/api
VITE_APP_NAME=My App
Access in code:
const apiUrl = import.meta.env.VITE_API_URLFor detailed information:
- See component comment headers for usage examples
- Check Tailwind docs: https://tailwindcss.com
- Check Vite docs: https://vitejs.dev
- Check React docs: https://react.dev
This template is open source and available under the MIT License.
This template includes everything you need to:
β
Build modern React applications
β
Use Tailwind CSS for styling
β
Organize code professionally
β
Scale and maintain easily
β
Integrate with APIs
Start building now: npm run dev