React-Zustand-Vite-TS-temp Tailwind Templates

React Zustand Vite Ts Temp

๐Ÿš€ Modern React 18 startup template with TypeScript, Vite, Zustand, and Tailwind CSS. Production-ready, fully typed, and built with modern development workflows in mind.

React Zustand Vite TypeScript Template

A modern, production-ready template for building scalable React applications with TypeScript, Zustand, and Vite.
Production-ready โ€ข Fully typed โ€ข Modern stack

Demo โ€ข Features โ€ข Quick Start โ€ข Documentation

โœจ Features

  • โšก๏ธ Vite - Lightning fast build tool and dev server
  • โš›๏ธ React 18 - Latest React features
  • ๐Ÿ“˜ TypeScript - Type safety and better DX
  • ๐Ÿ—ƒ๏ธ Zustand - Simple state management
  • ๐ŸŽจ Tailwind CSS - Utility-first CSS
  • ๐Ÿ“ React Hook Form - Form handling
  • ๐Ÿงช Testing Setup - Vitest and React Testing Library
  • ๐Ÿ”ง Code Quality - ESLint, Prettier, and Husky
  • ๐Ÿ“ฆ Docker Ready - Basic containerization
  • ๐Ÿš€ CI/CD - GitHub Actions setup
  • ๐Ÿ“„ Documentation - Comprehensive docs

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 16.x or later
  • npm or yarn
  • Git

Installation

  1. Clone the repository:
git clone https://github.com/AmirHaytham/React-Zustand-Vite-TS-temp.git
cd React-Zustand-Vite-TS-temp
  1. Install dependencies:
npm install
  1. Set up environment variables:
cp .env.example .env
  1. Start development server:
npm run dev

Visit http://localhost:3000 to see your app!

๐Ÿ› ๏ธ Available Scripts

# Development
npm run dev         # Start development server
npm run build      # Build for production
npm run preview    # Preview production build

# Testing
npm run test       # Run tests
npm run test:coverage # Run tests with coverage

# Code Quality
npm run lint       # Run ESLint
npm run format     # Format with Prettier

# Git Hooks
npm run prepare    # Install husky hooks

Tech Stack

๐Ÿ“ Project Structure

โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”œโ”€โ”€ common/       # Shared components
โ”‚   โ”‚   โ”œโ”€โ”€ layout/       # Layout components
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ AppLayout.tsx
โ”‚   โ”‚   โ””โ”€โ”€ leads/        # Lead management
โ”‚   โ”‚       โ”œโ”€โ”€ LeadForm.tsx
โ”‚   โ”‚       โ””โ”€โ”€ LeadForm.test.tsx
โ”‚   โ”œโ”€โ”€ store/
โ”‚   โ”‚   โ””โ”€โ”€ useStore.ts   # Zustand store
โ”‚   โ”œโ”€โ”€ assets/          # Static assets
โ”‚   โ”œโ”€โ”€ App.tsx          # Root component
โ”‚   โ”œโ”€โ”€ App.css          # Root styles
โ”‚   โ”œโ”€โ”€ main.tsx         # Entry point
โ”‚   โ”œโ”€โ”€ index.css        # Global styles
โ”‚   โ””โ”€โ”€ setupTests.ts    # Test configuration
โ”œโ”€โ”€ public/              # Public assets
โ”œโ”€โ”€ docs/               # Documentation
โ”‚   โ””โ”€โ”€ TECHNICAL.md
โ”œโ”€โ”€ config/             # Configuration files
โ”‚   โ”œโ”€โ”€ .env.example
โ”‚   โ”œโ”€โ”€ .env
โ”‚   โ”œโ”€โ”€ tsconfig.json
โ”‚   โ”œโ”€โ”€ vite.config.ts
โ”‚   โ”œโ”€โ”€ tailwind.config.js
โ”‚   โ””โ”€โ”€ eslint.config.js
โ”œโ”€โ”€ .github/            # GitHub workflows
โ”œโ”€โ”€ .husky/             # Git hooks
โ”‚   โ”œโ”€โ”€ pre-commit
โ”‚   โ””โ”€โ”€ commit-msg
โ””โ”€โ”€ docker/             # Docker configuration
    โ”œโ”€โ”€ Dockerfile
    โ””โ”€โ”€ docker-compose.yml

๐Ÿณ Docker

# Start the app
docker-compose up

# Stop the app
docker-compose down

Manual Docker Commands

# Build the image
docker build -t react-app .

# Run the container
docker run -p 3000:3000 react-app

๐Ÿงช Testing

This template uses Vitest and React Testing Library. Example tests are included in the src/components directory.

# Run tests in watch mode
npm run test

# Run tests with coverage
npm run test:coverage

โš™๏ธ Environment Variables

Create a .env file in the root directory:

# App Configuration
VITE_APP_NAME=React Startup
VITE_APP_VERSION=1.0.0

# Development
VITE_DEV_PORT=3000
VITE_DEV_HOST=localhost

# API Configuration
VITE_API_URL=https://api.example.com

# Production
VITE_PROD_URL=https://your-app.com

# Analytics
VITE_ANALYTICS_ID=UA-XXXXX-Y

Note: All environment variables must be prefixed with VITE_ to be accessible in the app.

๐Ÿš€ Deployment

Vercel Deployment

  1. Connect your GitHub repository to Vercel
  2. Configure build settings:
    • Build Command: npm run build
    • Output Directory: dist
    • Install Command: npm install
  3. Add environment variables from .env
  4. Deploy!

Manual Deployment

  1. Build the project:
npm run build
  1. Test the production build:
npm run preview
  1. Deploy the dist folder to your hosting provider

๐Ÿ”’ Security

Our template includes basic security practices:

  • โœ… Environment variables protection through .env
  • โœ… TypeScript type safety
  • โœ… Dependency management with npm/yarn
  • โœ… ESLint security rules
  • โœ… Secure development practices

๐Ÿ“Š Analytics

The template is prepared for analytics integration through environment variables (VITE_ANALYTICS_ID). You can easily add your preferred analytics solution.

๐ŸŒ Browser Support

  • โœ… Chrome (latest)
  • โœ… Firefox (latest)
  • โœ… Safari (latest)
  • โœ… Edge (latest)
  • โœ… Opera (latest)

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿค Contributing

We love your input! We want to make contributing as easy and transparent as possible. Please read our Contributing Guide for details on:

  • Code of Conduct
  • Development process
  • Bug reports
  • Feature requests
  • Pull requests
  • Code review process

Made with โค๏ธ by Amir Haytham

Top categories

Loading Svelte Themes