Skip to main content

Overview

The TailStack React package is a standalone, production-grade frontend architecture template that provides a modern, high-performance foundation for building client-side applications. It leverages cutting-edge technologies including Vite 6, React 19, Tailwind CSS 4, and Shadcn UI.

Perfect For

  • Single-page applications (SPAs)
  • Progressive web apps (PWAs)
  • Client-side rendered dashboards
  • Modern UI-focused projects

Package Information

{
  "name": "frontend",
  "version": "0.0.0",
  "private": true,
  "type": "module"
}

Technical Stack

Vite 6

Lightning-fast build tool with instant HMR and optimized production builds

React 19

Latest React with improved performance and new features

Tailwind CSS 4

New engine for better performance and developer experience

TypeScript 5.9

Full type safety with the latest TypeScript features

Project Structure

react/
├── src/
   ├── api/              # API client and service layer
   ├── components/       # Reusable UI components
   ├── docs/         # Documentation components
   ├── home/         # Home page components
   ├── layout/       # Layout components
   ├── ui/           # Shadcn UI components
   └── weather/      # Weather demo components
   ├── config/           # Application configuration
   ├── constants/        # Constants and enums
   ├── hooks/            # Custom React hooks
   ├── lib/              # Utility libraries
   ├── pages/            # Application pages/screens
   └── docs/         # Documentation pages
   ├── types/            # TypeScript type definitions
   ├── App.tsx           # Root application component
   └── main.tsx          # Application entry point
├── public/               # Static assets
├── vite.config.ts        # Vite configuration
├── tsconfig.json         # TypeScript configuration
└── package.json          # Dependencies and scripts

Available Scripts

pnpm dev
# Starts Vite development server on http://localhost:5173
# Features hot module replacement (HMR)

Dependencies

Core Libraries

{
  "react": "^19.2.0",
  "react-dom": "^19.2.0",
  "react-router-dom": "^7.12.0"
}
  • React 19 with improved performance and concurrent features
  • React Router 7 for declarative routing
{
  "tailwindcss": "^4.1.18",
  "@tailwindcss/vite": "^4.1.18",
  "lucide-react": "^0.562.0",
  "class-variance-authority": "^0.7.1",
  "clsx": "^2.1.1",
  "tailwind-merge": "^3.4.0"
}
  • Tailwind CSS 4 with new high-performance engine
  • Lucide React for beautiful icons
  • CVA for component variant management
  • Utility functions for className handling
{
  "axios": "^1.7.9",
  "sonner": "^2.0.7"
}
  • Axios for HTTP requests
  • Sonner for elegant toast notifications

Development Dependencies

{
  "vite": "^7.2.4",
  "@vitejs/plugin-react": "^5.1.1",
  "typescript": "~5.9.3"
}
{
  "eslint": "^9.39.1",
  "@eslint/js": "^9.39.1",
  "eslint-plugin-react-hooks": "^7.0.1",
  "eslint-plugin-react-refresh": "^0.4.24",
  "typescript-eslint": "^8.46.4",
  "@types/react": "^19.2.5",
  "@types/react-dom": "^19.2.3",
  "@types/node": "^24.10.1"
}
{
  "globals": "^16.5.0",
  "tw-animate-css": "^1.4.0"
}

Vite Configuration

import path from "path"
import tailwindcss from "@tailwindcss/vite"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"

export default defineConfig({
  plugins: [react(), tailwindcss()],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
})

Key Features

  • Path Aliases: Use @/ to import from src/ directory
  • React Plugin: Fast refresh and JSX runtime
  • Tailwind Plugin: Native Tailwind CSS 4 integration

Component Architecture

Shadcn UI Components

The package includes pre-built, accessible UI components from Shadcn UI in the src/components/ui/ directory.
Shadcn components are not installed as dependencies. They’re copied into your project, giving you full control to customize them.

Component Categories

UI Components

Reusable Shadcn UI primitives in components/ui/

Layout Components

Page layouts and structural elements in components/layout/

Feature Components

Domain-specific components (weather, docs, home)

Page Components

Top-level page components in pages/

Custom Hooks

The src/hooks/ directory contains reusable React hooks for common functionality:
  • State management hooks
  • API data fetching hooks
  • Browser API hooks
  • Custom effect hooks

API Layer

The src/api/ directory provides a structured approach to API communication:
// Example API structure
api/
├── client.ts       // Axios instance configuration
├── endpoints.ts    // API endpoint definitions
└── services.ts     // Service layer functions

TypeScript Configuration

Key TypeScript settings for optimal React development:
  • Target: ES2022 for modern JavaScript features
  • Module Resolution: Bundler mode for Vite
  • Path Aliases: @/* maps to ./src/*
  • Strict Mode: Enabled for maximum type safety
  • JSX: React JSX transform

Weather App Demo

The React package includes a fully functional multi-page weather application to showcase the architecture and component patterns.
Located in src/components/weather/, the demo demonstrates:
  • API integration patterns
  • Component composition
  • State management
  • Routing between pages
  • UI component usage

Agent Skills

Pre-configured Skills

Comprehensive performance optimization guide for React applications.
  • 57 rules across 8 categories
  • Performance optimization patterns
  • React rendering best practices
  • Code splitting strategies
Learn more
AI agent skill for working with Tailwind CSS v4 and Shadcn UI.
  • Component generation
  • Styling patterns
  • Dark mode implementation
  • Responsive design
Learn more

Supported AI Agents

  • Gemini
  • Claude
  • Codex
  • Cursor
  • OpenCode
  • Trae

Development Workflow

Getting Started

1

Install Dependencies

pnpm install
2

Start Dev Server

pnpm dev
Application available at http://localhost:5173
3

Start Building

Begin creating components and pages in the src/ directory

Hot Module Replacement

Vite provides instant HMR for:
  • React components
  • Tailwind CSS classes
  • TypeScript files
  • Static assets
Changes appear in the browser without full page reload.

Production Build

Build Process

pnpm build
The build process:
  1. Runs TypeScript compiler (tsc -b)
  2. Creates optimized production bundle with Vite
  3. Outputs to dist/ directory

Optimization Features

Code Splitting

Automatic route-based code splitting

Tree Shaking

Removes unused code from bundle

Asset Optimization

Optimizes images and static assets

CSS Minification

Minifies and optimizes CSS output

Best Practices

Component Organization

// Recommended component structure
components/
├── ui/              // Shadcn UI primitives
├── layout/          // Layout components
├── [feature]/       // Feature-specific components
└── shared/          // Shared utility components

Import Patterns

// Use path aliases
import { Button } from "@/components/ui/button"
import { useAuth } from "@/hooks/useAuth"
import { API_URL } from "@/config/constants"

// Instead of relative imports
import { Button } from "../../components/ui/button"

Type Safety

// Define types for components
interface ButtonProps {
  variant: "primary" | "secondary"
  size: "sm" | "md" | "lg"
  onClick: () => void
}

export const Button: React.FC<ButtonProps> = ({ variant, size, onClick }) => {
  // Component implementation
}

Performance Tips

Use React.lazy() for route-based code splitting:
import { lazy } from 'react'

const Dashboard = lazy(() => import('./pages/Dashboard'))
Use React.memo() for expensive components:
export const ExpensiveComponent = React.memo(({ data }) => {
  // Component logic
})
Use useMemo() and useCallback() to prevent unnecessary re-renders:
const memoizedValue = useMemo(() => computeExpensiveValue(a, b), [a, b])
const memoizedCallback = useCallback(() => doSomething(a, b), [a, b])

Next Steps

Core Package

Learn about the full monorepo architecture

Node Package

Integrate with the backend API

Components

Explore available UI components

Deployment

Deploy your React application

Build docs developers (and LLMs) love