Skip to content

al002/modern-react-template

Repository files navigation

Modern React Project Template

A modern, scalable React project template with best practices, monorepo structure, and robust tooling.

English δΈ­ζ–‡

✨ Key Features

  • 🎯 Type Safety: Full TypeScript support across all packages
  • πŸ”„ Hot Module Replacement: Fast development with Vite
  • πŸ“¦ Optimized Builds: Efficient chunk splitting and tree shaking
  • 🎨 Modern Styling: Utility-first CSS with Tailwind
  • 🚦 Type-safe routing: TanStack Router
  • πŸ”§ Maintainable: Consistent code style with Prettier and Oxlint
  • πŸ“± Responsive: Mobile-first design approach
  • 🌍 i18n Ready: Built-in internationalization support
  • πŸ” Auth Ready: Authentication flow implementation
  • πŸ“ Form Handling: Type-safe forms with React Hook Form and Zod
  • 🧩 Modular: Well-organized monorepo structure

πŸ› οΈ Tech Stack

  • Framework: React 19
  • Build Tool: Vite
  • Package Manager: PNPM
  • Monorepo Tool: Turborepo
  • Styling: Tailwind CSS + Lightning CSS
  • UI Components: shadcn/ui
  • State Management: Zustand
  • Router: TanStack Router
  • Form Handling: React Hook Form + Zod
  • Internationalization: i18next
  • HTTP Client: Axios
  • Development Tools:
    • TypeScript
    • Oxlint
    • Prettier
    • Husky
    • Commitlint

πŸš€ Getting Started

Prerequisites

  • Node.js 18 or higher
  • PNPM 9.15 or higher

Installation

# Install dependencies
pnpm install

# Run all packages in development mode
pnpm dev

# Run specific app
pnpm dev --filter @myapp/web
pnpm dev --filter @myapp/chrome-extension

# Build packages
pnpm build

# Lint code
pnpm lint

Project Structure Details

Directory Structure

.
β”œβ”€β”€ apps/                           # Application packages
β”‚   β”œβ”€β”€ chrome-extension/          # Chrome Extension App
β”‚   β”‚   β”œβ”€β”€ public/               # Static assets
β”‚   β”‚   β”œβ”€β”€ src/                 # Source code
β”‚   β”‚   β”‚   β”œβ”€β”€ components/     # UI Components
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks/         # Custom hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ pages/        # Extension pages (popup, options)
β”‚   β”‚   β”‚   └── utils/        # Utility functions
β”‚   β”‚   β”œβ”€β”€ manifest.json     # Extension manifest
β”‚   β”‚   └── vite.config.ts    # Vite configuration
β”‚   β”‚
β”‚   └── web/                   # Main Web Application
β”‚       β”œβ”€β”€ public/           # Static assets
β”‚       β”œβ”€β”€ src/             # Source code
β”‚       β”‚   β”œβ”€β”€ components/ # UI Components
β”‚       β”‚   β”œβ”€β”€ hooks/     # Custom hooks
β”‚       β”‚   β”œβ”€β”€ pages/    # Page components
β”‚       β”‚   β”œβ”€β”€ routes/   # TanStack Router routes
β”‚       β”‚   └── utils/    # Utility functions
β”‚       └── vite.config.ts # Vite configuration
β”‚
β”œβ”€β”€ packages/                  # Shared packages
β”‚   β”œβ”€β”€ configs/             # Shared configurations
β”‚   β”‚   β”œβ”€β”€ src/           # Configuration utilities
β”‚   β”‚   β”œβ”€β”€ tsconfig/     # TypeScript configs
β”‚   β”‚   β”‚   β”œβ”€β”€ base.json     # Base TS config
β”‚   β”‚   β”‚   β”œβ”€β”€ app.json      # App-specific config
β”‚   β”‚   β”‚   └── library.json  # Library config
β”‚   β”‚   └── vite/        # Vite configurations
β”‚   β”‚
β”‚   β”œβ”€β”€ core/           # Core business logic
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ api/       # API interfaces
β”‚   β”‚   β”‚   β”œβ”€β”€ services/  # Business services
β”‚   β”‚   β”‚   β”œβ”€β”€ store/     # State management
β”‚   β”‚   β”‚   └── types/     # Shared types
β”‚   β”‚   └── vite.config.ts
β”‚   β”‚
β”‚   β”œβ”€β”€ shared/        # Shared utilities
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks/    # Shared hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ utils/    # Utility functions
β”‚   β”‚   β”‚   └── types/    # Common types
β”‚   β”‚   └── vite.config.ts
β”‚   β”‚
β”‚   └── ui/           # UI Component Library
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ components/ # Reusable UI components
β”‚       β”‚   β”œβ”€β”€ styles/    # Global styles & themes
β”‚       β”‚   └── hooks/     # UI-related hooks
β”‚       └── vite.config.ts
β”‚
β”œβ”€β”€ .commitlintrc.json      # Commit message linting rules
β”œβ”€β”€ .gitignore             # Git ignore patterns
β”œβ”€β”€ .husky/                # Git hooks
β”œβ”€β”€ .lintstagedrc.json    # Lint-staged configuration
β”œβ”€β”€ .prettierrc           # Prettier configuration
β”œβ”€β”€ package.json         # Root package.json
β”œβ”€β”€ pnpm-workspace.yaml  # PNPM workspace configuration
└── turbo.json          # Turborepo configuration